aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-03-29 16:54:52 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-03-29 16:54:52 +0000
commite0e16a3b1d28cf51fecf669d42465cf2a65728f3 (patch)
treead80058b83e11b1bf42210d8e49922b44745ca98 /Game/Code
parent8d591b8344e0cb87e1a987961b3790fa26d323a6 (diff)
downloadusdx-e0e16a3b1d28cf51fecf669d42465cf2a65728f3.tar.gz
usdx-e0e16a3b1d28cf51fecf669d42465cf2a65728f3.tar.xz
usdx-e0e16a3b1d28cf51fecf669d42465cf2a65728f3.zip
Added SBGW to TSelectSlide: Defining the Width of the Selections BG
Added W to TText + Pagebreaks. If Width is given the Text breaks at the given width. Breaks are not generated perfect yet, needs some tuning. Changed all affected Screens to fit the new TText Component git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@49 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/UThemes.pas7
-rw-r--r--Game/Code/Menu/UMenu.pas20
-rw-r--r--Game/Code/Menu/UMenuSelectSlide.pas7
-rw-r--r--Game/Code/Menu/UMenuText.pas141
-rw-r--r--Game/Code/Screens/UScreenEditHeader.pas2
-rw-r--r--Game/Code/Screens/UScreenName.pas3
-rw-r--r--Game/Code/Screens/UScreenOpen.pas6
-rw-r--r--Game/Code/Screens/UScreenPartyPlayer.pas3
-rw-r--r--Game/Code/Screens/UScreenSing.pas12
-rw-r--r--Game/Code/Screens/UScreenSongJumpto.pas9
10 files changed, 167 insertions, 43 deletions
diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas
index e31e94d2..a62c5aed 100644
--- a/Game/Code/Classes/UThemes.pas
+++ b/Game/Code/Classes/UThemes.pas
@@ -97,6 +97,7 @@ type
TThemeText = record
X: integer;
Y: integer;
+ W: integer;
Color: string;
ColR: real;
ColG: real;
@@ -156,6 +157,10 @@ type
Y: integer;
W: integer;
H: integer;
+
+ //SBGW Mod
+ SBGW: integer;
+
Text: string;
ColR, ColG, ColB, Int: real;
DColR, DColG, DColB, DInt: real;
@@ -1142,6 +1147,7 @@ begin
DecimalSeparator := '.';
ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0);
ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0);
+ ThemeText.W := ThemeIni.ReadInteger(Name, 'W', 0);
ThemeText.ColR := ThemeIni.ReadFloat(Name, 'ColR', 0);
ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0);
@@ -1343,6 +1349,7 @@ begin
ThemeSelectS.H := ThemeIni.ReadInteger(Name, 'H', 0);
ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0);
+ ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450);
LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', ''));
ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1);
diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas
index 7c256b5c..bf823b16 100644
--- a/Game/Code/Menu/UMenu.pas
+++ b/Game/Code/Menu/UMenu.pas
@@ -56,7 +56,7 @@ type
function AddText(ThemeText: TThemeText): integer; overload;
function AddText(X, Y: real; Tekst: string): integer; overload;
function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; overload;
- function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload;
+ function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload;
// button
function AddButton(ThemeButton: TThemeButton): integer; overload;
@@ -82,7 +82,7 @@ type
// select slide
function AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; overload;
- function AddSelectSlide(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt,
+ function AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt,
TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt,
SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt,
STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real;
@@ -320,7 +320,7 @@ end;
function TMenu.AddText(ThemeText: TThemeText): integer;
begin
- Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.Font, ThemeText.Size,
+ Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.W, ThemeText.Font, ThemeText.Size,
ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text);
end;
@@ -337,17 +337,17 @@ end;
function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer;
begin
- Result := AddText(X, Y, Style, Size, ColR, ColG, ColB, 0, Tekst);
+ Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Tekst);
end;
-function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer;
+function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer;
var
TextNum: integer;
begin
// adds text
TextNum := Length(Text);
SetLength(Text, TextNum + 1);
- Text[TextNum] := TText.Create(X, Y, Style, Size, ColR, ColG, ColB, Align, Tekst);
+ Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Tekst);
Result := TextNum;
end;
@@ -846,7 +846,7 @@ function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer
var
SO: integer;
begin
- Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX,
+ Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX, ThemeSelectS.SBGW,
ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeSelectS.Int,
ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeSelectS.DInt,
ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeSelectS.TInt,
@@ -867,7 +867,7 @@ begin
SelectsS[High(SelectsS)].SelectedOption := SelectsS[High(SelectsS)].SelectOptInt; // refresh
end;
-function TMenu.AddSelectSlide(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt,
+function TMenu.AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt,
TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt,
SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt,
STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real;
@@ -886,6 +886,7 @@ begin
SelectsS[S].Y := Y;
SelectsS[S].W := W;
SelectsS[S].H := H;
+
SelectsS[S].ColR := ColR;
SelectsS[S].ColG := ColG;
SelectsS[S].ColB := ColB;
@@ -898,7 +899,8 @@ begin
SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp);
SelectsS[S].TextureSBG.X := X + W + SkipX;
SelectsS[S].TextureSBG.Y := Y;
- SelectsS[S].TextureSBG.W := 450;
+ //SelectsS[S].TextureSBG.W := 450;
+ SelectsS[S].SBGW := SBGW;
SelectsS[S].TextureSBG.H := H;
SelectsS[S].SBGColR := SBGColR;
SelectsS[S].SBGColG := SBGColG;
diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas
index 7850cdf6..9885acc0 100644
--- a/Game/Code/Menu/UMenuSelectSlide.pas
+++ b/Game/Code/Menu/UMenuSelectSlide.pas
@@ -81,6 +81,8 @@ type
// property W2: real read Texture2.w write Texture2.w;
// property H2: real read Texture2.h write Texture2.h;
+ property SBGW: real read TextureSBG.w write TextureSBG.w;
+
// procedures
procedure SetSelect(Value: boolean);
property Selected: Boolean read SelectBool write SetSelect;
@@ -104,6 +106,9 @@ begin
SetLength(TextOpt, 1);
TextOpt[0] := TText.Create;
+ //Set Standard Width for Selections Background
+ SBGW := 450;
+
Visible := True;
{SetLength(TextOpt, 3);
TextOpt[0] := TText.Create;
@@ -326,7 +331,7 @@ begin
TextOpt[I].Y := TextureSBG.Y + 20;
//Better Look with 2 Options
- if (Lines=2) then
+ if (Lines=2) AND (Length(TextOptT)= 2) then
TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I;
end;
//TextOpt[I] := TextOpt[0];
diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas
index 5c435a18..4a5356d8 100644
--- a/Game/Code/Menu/UMenuText.pas
+++ b/Game/Code/Menu/UMenuText.pas
@@ -7,13 +7,14 @@ type
TText = class
private
SelectBool: boolean;
+ TextString: String;
+ TextTiles: Array of String;
public
X: real;
Y: real;
-// W: real; // if text is wider than W then it is streched (not yet implemented)
+ W: real; // if text is wider than W then it is breaked
// H: real;
Size: real;
- Text: string;
ColR: real;
ColG: real;
ColB: real;
@@ -25,43 +26,146 @@ type
procedure SetSelect(Value: Boolean);
property Selected: Boolean read SelectBool write SetSelect;
+ procedure SetText(Value: String);
+ property Text: String read TextString write SetText;
+
+ procedure DeleteLastL; //Procedure to Delete Last Letter
+
procedure Draw;
constructor Create; overload;
constructor Create(X, Y: real; Tekst: string); overload;
- constructor Create(ParX, ParY: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); overload;
+ constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); overload;
end;
implementation
-uses UGraphic;
+uses UGraphic, StrUtils;
procedure TText.SetSelect(Value: Boolean);
begin
SelectBool := Value;
end;
+procedure TText.SetText(Value: String);
+var
+ I: Integer;
+ L: Integer;
+ LastPos: Integer;
+ LastBreak: Integer;
+begin
+ TextString := Value;
+
+ if (W > 0) then
+ begin
+ //Set Font Propertys
+ SetFontStyle(Style);
+ SetFontSize(Size);
+
+ //Create New TextTiles Array
+ SetLength (TextTiles, 0);
+ L := 0;
+
+ LastPos := 1;
+ LastBreak := 0;
+ I := Pos (' ', Value);
+ While (I <> 0) do
+ begin
+ if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I))) > W) AND (LastPos <> 1) then
+ begin
+ //new Break
+ SetLength (TextTiles, L+1);
+ TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak);
+
+ Inc(L);
+ LastBreak := LastPos;
+ end;
+
+ LastPos := I;
+ I := PosEx (' ', Value, I+1);
+ end;
+
+ //Last Break
+ if (glTextWidth(PChar(Copy (Value,LastBreak + 1,Length(Value) - LastBreak))) > W) AND (LastPos <> 1) then
+ begin
+ //new Break
+ SetLength (TextTiles, L+1);
+ TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak);
+
+ Inc(L);
+ LastBreak := LastPos;
+ end;
+
+ //last Part
+ SetLength (TextTiles, L+1);
+ TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak);
+
+ end;
+end;
+
+Procedure TText.DeleteLastL;
+var
+ S: String;
+ L: Integer;
+begin
+ S := TextString;
+ L := Length(S);
+ if (L > 0) then
+ SetLength(S, L-1);
+
+ SetText(S);
+end;
+
procedure TText.Draw;
var
- X2: real;
+ X2, Y2: real;
Text2: string;
+ I: Integer;
begin
if Visible then begin
SetFontStyle(Style);
SetFontSize(Size);
+ SetFontItalic(False);
glColor3f(ColR*Int, ColG*Int, ColB*Int);
- if not SelectBool then
- Text2 := Text
+ if (W <= 0) then //No Width set Draw as one Long String
+ begin
+ if not SelectBool then
+ Text2 := Text
+ else
+ Text2 := Text + '|';
+
+ case Align of
+ 0: X2 := X;
+ 1: X2 := X - glTextWidth(pchar(Text2))/2;
+ 2: X2 := X - glTextWidth(pchar(Text2));
+ end;
+
+ SetFontPos(X2, Y);
+ glPrint(PChar(Text2));
+ SetFontStyle(0); // reset to default
+ end
else
- Text2 := Text + '|';
+ begin //Draw Text as Many Strings
+ Y2 := Y;
+ for I := 0 to high(TextTiles) do
+ begin
+ if (not SelectBool) OR (I <> high(TextTiles)) then
+ Text2 := TextTiles[I]
+ else
+ Text2 := TextTiles[I] + '|';
- case Align of
- 0: X2 := X;
- 1: X2 := X - glTextWidth(pchar(Text2))/2;
- 2: X2 := X - glTextWidth(pchar(Text2));
- end;
+ case Align of
+ 0: X2 := X;
+ 1: X2 := X - glTextWidth(pchar(Text2))/2;
+ 2: X2 := X - glTextWidth(pchar(Text2));
+ end;
- SetFontPos(X2, Y);
- glPrint(PChar(Text2));
- SetFontStyle(0); // reset to default
+ SetFontPos(X2, Y2);
+ glPrint(PChar(Text2));
+
+ Y2 := Y2 + Size * 1.7;
+ end;
+ SetFontStyle(0); // reset to default
+
+ end;
end;
end;
@@ -72,14 +176,15 @@ end;
constructor TText.Create(X, Y: real; Tekst: string);
begin
- Create(X, Y, 0, 10, 0, 0, 0, 0, Tekst);
+ Create(X, Y, 0, 0, 10, 0, 0, 0, 0, Tekst);
end;
-constructor TText.Create(ParX, ParY: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string);
+constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string);
begin
inherited Create;
X := ParX;
Y := ParY;
+ W := ParW;
Style := ParStyle;
Size := ParSize;
Text := ParTekst;
diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas
index 65f39e44..a601555a 100644
--- a/Game/Code/Screens/UScreenEditHeader.pas
+++ b/Game/Code/Screens/UScreenEditHeader.pas
@@ -105,7 +105,7 @@ begin
begin
T := Interaction - 2 + TextTitle;
if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin
- Delete(Text[T].Text, Length(Text[T].Text), 1);
+ Text[T].DeleteLastL;
SetRoundButtons;
end;
end;
diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas
index 99f5d40a..82519e87 100644
--- a/Game/Code/Screens/UScreenName.pas
+++ b/Game/Code/Screens/UScreenName.pas
@@ -33,8 +33,7 @@ begin
SDLK_BACKSPACE:
begin
- Delete(Button[Interaction].Text[0].Text,
- Length(Button[Interaction].Text[0].Text), 1);
+ Button[Interaction].Text[0].DeleteLastL;
end;
SDLK_ESCAPE :
diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas
index 723f299f..264f57a9 100644
--- a/Game/Code/Screens/UScreenOpen.pas
+++ b/Game/Code/Screens/UScreenOpen.pas
@@ -43,9 +43,9 @@ begin
case PressedKey of
8: // del
begin
- if Interaction = 0 then
- if Length(Text[TextN].Text) >= 1 then begin
- Delete(Text[TextN].Text, Length(Text[TextN].Text), 1);
+ if Interaction = 0 then
+ begin
+ Text[TextN].DeleteLastL;
FileName := Text[TextN].Text;
end;
end;
diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas
index b954212a..4fc43013 100644
--- a/Game/Code/Screens/UScreenPartyPlayer.pas
+++ b/Game/Code/Screens/UScreenPartyPlayer.pas
@@ -63,8 +63,7 @@ begin
SDLK_BACKSPACE:
begin
- Delete(Button[Interaction].Text[0].Text,
- Length(Button[Interaction].Text[0].Text), 1);
+ Button[Interaction].Text[0].DeleteLastL;
end;
SDLK_ESCAPE :
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index 201b97fa..ee4bedc8 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -369,6 +369,11 @@ begin
//Deactivate Pause
Paused := False;
+ //Kill all Stars not Killed yet
+ //GoldenStarsTwinkle Mod
+ GoldenRec.KillAll;
+ //GoldenStarsTwinkle Mod End
+
{Static[StaticP2R].Visible := V2R;
Static[StaticP2RScoreBG].Visible := V2R;
Text[TextP2R].Visible := V2R;
@@ -1014,11 +1019,6 @@ begin
Music.CaptureStop;
Music.Stop;
- //Kill all Stars not Killed yet
- //GoldenStarsTwinkle Mod
- GoldenRec.KillAll;
- //GoldenStarsTwinkle Mod End
-
if Ini.SavePlayback = 1 then begin
Log.BenchmarkStart(0);
Log.LogVoice(0);
@@ -1032,6 +1032,8 @@ begin
CloseSmpeg;
AktSong.VideoLoaded := false; // to prevent drawing closed video
end;
+
+ SetFontItalic (False);
end;
procedure TScreenSing.UpdateLCD;
diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas
index 2bf0cb5b..0ba61450 100644
--- a/Game/Code/Screens/UScreenSongJumpto.pas
+++ b/Game/Code/Screens/UScreenSongJumpto.pas
@@ -90,8 +90,7 @@ begin
begin
if Interaction = 0 then
begin
- Delete(Button[0].Text[0].Text,
- Length(Button[0].Text[0].Text), 1);
+ Button[0].Text[0].DeleteLastL;
SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType));
end;
end;
@@ -121,12 +120,18 @@ begin
SDLK_RIGHT:
begin
if (Interaction=1) then
+ begin
InteractInc;
+ SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType));
+ end;
end;
SDLK_LEFT:
begin
if (Interaction=1) then
+ begin
InteractDec;
+ SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType));
+ end;
end;
end;
end