aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-26 23:01:19 +0000
committermogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-26 23:01:19 +0000
commit69d651dd5933520713ac0ecb4875f0e6702ba002 (patch)
tree5c0dc67caa574ea27d482aba5ed1de22495d35e4
parent0067683559bcdbc1f1937ad445cd297d23bac69b (diff)
downloadusdx-69d651dd5933520713ac0ecb4875f0e6702ba002.tar.gz
usdx-69d651dd5933520713ac0ecb4875f0e6702ba002.tar.xz
usdx-69d651dd5933520713ac0ecb4875f0e6702ba002.zip
Statics defined in theme don't necessarily need a width or height set, if omitted the the values from the texture itself will be used
SelectSlides may now have arrows and only one item set, default is off - view UScreenOptionsGame.pas as example on how to set this git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1783 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--game/themes/Deluxe/Blue.ini3
-rw-r--r--game/themes/Deluxe/[main]selectbg.pngbin260 -> 2969 bytes
-rw-r--r--game/themes/Deluxe/interface/select_arrow_left.pngbin0 -> 485 bytes
-rw-r--r--game/themes/Deluxe/interface/select_arrow_right.pngbin0 -> 485 bytes
-rw-r--r--src/base/UGraphic.pas8
-rw-r--r--src/base/UTexture.pas4
-rw-r--r--src/base/UThemes.pas7
-rw-r--r--src/menu/UMenu.pas32
-rw-r--r--src/menu/UMenuSelectSlide.pas50
-rw-r--r--src/screens/UScreenOptionsGame.pas19
10 files changed, 106 insertions, 17 deletions
diff --git a/game/themes/Deluxe/Blue.ini b/game/themes/Deluxe/Blue.ini
index 30c68e3e..6cd2cb04 100644
--- a/game/themes/Deluxe/Blue.ini
+++ b/game/themes/Deluxe/Blue.ini
@@ -29,6 +29,9 @@ ButtonF = [main]buttonf.jpg
MainBar = [main]mainBar.png
SelectBG = [main]selectbg.png
+Select_ArrowLeft = interface/select_arrow_left.png
+Select_ArrowRight = interface/select_arrow_right.png
+
#Backgrounds
LoadingBG = [bg-load]blue.jpg
MainBG = [bg-main]blue.jpg
diff --git a/game/themes/Deluxe/[main]selectbg.png b/game/themes/Deluxe/[main]selectbg.png
index 093be9a5..f1b69eca 100644
--- a/game/themes/Deluxe/[main]selectbg.png
+++ b/game/themes/Deluxe/[main]selectbg.png
Binary files differ
diff --git a/game/themes/Deluxe/interface/select_arrow_left.png b/game/themes/Deluxe/interface/select_arrow_left.png
new file mode 100644
index 00000000..e4a32d2d
--- /dev/null
+++ b/game/themes/Deluxe/interface/select_arrow_left.png
Binary files differ
diff --git a/game/themes/Deluxe/interface/select_arrow_right.png b/game/themes/Deluxe/interface/select_arrow_right.png
new file mode 100644
index 00000000..b2a29793
--- /dev/null
+++ b/game/themes/Deluxe/interface/select_arrow_right.png
Binary files differ
diff --git a/src/base/UGraphic.pas b/src/base/UGraphic.pas
index e7b3d695..82cb3c50 100644
--- a/src/base/UGraphic.pas
+++ b/src/base/UGraphic.pas
@@ -198,7 +198,11 @@ var
Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture;
Tex_Score_Ratings : array [0..7] of TTexture;
-
+
+ //Arrows for SelectSlide
+ Tex_SelectS_ArrowL: TTexture;
+ Tex_SelectS_ArrowR: TTexture;
+
const
Skin_BGColorR = 1;
Skin_BGColorG = 1;
@@ -328,6 +332,8 @@ begin
Tex_Ball := Texture.LoadTexture(Skin.GetTextureFileName('Ball'), TEXTURE_TYPE_TRANSPARENT, $FF00FF);
Tex_Lyric_Help_Bar := Texture.LoadTexture(Skin.GetTextureFileName('LyricHelpBar'), TEXTURE_TYPE_TRANSPARENT, $FF00FF);
+ Tex_SelectS_ArrowL := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowLeft'), TEXTURE_TYPE_TRANSPARENT, 0);
+ Tex_SelectS_ArrowR := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowRight'), TEXTURE_TYPE_TRANSPARENT, 0);
//TimeBar mod
Tex_TimeProgress := Texture.LoadTexture(Skin.GetTextureFileName('TimeBar'));
diff --git a/src/base/UTexture.pas b/src/base/UTexture.pas
index 962bd2b0..97f244fe 100644
--- a/src/base/UTexture.pas
+++ b/src/base/UTexture.pas
@@ -336,8 +336,8 @@ begin
X := 0;
Y := 0;
Z := 0;
- W := 0;
- H := 0;
+ W := oldWidth;
+ H := oldHeight;
ScaleW := 1;
ScaleH := 1;
Rot := 0;
diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas
index 4c5434f8..832e17d9 100644
--- a/src/base/UThemes.pas
+++ b/src/base/UThemes.pas
@@ -175,11 +175,12 @@ type
W: integer;
H: integer;
Z: real;
+ SBGW: integer;
TextSize: integer;
- //SBGW Mod
- SBGW: integer;
+ showArrows:boolean;
+ oneItemOnly:boolean;
Text: string;
ColR, ColG, ColB, Int: real;
@@ -1785,7 +1786,7 @@ begin
ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0);
- ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450);
+ ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 400);
LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', ''));
ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1);
diff --git a/src/menu/UMenu.pas b/src/menu/UMenu.pas
index f86746ed..ceb4ac77 100644
--- a/src/menu/UMenu.pas
+++ b/src/menu/UMenu.pas
@@ -652,12 +652,22 @@ begin
begin
Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ, Color)); // new skin
end;
-
+
// configures static
Static[StatNum].Texture.X := X;
Static[StatNum].Texture.Y := Y;
- Static[StatNum].Texture.W := W;
- Static[StatNum].Texture.H := H;
+
+ //Set height and width via sprite size if omitted
+ if(H = 0) then
+ Static[StatNum].Texture.H := Static[StatNum].Texture.H
+ else
+ Static[StatNum].Texture.H := H;
+
+ if(W = 0) then
+ Static[StatNum].Texture.W := Static[StatNum].Texture.W
+ else
+ Static[StatNum].Texture.W := W;
+
Static[StatNum].Texture.Z := Z;
if (Typ <> TEXTURE_TYPE_COLORIZED) then
begin
@@ -1212,6 +1222,9 @@ begin
SelectsS[High(SelectsS)].Texture.Z := ThemeSelectS.Z;
SelectsS[High(SelectsS)].TextureSBG.Z := ThemeSelectS.Z;
+ SelectsS[High(SelectsS)].showArrows := ThemeSelectS.showArrows;
+ SelectsS[High(SelectsS)].oneItemOnly := ThemeSelectS.oneItemOnly;
+
//Generate Lines
SelectsS[High(SelectsS)].GenLines;
@@ -1255,9 +1268,20 @@ begin
else
SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp);
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowL := Tex_SelectS_ArrowL;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.X := X + W + SkipX;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.Y := Y;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.W := Tex_SelectS_ArrowL.W;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.H := Tex_SelectS_ArrowL.H;
+
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowR := Tex_SelectS_ArrowR;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.X := X + W + SkipX + SBGW - Tex_SelectS_ArrowR.W;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.Y := Y;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.W := Tex_SelectS_ArrowR.W;
+ SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.H := Tex_SelectS_ArrowR.H;
+
SelectsS[S].TextureSBG.X := X + W + SkipX;
SelectsS[S].TextureSBG.Y := Y;
- //SelectsS[S].TextureSBG.W := 450;
SelectsS[S].SBGW := SBGW;
SelectsS[S].TextureSBG.H := H;
SelectsS[S].SBGColR := SBGColR;
diff --git a/src/menu/UMenuSelectSlide.pas b/src/menu/UMenuSelectSlide.pas
index a7133492..81870ab8 100644
--- a/src/menu/UMenuSelectSlide.pas
+++ b/src/menu/UMenuSelectSlide.pas
@@ -54,8 +54,8 @@ type
TextureSBG: TTexture; // Background Selections Texture
// TextureS: array of TTexture; // Selections Texture (not used)
-// TextureArrowL: TTexture; // Texture for left arrow (not used yet)
-// TextureArrowR: TTexture; // Texture for right arrow (not used yet)
+ Tex_SelectS_ArrowL: TTexture; // Texture for left arrow
+ Tex_SelectS_ArrowR: TTexture; // Texture for right arrow
SelectOptInt: integer;
PData: ^integer;
@@ -63,6 +63,12 @@ type
//For automatically Setting LineCount
Lines: byte;
+ //Arrows on/off
+ showArrows: Boolean; //default is false
+
+ //whether to show one item or all that fit into the select
+ oneItemOnly:Boolean; //default is false
+
//Visibility
Visible: boolean;
@@ -147,7 +153,7 @@ begin
TextOpt[0] := TText.Create;
//Set Standard Width for Selections Background
- SBGW := 450;
+// SBGW := 400;
Visible := true;
{SetLength(TextOpt, 3);
@@ -250,6 +256,8 @@ begin
begin //First Option Selected
Value := 0;
+ Tex_SelectS_ArrowL.alpha := 0;
+
for SO := low (TextOpt) to high(TextOpt) do
begin
TextOpt[SO].Text := TextOptT[SO];
@@ -261,6 +269,8 @@ begin
begin //Last Option Selected
Value := high(TextOptT);
+ Tex_SelectS_ArrowR.alpha := 0;
+
for SO := high(TextOpt) downto low (TextOpt) do
begin
TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)];
@@ -269,6 +279,9 @@ begin
end
else
begin
+ Tex_SelectS_ArrowL.alpha := 1;
+ Tex_SelectS_ArrowR.alpha := 1;
+
HalfL := Ceil((Lines-1)/2);
HalfR := Lines-1-HalfL;
@@ -322,6 +335,11 @@ begin
DrawTexture(Texture);
DrawTexture(TextureSBG);
+ if(showArrows) then begin
+ DrawTexture(Tex_SelectS_ArrowL);
+ DrawTexture(Tex_SelectS_ArrowR);
+ end;
+
Text.Draw;
for SO := low(TextOpt) to high(TextOpt) do
@@ -329,6 +347,8 @@ begin
end;
end;
+
+
procedure TSelectSlide.GenLines;
var
maxlength: real;
@@ -344,12 +364,22 @@ begin
maxlength := glTextWidth(TextOptT[I]);
end;
- Lines := floor((TextureSBG.W-40) / (maxlength+7));
- if (Lines > Length(TextOptT)) then
- Lines := Length(TextOptT);
- if (Lines <= 0) then
+ if(oneItemOnly = false) then
+ begin
+ //show all items
+ Lines := floor((TextureSBG.W-40) / (maxlength+7));
+ if (Lines > Length(TextOptT)) then
+ Lines := Length(TextOptT);
+
+ if (Lines <= 0) then
+ Lines := 1;
+ end
+ else
+ begin
+ //show one item only
Lines := 1;
+ end;
//Free old Space used by Texts
for I := low(TextOpt) to high(TextOpt) do
@@ -382,6 +412,12 @@ begin
//Better Look with 2 Options
if (Lines=2) AND (Length(TextOptT)= 2) then
TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I;
+
+ if (Lines=1) then
+ begin
+ TextOpt[I].Align := 1; //center text
+ TextOpt[I].X := TextureSBG.X + (TextureSBG.W / 2);
+ end;
end;
end;
diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas
index 3c78363f..3f1cca81 100644
--- a/src/screens/UScreenOptionsGame.pas
+++ b/src/screens/UScreenOptionsGame.pas
@@ -126,13 +126,32 @@ begin
old_Sorting := Ini.Sorting;
old_Tabs := Ini.Tabs;
+ Theme.OptionsGame.SelectPlayers.showArrows := true;
+ Theme.OptionsGame.SelectPlayers.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers);
+
+ Theme.OptionsGame.SelectDifficulty.showArrows := true;
+ Theme.OptionsGame.SelectDifficulty.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty);
+
+ Theme.OptionsGame.SelectLanguage.showArrows := true;
+ Theme.OptionsGame.SelectLanguage.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage);
+
+ Theme.OptionsGame.SelectTabs.showArrows := true;
+ Theme.OptionsGame.SelectTabs.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs);
+
+ Theme.OptionsGame.SelectSorting.showArrows := true;
+ Theme.OptionsGame.SelectSorting.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting);
+
+ Theme.OptionsGame.SelectDebug.showArrows := true;
+ Theme.OptionsGame.SelectDebug.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug);
+
+
AddButton(Theme.OptionsGame.ButtonExit);
if (Length(Button[0].Text)=0) then
AddButtonText(14, 20, Theme.Options.Description[7]);