From bda4fa8e57ca63a1d591433f120b4226d6a5d327 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 29 Apr 2007 17:50:29 +0000 Subject: Added 2 new Buttons to ScreenMain: Multi and Stats Updated Language Fiels to Fit with new Buttons Some CodeClean Up in Menu Class and in Screens Some minor Bug fixes I forgot about Added ability to group Buttons within a Screen New Theme Object: ButtonCollection: Same Attributes as a Button Plus FirstChild: Defining the First Button in the Group. For Example: SingSolo is 1, SingMulti Button is 2, in ScreenMain Added Attribute to Theme Button: Parent: Number of the assigned Group, 0 for no Group Used new Abilitys in MainScreen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@149 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 28 +-- Game/Code/Classes/UThemes.pas | 123 ++++++++-- Game/Code/Menu/UMenu.pas | 348 ++++++++++++++++++++++----- Game/Code/Menu/UMenuButton.pas | 17 +- Game/Code/Menu/UMenuButtonCollection.pas | 59 +++++ Game/Code/Menu/UMenuInteract.pas | 2 +- Game/Code/Menu/UMenuText.pas | 2 + Game/Code/Screens/UScreenCredits.pas | 6 +- Game/Code/Screens/UScreenEdit.pas | 6 +- Game/Code/Screens/UScreenEditConvert.pas | 6 +- Game/Code/Screens/UScreenEditHeader.pas | 6 +- Game/Code/Screens/UScreenEditSub.pas | 6 +- Game/Code/Screens/UScreenLevel.pas | 8 +- Game/Code/Screens/UScreenLoading.pas | 16 +- Game/Code/Screens/UScreenMain.pas | 79 ++++-- Game/Code/Screens/UScreenName.pas | 9 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenOptions.pas | 91 +------ Game/Code/Screens/UScreenOptionsAdvanced.pas | 14 +- Game/Code/Screens/UScreenOptionsGame.pas | 14 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 14 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 14 +- Game/Code/Screens/UScreenOptionsRecord.pas | 14 +- Game/Code/Screens/UScreenOptionsSound.pas | 15 +- Game/Code/Screens/UScreenOptionsThemes.pas | 14 +- Game/Code/Screens/UScreenPartyNewRound.pas | 13 +- Game/Code/Screens/UScreenPartyOptions.pas | 45 +--- Game/Code/Screens/UScreenPartyPlayer.pas | 8 +- Game/Code/Screens/UScreenPartyScore.pas | 8 +- Game/Code/Screens/UScreenPartyWin.pas | 8 +- Game/Code/Screens/UScreenScore.pas | 54 +---- Game/Code/Screens/UScreenSing.pas | 8 +- Game/Code/Screens/UScreenSong.pas | 8 +- Game/Code/Screens/UScreenSongJumpto.pas | 11 +- Game/Code/Screens/UScreenSongMenu.pas | 48 +--- Game/Code/Screens/UScreenStatDetail.pas | 26 +- Game/Code/Screens/UScreenStatMain.pas | 13 +- Game/Code/Screens/UScreenTop5.pas | 8 +- Game/Code/UltraStar.dpr | 26 +- 39 files changed, 668 insertions(+), 533 deletions(-) create mode 100644 Game/Code/Menu/UMenuButtonCollection.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index df7cd411..39eea53d 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -375,7 +375,7 @@ end; procedure LoadScreens; begin - ScreenLoading := TScreenLoading.Create(''); + ScreenLoading := TScreenLoading.Create; ScreenLoading.onShow; Display.ActualScreen := @ScreenLoading; ScreenLoading.Draw; @@ -397,35 +397,35 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song Menu', 3); Log.BenchmarkStart(3); ScreenSing := TScreenSing.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); - ScreenScore := TScreenScore.Create(''); + ScreenScore := TScreenScore.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); ScreenTop5 := TScreenTop5.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); - ScreenOptions := TScreenOptions.Create(''); + ScreenOptions := TScreenOptions.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); - ScreenOptionsGame := TScreenOptionsGame.Create(''); + ScreenOptionsGame := TScreenOptionsGame.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); - ScreenOptionsGraphics := TScreenOptionsGraphics.Create(''); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); - ScreenOptionsSound := TScreenOptionsSound.Create(''); + ScreenOptionsSound := TScreenOptionsSound.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); - ScreenOptionsLyrics := TScreenOptionsLyrics.Create(''); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); - ScreenOptionsThemes := TScreenOptionsThemes.Create(''); + ScreenOptionsThemes := TScreenOptionsThemes.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); ScreenOptionsRecord := TScreenOptionsRecord.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); - ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create(''); + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); - ScreenEditSub := TScreenEditSub.Create(''); + ScreenEditSub := TScreenEditSub.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); - ScreenEdit := TScreenEdit.Create(''); + ScreenEdit := TScreenEdit.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); - ScreenEditConvert := TScreenEditConvert.Create(''); + ScreenEditConvert := TScreenEditConvert.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); // ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); // Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); - ScreenOpen := TScreenOpen.Create(''); + ScreenOpen := TScreenOpen.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); ScreenSingModi := TScreenSingModi.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); @@ -447,7 +447,7 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); ScreenStatDetail := TScreenStatDetail.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); - ScreenCredits := TScreenCredits.Create(''); + ScreenCredits := TScreenCredits.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); end; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 90bab7c1..31081f23 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -142,8 +142,21 @@ type DeSelectReflectionspacing : Real; FadeTex: string; FadeTexPos: integer; + + //Button Collection Mod + Parent: Byte; //Number of the Button Collection this Button is assigned to. IF 0: No Assignement + end; + + //Button Collection Mod + TThemeButtonCollection = record + Style: TThemeButton; + ChildCount: Byte; //No of assigned Childs + FirstChild: Byte; //No of Child on whose Interaction Position the Button should be end; + AThemeButtonCollection = array of TThemeButtonCollection; + PAThemeButtonCollection = ^AThemeButtonCollection; + TThemeSelect = record Tex: string; TexSBG: string; @@ -186,10 +199,14 @@ type SkipX: integer; end; + PThemeBasic = ^TThemeBasic; TThemeBasic = class Background: TThemeBackground; Text: AThemeText; Static: AThemeStatic; + + //Button Collection Mod + ButtonCollection: AThemeButtonCollection; end; TThemeLoading = class(TThemeBasic) @@ -199,15 +216,16 @@ type TThemeMain = class(TThemeBasic) ButtonSolo: TThemeButton; -// ButtonMulti: TThemeButton; + ButtonMulti: TThemeButton; + ButtonStat: TThemeButton; ButtonEditor: TThemeButton; ButtonOptions: TThemeButton; ButtonExit: TThemeButton; TextDescription: TThemeText; TextDescriptionLong: TThemeText; - Description: array[0..4] of string; - DescriptionLong: array[0..4] of string; + Description: array[0..5] of string; + DescriptionLong: array[0..5] of string; end; TThemeName = class(TThemeBasic) @@ -604,12 +622,16 @@ type end; TTheme = class + private {$IFDEF THEMESAVE} ThemeIni: TIniFile; {$ELSE} ThemeIni: TMemIniFile; {$ENDIF} + LastThemeBasic: TThemeBasic; + public + Loading: TThemeLoading; Main: TThemeMain; Name: TThemeName; @@ -656,7 +678,9 @@ type procedure ThemeLoadTexts(var ThemeText: AThemeText; Name: string); procedure ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); procedure ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); - procedure ThemeLoadButton(var ThemeButton: TThemeButton; Name: string); + procedure ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection = nil); + procedure ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); + procedure ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); procedure ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); procedure ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); @@ -692,7 +716,7 @@ uses {{$IFDEF TRANSLATE} ULanguage, {{$ENDIF} -USkins, UIni; +USkins, UIni, Dialogs; constructor TTheme.Create(FileName: string); begin @@ -830,24 +854,30 @@ begin ThemeLoadText(Main.TextDescription, 'MainTextDescription'); ThemeLoadText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); ThemeLoadButton(Main.ButtonSolo, 'MainButtonSolo'); + ThemeLoadButton(Main.ButtonMulti, 'MainButtonMulti'); + ThemeLoadButton(Main.ButtonStat, 'MainButtonStats'); ThemeLoadButton(Main.ButtonEditor, 'MainButtonEditor'); ThemeLoadButton(Main.ButtonOptions, 'MainButtonOptions'); ThemeLoadButton(Main.ButtonExit, 'MainButtonExit'); - //Score Text Translation Start + //Main Desc Text Translation Start {{$IFDEF TRANSLATE} Main.Description[0] := Language.Translate('SING_SING'); Main.DescriptionLong[0] := Language.Translate('SING_SING_DESC'); - Main.Description[1] := Language.Translate('SING_EDITOR'); - Main.DescriptionLong[1] := Language.Translate('SING_EDITOR_DESC'); - Main.Description[2] := Language.Translate('SING_GAME_OPTIONS'); - Main.DescriptionLong[2] := Language.Translate('SING_GAME_OPTIONS_DESC'); - Main.Description[3] := Language.Translate('SING_EXIT'); - Main.DescriptionLong[3] := Language.Translate('SING_EXIT_DESC'); + Main.Description[1] := Language.Translate('SING_MULTI'); + Main.DescriptionLong[1] := Language.Translate('SING_MULTI_DESC'); + Main.Description[2] := Language.Translate('SING_STATS'); + Main.DescriptionLong[2] := Language.Translate('SING_STATS_DESC'); + Main.Description[3] := Language.Translate('SING_EDITOR'); + Main.DescriptionLong[3] := Language.Translate('SING_EDITOR_DESC'); + Main.Description[4] := Language.Translate('SING_GAME_OPTIONS'); + Main.DescriptionLong[4] := Language.Translate('SING_GAME_OPTIONS_DESC'); + Main.Description[5] := Language.Translate('SING_EXIT'); + Main.DescriptionLong[5] := Language.Translate('SING_EXIT_DESC'); {{$ENDIF} - //Score Text Translation End + //Main Desc Text Translation End Main.TextDescription.Text := Main.Description[0]; Main.TextDescriptionLong.Text := Main.DescriptionLong[0]; @@ -931,14 +961,14 @@ begin // Sing ThemeLoadBasic(Sing, 'Sing'); - //moveable singbar mod - ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); - ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); - ThemeLoadStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); - ThemeLoadStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); - ThemeLoadStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); - ThemeLoadStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); - //eoa moveable singbar + //moveable singbar mod + ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); + ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); + ThemeLoadStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); + ThemeLoadStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); + ThemeLoadStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); + ThemeLoadStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); + //eoa moveable singbar ThemeLoadStatic(Sing.StaticP1, 'SingP1Static'); ThemeLoadText(Sing.TextP1, 'SingP1Text'); @@ -1315,6 +1345,9 @@ begin ThemeLoadBackground(Theme.Background, Name); ThemeLoadTexts(Theme.Text, Name + 'Text'); ThemeLoadStatics(Theme.Static, Name + 'Static'); + ThemeLoadButtonCollections(Theme.ButtonCollection, Name + 'ButtonCollection'); + + LastThemeBasic := Theme; end; procedure TTheme.ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); @@ -1417,11 +1450,40 @@ begin end; end; -procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string); +//Button Collection Mod +procedure TTheme.ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); +var T: Integer; +begin + //Load Collection Style + ThemeLoadButton(Collection.Style, Name); + + //Load Other Attributes + T := ThemeIni.ReadInteger (Name, 'FirstChild', 0); + if (T > 0) And (T < 256) then + Collection.FirstChild := T + else + Collection.FirstChild := 0; +end; + +procedure TTheme.ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); +var + I: integer; +begin + I := 1; + while ThemeIni.SectionExists(Name + IntToStr(I)) do begin + SetLength(Collections, I); + ThemeLoadButtonCollection(Collections[I-1], Name + IntToStr(I)); + Inc(I); + end; +end; +//End Button Collection Mod + +procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection); var C: integer; TLen: integer; T: integer; + Collections2: PAThemeButtonCollection; begin DecimalSeparator := '.'; ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); @@ -1477,6 +1539,23 @@ begin if (ThemeButton.FadeTexPos > 4) Or (ThemeButton.FadeTexPos < 0) then ThemeButton.FadeTexPos := 0; + //Button Collection Mod + T := ThemeIni.ReadInteger(Name, 'Parent', 0); + + //Set Collections to Last Basic Collections if no valid Value + if (Collections = nil) then + Collections2 := @LastThemeBasic.ButtonCollection + else + Collections2 := Collections; + //Test for valid Value + if (Collections2 <> nil) AND (T > 0) AND (T <= Length(Collections2^)) then + begin + Inc(Collections2^[T-1].ChildCount); + ThemeButton.Parent := T; + end + else + ThemeButton.Parent := 0; + //Read ButtonTexts TLen := ThemeIni.ReadInteger(Name, 'Texts', 0); SetLength(ThemeButton.Text, TLen); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 28ba17e7..fc217dba 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -3,7 +3,7 @@ unit UMenu; interface uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, - UMenuInteract, UThemes; + UMenuInteract, UThemes, UMenuButtonCollection; type { Int16 = SmallInt;} @@ -18,12 +18,13 @@ type Button: array of TButton; Selects: array of TSelect; SelectsS: array of TSelectSlide; + ButtonCollection: Array of TButtonCollection; BackImg: TTexture; BackW: integer; BackH: integer; public Text: array of TText; - Static: array of TStatic; + Static: array of TStatic; mX: integer; // mouse X mY: integer; // mouse Y @@ -33,14 +34,20 @@ type destructor Destroy; override; constructor Create; overload; virtual; - constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background - constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps + //constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background + //constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps // interaction procedure AddInteraction(Typ, Num: integer); procedure SetInteraction(Num: integer); property Interaction: integer read SelInteraction write SetInteraction; + //Procedure Load BG, Texts, Statics and Button Collections from ThemeBasic + procedure LoadFromTheme(const ThemeBasic: TThemeBasic); + + procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); + procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); + // background procedure AddBackground(Name: string); @@ -70,6 +77,7 @@ type procedure AddButtonText(AddX, AddY: real; AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; + procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; // select function AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; overload; @@ -113,7 +121,8 @@ type procedure SetAnimationProgress(Progress: real); virtual; - + function IsSelectable(Int: Cardinal): Boolean; + procedure InteractNext; virtual; procedure InteractCustom(CustomSwitch: integer); virtual; procedure InteractPrev; virtual; @@ -132,13 +141,14 @@ const iSelect = 1; iText = 2; iSelectS = 3; + iBCollectionChild = 5; // fBlack = 0; // fade type // fWhite = 1; implementation -uses UMain, UDrawTexture, UGraphic, UDisplay, UCovers, USkins; +uses UMain, UDrawTexture, UGraphic, UDisplay, UCovers, USkins, Dialogs; destructor TMenu.Destroy; begin @@ -157,7 +167,7 @@ begin //Set ButtonPos to Autoset Length ButtonPos := -1; end; - +{ constructor TMenu.Create(Back: String); begin inherited Create; @@ -183,7 +193,7 @@ begin BackImg.H := BackImg.H / H; BackW := W; BackH := H; -end; +end; } procedure TMenu.AddInteraction(Typ, Num: integer); var @@ -204,25 +214,67 @@ begin // set inactive OldNum := Interactions[Interaction].Num; OldTyp := Interactions[Interaction].Typ; + + NewNum := Interactions[Num].Num; + NewTyp := Interactions[Num].Typ; + case OldTyp of iButton: Button[OldNum].Selected := False; iSelect: Selects[OldNum].Selected := False; iText: Text[OldNum].Selected := False; iSelectS: SelectsS[OldNum].Selected := False; + //Button Collection Mod + iBCollectionChild: + begin + Button[OldNum].Selected := False; + + //Deselect Collection if Next Button is Not from Collection + if (NewTyp <> iButton) Or (Button[NewNum].Parent <> Button[OldNum].Parent) then + ButtonCollection[Button[OldNum].Parent-1].Selected := False; + end; end; // set active SelInteraction := Num; - NewNum := Interactions[Interaction].Num; - NewTyp := Interactions[Interaction].Typ; case NewTyp of iButton: Button[NewNum].Selected := True; iSelect: Selects[NewNum].Selected := True; iText: Text[NewNum].Selected := True; iSelectS: SelectsS[NewNum].Selected := True; + + //Button Collection Mod + iBCollectionChild: + begin + Button[NewNum].Selected := True; + ButtonCollection[Button[NewNum].Parent-1].Selected := True; + end; end; end; +//---------------------- +//LoadFromTheme - Load BG, Texts, Statics and +//Button Collections from ThemeBasic +//---------------------- +procedure TMenu.LoadFromTheme(const ThemeBasic: TThemeBasic); +var + I: Integer; +begin + //Add Button Collections (Set Button CollectionsLength) + //Button Collections are Created when the first ChildButton is Created + PrepareButtonCollections(ThemeBasic.ButtonCollection); + + + //Add Background + AddBackground(ThemeBasic.Background.Tex); + + //Add Statics and Texts + for I := 0 to High(ThemeBasic.Static) do + AddStatic(ThemeBasic.Static[I]); + + for I := 0 to High(ThemeBasic.Text) do + AddText(ThemeBasic.Text[I]); +end; + procedure TMenu.AddBackground(Name: string); begin if Name <> '' then begin @@ -235,6 +287,84 @@ begin end; end; +//---------------------- +//PrepareButtonCollections: +//Add Button Collections (Set Button CollectionsLength) +//---------------------- +procedure TMenu.PrepareButtonCollections(const Collections: AThemeButtonCollection); +var + I: Integer; +begin + SetLength(ButtonCollection, Length(Collections)); + For I := 0 to High(ButtonCollection) do + AddButtonCollection(Collections[I], I); +end; + +//---------------------- +//AddButtonCollection: +//Create a Button Collection; +//---------------------- +procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); +var + BT, BTLen: Integer; +begin + if (Num > High(ButtonCollection)) then + exit; + + ButtonCollection[Num] := TButtonCollection.Create(Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), ThemeCollection.Style.Typ, true)); // use cache texture + + //Set Parent menu + ButtonCollection[Num].ScreenButton := @Self.Button; + + //Set Attributes + ButtonCollection[Num].FirstChild := ThemeCollection.FirstChild; + ButtonCollection[Num].CountChilds := ThemeCollection.ChildCount; + ButtonCollection[Num].Parent := Num + 1; + + //Set Style + ButtonCollection[Num].X := ThemeCollection.Style.X; + ButtonCollection[Num].Y := ThemeCollection.Style.Y; + ButtonCollection[Num].W := ThemeCollection.Style.W; + ButtonCollection[Num].H := ThemeCollection.Style.H; + ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; + ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; + ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; + ButtonCollection[Num].SelectInt := ThemeCollection.Style.Int; + ButtonCollection[Num].DeselectColR := ThemeCollection.Style.DColR; + ButtonCollection[Num].DeselectColG := ThemeCollection.Style.DColG; + ButtonCollection[Num].DeselectColB := ThemeCollection.Style.DColB; + ButtonCollection[Num].DeselectInt := ThemeCollection.Style.DInt; + ButtonCollection[Num].Texture.TexX1 := 0; + ButtonCollection[Num].Texture.TexY1 := 0; + ButtonCollection[Num].Texture.TexX2 := 1; + ButtonCollection[Num].Texture.TexY2 := 1; + ButtonCollection[Num].SetSelect(false); + + ButtonCollection[Num].Reflection := ThemeCollection.Style.Reflection; + ButtonCollection[Num].Reflectionspacing := ThemeCollection.Style.ReflectionSpacing; + ButtonCollection[Num].DeSelectReflectionspacing := ThemeCollection.Style.DeSelectReflectionSpacing; + + ButtonCollection[Num].Z := ThemeCollection.Style.Z; + + //Some Things from ButtonFading + ButtonCollection[Num].SelectH := ThemeCollection.Style.SelectH; + ButtonCollection[Num].SelectW := ThemeCollection.Style.SelectW; + + ButtonCollection[Num].Fade := ThemeCollection.Style.Fade; + ButtonCollection[Num].FadeText := ThemeCollection.Style.FadeText; + ButtonCollection[Num].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ, true); + ButtonCollection[Num].FadeTexPos := ThemeCollection.Style.FadeTexPos; + + + BTLen := Length(ThemeCollection.Style.Text); + for BT := 0 to BTLen-1 do begin + AddButtonText(ButtonCollection[Num], ThemeCollection.Style.Text[BT].X, ThemeCollection.Style.Text[BT].Y, + ThemeCollection.Style.Text[BT].ColR, ThemeCollection.Style.Text[BT].ColG, ThemeCollection.Style.Text[BT].ColB, + ThemeCollection.Style.Text[BT].Font, ThemeCollection.Style.Text[BT].Size, ThemeCollection.Style.Text[BT].Align, + ThemeCollection.Style.Text[BT].Text); + end; +end; + function TMenu.AddStatic(ThemeStatic: TThemeStatic): integer; begin Result := AddStatic(ThemeStatic.X, ThemeStatic.Y, ThemeStatic.W, ThemeStatic.H, ThemeStatic.Z, @@ -415,6 +545,20 @@ begin ThemeButton.Text[BT].Font, ThemeButton.Text[BT].Size, ThemeButton.Text[BT].Align, ThemeButton.Text[BT].Text); end; + + //BAutton Collection Mod + if (ThemeButton.Parent <> 0) then + begin + //If Collection Exists then Change Interaction to Child Button + if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then + begin + Interactions[High(Interactions)].Typ := iBCollectionChild; + Button[Result].Visible := False; + Button[Result].Parent := ThemeButton.Parent; + if (ButtonCollection[ThemeButton.Parent-1].Fade) then + Button[Result].Texture.Alpha := 0; + end; + end; end; function TMenu.AddButton(X, Y, W, H: real; Name: String): integer; @@ -473,6 +617,10 @@ begin Button[Result].Reflectionspacing := ReflectionSpacing; Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing; + //Button Collection Mod + Button[Result].Parent := 0; + + // adds interaction AddInteraction(iButton, Result); Interaction := 0; @@ -527,6 +675,10 @@ begin for J := 0 to Length(Text) - 1 do Text[J].Draw; + // Draw all ButtonCollections + For J := 0 to High(ButtonCollection) do + ButtonCollection[J].Draw; + // Second, we draw all of our buttons for J := 0 to Length(Button) - 1 do Button[J].Draw; @@ -595,60 +747,68 @@ begin SetLength(WidgetsRect, MinNumber); end;} +function TMenu.IsSelectable(Int: Cardinal): Boolean; +begin + Result := True; + Case Interactions[Int].Typ of + //Button + iButton: Result := Button[Interactions[Int].Num].Visible and Button[Interactions[Int].Num].Selectable; + //Select + iSelect: Result := True; + //Select Slide + iSelectS: Result := SelectsS[Interactions[Int].Num].Visible; + + //ButtonCollection Child + iBCollectionChild: + Result := (ButtonCollection[Button[Interactions[Int].Num].Parent - 1].FirstChild - 1 = Int) AND ((Interactions[Interaction].Typ <> iBCollectionChild) OR (Button[Interactions[Interaction].Num].Parent <> Button[Interactions[Int].Num].Parent)); + end; +end; + procedure TMenu.InteractNext; var - Num: integer; - Typ: integer; - Again: boolean; + Int: Integer; begin - Again := true; + Int := Interaction; // change interaction as long as it's needed - while (Again = true) do begin - Num := (Interaction + 1) Mod Length(Interactions); - Interaction := Num; - Again := false; // reset, default to accept changing interaction - - - // checking newly interacted element - Num := Interactions[Interaction].Num; - Typ := Interactions[Interaction].Typ; - case Typ of - iButton: - begin - if Button[Num].Selectable = false then Again := True; - end; - end; // case - end; // while + repeat + Int := (Int + 1) Mod Length(Interactions); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then + begin + Int := (Int + 1) Mod Length(Interactions); + Break; + end; + Until IsSelectable(Int); + + //Set Interaction + Interaction := Int; end; procedure TMenu.InteractPrev; var - Num: integer; - Typ: integer; - Again: boolean; + Int: Integer; begin - Again := true; + Int := Interaction; // change interaction as long as it's needed - while (Again = true) do begin - Num := SelInteraction - 1; - if Num = -1 then Num := High(Interactions); - Interaction := Num; - Again := false; // reset, default to accept changing interaction - - // checking newly interacted element - Num := Interactions[Interaction].Num; - Typ := Interactions[Interaction].Typ; - case Typ of - iButton: - begin - if Button[Num].Selectable = false then Again := True; - end; - end; // case - end; // while - + repeat + Int := Int - 1; + if Int = -1 then Int := High(Interactions); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then + begin + Int := SelInteraction - 1; + if Int = -1 then Int := High(Interactions); + Break; + end; + Until IsSelectable(Int); + + //Set Interaction + Interaction := Int end; @@ -658,7 +818,9 @@ var Typ: integer; Again: boolean; begin - if num<0 then begin + //Code Commented atm, because it needs to be Rewritten + //it doesn't work with Button Collections + {then begin CustomSwitch:= CustomSwitch*(-1); Again := true; // change interaction as long as it's needed @@ -698,7 +860,7 @@ begin end; end; // case end; // while - end + end } end; @@ -746,6 +908,24 @@ begin end; end; +procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); +var + Il: integer; +begin + with CustomButton do begin + Il := Length(Text); + SetLength(Text, Il+1); + Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); + Text[Il].ColR := ColR; + Text[Il].ColG := ColG; + Text[Il].ColB := ColB; + Text[Il].Int := 1;//0.5; + Text[Il].Style := Font; + Text[Il].Size := Size; + Text[Il].Align := Align; + end; +end; + function TMenu.AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; var SO: integer; @@ -1114,6 +1294,28 @@ begin if Value <= High(SelectsS[Num].TextOptT) then SelectsS[Num].SelectedOption := Value; end; + //Button Collection Mod + iBCollectionChild: + begin + + //Select Next Button in Collection + For Num := 1 to High(Button) do + begin + Value := (Interaction + Num) Mod Length(Button); + if Value = 0 then + begin + InteractNext; + Break; + end; + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + //interact Next if there is Nothing to Change + else InteractNext; end; end; @@ -1141,7 +1343,45 @@ begin if Value >= 0 then SelectsS[Num].SelectedOption := Value; end; - end + //Button Collection Mod + iBCollectionChild: + begin + //Select Prev Button in Collection + For Num := High(Button) downto 1 do + begin + Value := (Interaction + Num) Mod Length(Button); + if Value = High(Button) then + begin + InteractPrev; + Break; + end; + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + //interact Prev if there is Nothing to Change + else + begin + InteractPrev; + //If ButtonCollection with more than 1 Entry then Select Last Entry + if (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then + begin + //Select Last Child + For Num := High(Button) downto 1 do + begin + Value := (Interaction + Num) Mod Length(Button); + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + end; + end; end; procedure TMenu.AddBox(X, Y, W, H: real); diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index 34d45083..fde808e2 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -4,8 +4,9 @@ interface uses TextGL, UTexture, OpenGL12, UMenuText; type + CButton = class of TButton; TButton = class - private + protected SelectBool: Boolean; FadeProgress: Real; @@ -14,9 +15,10 @@ type DeSelectW: Real; DeSelectH: Real; PosX: Real; - PosY: Real; - + PosY: Real; + constructor Create(); overload; + public Text: Array of TText; Texture: TTexture; // Button Screen position and size @@ -40,6 +42,9 @@ type Selectable: boolean; + //No of the Parent Collection, 0 if in no Collection + Parent: Byte; + SelectColR: real; SelectColG: real; SelectColB: real; @@ -60,7 +65,7 @@ type procedure SetW(Value: real); procedure SetH(Value: real); - procedure SetSelect(Value: Boolean); + procedure SetSelect(Value: Boolean); virtual; property X: real read PosX write SetX; property Y: real read PosY write SetY; property Z: real read Texture.z write Texture.z; @@ -68,7 +73,7 @@ type property H: real read DeSelectH write SetH; property Selected: Boolean read SelectBool write SetSelect; - procedure Draw; + procedure Draw; virtual; constructor Create(Textura: TTexture); overload; destructor Destroy; override; @@ -250,6 +255,8 @@ begin PosX := 0; PosY := 0; + + Parent := 0; end; // ***** Public methods ****** // diff --git a/Game/Code/Menu/UMenuButtonCollection.pas b/Game/Code/Menu/UMenuButtonCollection.pas new file mode 100644 index 00000000..66ac70fc --- /dev/null +++ b/Game/Code/Menu/UMenuButtonCollection.pas @@ -0,0 +1,59 @@ +unit UMenuButtonCollection; + +interface +uses UMenuButton; + +type + //---------------- + //TButtonCollection + //No Extra Attributes or Functions ATM + //---------------- + AButton = Array of TButton; + PAButton = ^AButton; + TButtonCollection = class(TButton) + //num of the First Button, that can be Selected + FirstChild: Byte; + CountChilds: Byte; + + ScreenButton: PAButton; + + procedure SetSelect(Value : Boolean); override; + procedure Draw; override; + end; + +implementation + +procedure TButtonCollection.SetSelect(Value : Boolean); +var I: Integer; +begin + inherited; + + //Set Visible for Every Button that is a Child of this ButtonCollection + if (Not Fade) then + For I := 0 to High(ScreenButton^) do + if (ScreenButton^[I].Parent = Parent) then + ScreenButton^[I].Visible := Value; +end; + +procedure TButtonCollection.Draw; +var I: Integer; +begin + inherited; + //If fading is activated, Fade Child Buttons + if (Fade) then + begin + For I := 0 to High(ScreenButton^) do + if (ScreenButton^[I].Parent = Parent) then + begin + if (FadeProgress < 0.5) then + ScreenButton^[I].Visible := SelectBool + else + ScreenButton^[I].Texture.Alpha := (FadeProgress-0.666)*3; + //ScreenButton^[I].Text[0]. + end; + end; +end; + + + +end. diff --git a/Game/Code/Menu/UMenuInteract.pas b/Game/Code/Menu/UMenuInteract.pas index 3f2960b8..43249e3e 100644 --- a/Game/Code/Menu/UMenuInteract.pas +++ b/Game/Code/Menu/UMenuInteract.pas @@ -4,7 +4,7 @@ interface type TInteract = record // for moving thru menu - Typ: integer; // 0 - button, 1 - select + Typ: integer; // 0 - button, 1 - select, 2 - Text, 3 - Select SLide, 5 - ButtonCollection Child Num: integer; // number of this item in proper list like buttons, selects end; diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index abf3784c..4cb48cad 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -162,6 +162,7 @@ begin //Look for Break before the Break if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) AND (NextPos-LastPos > 1) then begin + isBreak := False; //Not the First word after Break, so we don't have to break within a word if (FirstWord > 1) then begin @@ -175,6 +176,7 @@ begin end; end; + isBreak := True; //Add Break from Text AddBreak(LastBreak, NextPos); end diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 2e5f4abc..0411c7b6 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -14,7 +14,7 @@ type Credits_Alpha: Cardinal; Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; @@ -97,11 +97,11 @@ begin end; //fi end; -constructor TScreenCredits.Create(Back: String); +constructor TScreenCredits.Create; var I: integer; begin - inherited Create(Back); + inherited Create; AddBackground(Theme.Loading.Background.Tex); diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index aa3301a7..00df0418 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -11,7 +11,7 @@ type FadeOut: boolean; Path: string; FileName: string;} - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; { function Draw: boolean; override; @@ -63,9 +63,9 @@ begin end; end; -constructor TScreenEdit.Create(Back: String); +constructor TScreenEdit.Create; begin - inherited Create(Back); + inherited Create; AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); // Button[High(Button)].Text[0].Size := 11; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 68742535..62a50b3e 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -58,7 +58,7 @@ type procedure Extract; procedure MidiFile1MidiEvent(event: PMidiEvent); function SelectedNumber: integer; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; @@ -299,11 +299,11 @@ begin MidiOut.PutShort(event.event, event.data1, event.data2); end; -constructor TScreenEditConvert.Create(Back: String); +constructor TScreenEditConvert.Create; var P: integer; begin - inherited Create(Back); + inherited Create; AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(15, 5, 0, 0, 0, 'Open'); // Button[High(Button)].Text[0].Size := 11; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index a601555a..dbdd186c 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -35,7 +35,7 @@ type Sel: array[0..11] of boolean; procedure SetRoundButtons; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; { function Draw: boolean; override; @@ -124,9 +124,9 @@ begin end; end; -constructor TScreenEditHeader.Create(Back: String); +constructor TScreenEditHeader.Create; begin - inherited Create(Back); + inherited Create; AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(15, 5, 'Open'); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 6094edd1..a665ba1c 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -62,7 +62,7 @@ type FadeOut: boolean; Path: string; FileName: string; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -1035,9 +1035,9 @@ begin end; -constructor TScreenEditSub.Create(Back: String); +constructor TScreenEditSub.Create; begin - inherited Create(Back); + inherited Create; SetLength(Player, 1); // linijka diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 28aa40ea..80d42773 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -68,18 +68,12 @@ var begin inherited Create; - AddBackground(Theme.Level.Background.Tex); + LoadFromTheme(Theme.Level); AddButton(Theme.Level.ButtonEasy); AddButton(Theme.Level.ButtonMedium); AddButton(Theme.Level.ButtonHard); - for I := 0 to High(Theme.Level.Static) do - AddStatic(Theme.Level.Static[I]); - - for I := 0 to High(Theme.Level.Text) do - AddText(Theme.Level.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 5cc938bb..438b606e 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -9,7 +9,7 @@ type TScreenLoading = class(TMenu) public Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function GetBGTexNum: GLUInt; procedure onShow; override; @@ -24,19 +24,11 @@ begin Result := true; end; -constructor TScreenLoading.Create(Back: String); -var - I: integer; +constructor TScreenLoading.Create; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.Loading.Background.Tex); - - for I := 0 to High(Theme.Loading.Static) do - AddStatic(Theme.Loading.Static[I]); - - for I := 0 to High(Theme.Loading.Text) do - AddText(Theme.Loading.Text[I]); + LoadFromTheme(Theme.Loading); Fadeout := false; end; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 4c822640..49bd98ee 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -16,6 +16,8 @@ type procedure onShow; override; procedure InteractNext; override; procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; procedure UpdateLCD; procedure SetAnimationProgress(Progress: real); override; //function Draw: boolean; override; @@ -84,6 +86,7 @@ begin SDLK_RETURN: begin + //Solo if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin Music.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; @@ -92,23 +95,44 @@ begin ScreenName.Goto_SingScreen := False; FadeTo(@ScreenName); end; + + //Multi if Interaction = 1 then begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + //Stats + if Interaction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then begin Music.PlayStart; FadeTo(@ScreenEdit); end; - if Interaction = 2 then begin + + //Options + if Interaction = 4 then begin Music.PlayStart; FadeTo(@ScreenOptions); end; - if Interaction = 3 then begin + + //Exit + if Interaction = 5 then begin Result := false; end; end; // Up and Down could be done at the same time, // but I don't want to declare variables inside // functions like this one, called so many times - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; @@ -127,27 +151,28 @@ var begin inherited Create; -// AddButton(400-200, 320, 400, 60, Skin.GameStart); -// AddButton(400-200, 390, 400, 60, Skin.Editor); -// AddButton(400-200, 460, 400, 60, Skin.Options); -// AddButton(400-200, 530, 400, 60, Skin.Exit); + //---------------- + //Attention ^^: + //New Creation Order needed because of LoadFromTheme + //and Button Collections. + //At First Custom Texts and Statics + //Then LoadFromTheme + //after LoadFromTheme the Buttons and Selects + //---------------- + + + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - AddBackground(Theme.Main.Background.Tex); + LoadFromTheme(Theme.Main); AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonMulti); + AddButton(Theme.Main.ButtonStat); AddButton(Theme.Main.ButtonEditor); AddButton(Theme.Main.ButtonOptions); AddButton(Theme.Main.ButtonExit); - for I := 0 to High(Theme.Main.Static) do - AddStatic(Theme.Main.Static[I]); - - for I := 0 to High(Theme.Main.Text) do - AddText(Theme.Main.Text[I]); - - TextDescription := AddText(Theme.Main.TextDescription); - TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - Interaction := 0; end; @@ -175,6 +200,24 @@ begin Light.LightOne(0, 200); end; +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + procedure TScreenMain.UpdateLCD; begin case Interaction of diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index e8bc2dd8..9819b994 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -76,17 +76,12 @@ var begin inherited Create; - AddBackground(Theme.Name.Background.Tex); + LoadFromTheme(Theme.Name); + for I := 1 to 6 do AddButton(Theme.Name.ButtonPlayer[I]); - for I := 0 to High(Theme.Name.Static) do - AddStatic(Theme.Name.Static[I]); - - for I := 0 to High(Theme.Name.Text) do - AddText(Theme.Name.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 264f57a9..4f0c32c5 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -16,7 +16,7 @@ type Path: string; BackScreen: pointer; procedure AddBox(X, Y, W, H: real); - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; // function Draw: boolean; override; @@ -90,9 +90,9 @@ begin AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); end; -constructor TScreenOpen.Create(Back: String); +constructor TScreenOpen.Create; begin - inherited Create(Back); + inherited Create; // linijka { AddStatic(20, 10, 80, 30, 0, 0, 0, 'Bar', 'JPG', 'Font Black'); diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 0fffedac..f0229d8c 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -9,7 +9,7 @@ type TScreenOptions = class(TMenu) public TextDescription: integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractNext; override; @@ -80,88 +80,23 @@ begin FadeTo(@ScreenMain); end; end; - SDLK_LEFT: - begin - {case SelInteraction of - 0: InteractCustom(+2); - 1: InteractCustom(-1); - 2: InteractCustom(-1); - 3: InteractCustom(+2); - 4: InteractCustom(-1); - 5: InteractCustom(-1); - end;} - InteractPrev; - end; - SDLK_RIGHT: - begin - {case SelInteraction of - 0: InteractCustom(+1); - 1: InteractCustom(+1); - 2: InteractCustom(-2); - 3: InteractCustom(+1); - 4: InteractCustom(+1); - 5: InteractCustom(-2); - end;} - InteractNext; - end; - SDLK_UP: - begin - InteractPrev; - {case SelInteraction of - 0: InteractCustom(+3); - 1: InteractCustom(+3); - 2: InteractCustom(+3); - 3: InteractCustom(-3); - 4: InteractCustom(-3); - 5: InteractCustom(-3); - end; } - end; - SDLK_DOWN: - begin - {case SelInteraction of - 0: InteractCustom(+3); - 1: InteractCustom(+3); - 2: InteractCustom(+3); - 3: InteractCustom(-3); - 4: InteractCustom(-3); - 5: InteractCustom(-3); - end; } - InteractNext; - end; + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; end; end; -constructor TScreenOptions.Create(Back: String); +constructor TScreenOptions.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - // Game -{ AddButton(225, 100 + 0*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Game');} - - // Graphics -{ AddButton(225, 100 + 1*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Graphics'); - - // Sound - AddButton(225, 100 + 2*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Sound'); - - // Lyrics - AddButton(225, 100 + 3*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Lyrics'); - - // Themes - AddButton(225, 100 + 4*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Themes'); - - // Exit - AddButton(225, 100 + 6*60, 350, 50, Skin.Exit);} + TextDescription := AddText(Theme.Options.TextDescription); - AddBackground(Theme.Options.Background.Tex); + LoadFromTheme(Theme.Options); AddButton(Theme.Options.ButtonGame); if (Length(Button[0].Text)=0) then @@ -195,14 +130,6 @@ begin if (Length(Button[7].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); - for I := 0 to High(Theme.Options.Static) do - AddStatic(Theme.Options.Static[I]); - - for I := 0 to High(Theme.Options.Text) do - AddText(Theme.Options.Text[I]); - - TextDescription := AddText(Theme.Options.TextDescription); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index ed3bc164..256b02db 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsAdvanced = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,19 +59,13 @@ begin end; end; -constructor TScreenOptionsAdvanced.Create(Back: String); +constructor TScreenOptionsAdvanced.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsAdvanced.Background.Tex); - - for I := 0 to High(Theme.OptionsAdvanced.Static) do - AddStatic(Theme.OptionsAdvanced.Static[I]); - - for I := 0 to High(Theme.OptionsAdvanced.Text) do - AddText(Theme.OptionsAdvanced.Text[I]); + LoadFromTheme(Theme.OptionsAdvanced); AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); AddSelect(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 63bbec36..88bb34e3 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -9,7 +9,7 @@ type TScreenOptionsGame = class(TMenu) public old_Tabs, old_Sorting: integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure RefreshSongs; @@ -61,19 +61,13 @@ begin end; end; -constructor TScreenOptionsGame.Create(Back: String); +constructor TScreenOptionsGame.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsGame.Background.Tex); - - for I := 0 to High(Theme.OptionsGame.Static) do - AddStatic(Theme.OptionsGame.Static[I]); - - for I := 0 to High(Theme.OptionsGame.Text) do - AddText(Theme.OptionsGame.Text[I]); + LoadFromTheme(Theme.OptionsGame); //Refresh Songs Patch old_Sorting := Ini.Sorting; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 6152c9c0..b36bb7d3 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsGraphics = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -66,19 +66,13 @@ begin end; end; -constructor TScreenOptionsGraphics.Create(Back: String); +constructor TScreenOptionsGraphics.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsGraphics.Background.Tex); - - for I := 0 to High(Theme.OptionsGraphics.Static) do - AddStatic(Theme.OptionsGraphics.Static[I]); - - for I := 0 to High(Theme.OptionsGraphics.Text) do - AddText(Theme.OptionsGraphics.Text[I]); + LoadFromTheme(Theme.OptionsGraphics); AddSelectSlide(Theme.OptionsGraphics.SelectSlideResolution, Ini.Resolution, IResolution); AddSelect(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 35cb2415..ff03b2ba 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsLyrics = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,19 +59,13 @@ begin end; end; -constructor TScreenOptionsLyrics.Create(Back: String); +constructor TScreenOptionsLyrics.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsLyrics.Background.Tex); - - for I := 0 to High(Theme.OptionsLyrics.Static) do - AddStatic(Theme.OptionsLyrics.Static[I]); - - for I := 0 to High(Theme.OptionsLyrics.Text) do - AddText(Theme.OptionsLyrics.Text[I]); + LoadFromTheme(Theme.OptionsLyrics); AddSelect(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); AddSelect(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 1d09d0b8..af7d2cd6 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -74,20 +74,8 @@ var begin inherited Create; - AddBackground(Theme.OptionsRecord.Background.Tex); - for I := 0 to High(Theme.OptionsRecord.Static) do - AddStatic(Theme.OptionsRecord.Static[I]); + LoadFromTheme(Theme.OptionsRecord); - for I := 0 to High(Theme.OptionsRecord.Text) do - AddText(Theme.OptionsRecord.Text[I]); - -// SetLength(ICard, 0); -// ICard[0] := 'karta'; - -// SetLength(IInput, 0); -// IInput[0] := 'wejscie'; - -// if Length(Recording.SoundCard) > 0 then begin SetLength(ICard, Length(Recording.SoundCard)); for SC := 0 to High(Recording.SoundCard) do ICard[SC] := Recording.SoundCard[SC].Description; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index aea6cdbc..ee53ef02 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsSound = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,25 +59,18 @@ begin end; end; -constructor TScreenOptionsSound.Create(Back: String); +constructor TScreenOptionsSound.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsSound.Background.Tex); - - for I := 0 to High(Theme.OptionsSound.Static) do - AddStatic(Theme.OptionsSound.Static[I]); - - for I := 0 to High(Theme.OptionsSound.Text) do - AddText(Theme.OptionsSound.Text[I]); + LoadFromTheme(Theme.OptionsSound); AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); AddSelect(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); - //AddSelect(Theme.OptionsSound.SelectTwoPlayerMode, Ini.TwoPlayerMode, ITwoPlayerMode); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 151913be..c0bf2e15 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -9,7 +9,7 @@ type TScreenOptionsThemes = class(TMenu) public SkinSelect: Integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractInc; override; @@ -84,19 +84,13 @@ begin end; end; -constructor TScreenOptionsThemes.Create(Back: String); +constructor TScreenOptionsThemes.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsThemes.Background.Tex); - - for I := 0 to High(Theme.OptionsThemes.Static) do - AddStatic(Theme.OptionsThemes.Static[I]); - - for I := 0 to High(Theme.OptionsThemes.Text) do - AddText(Theme.OptionsThemes.Text[I]); + LoadFromTheme(Theme.OptionsThemes); AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index b268e04f..cf643310 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -116,9 +116,6 @@ var begin inherited Create; - AddBackground(Theme.PartyNewRound.Background.Tex); - Log.LogError(Theme.PartyNewRound.Background.Tex); - TextRound1 := AddText (Theme.PartyNewRound.TextRound1); TextRound2 := AddText (Theme.PartyNewRound.TextRound2); TextRound3 := AddText (Theme.PartyNewRound.TextRound3); @@ -161,15 +158,7 @@ begin StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); - AddButton (Theme.PartyNewRound.ButtonNext); - - for I := 0 to High(Theme.PartyNewRound.Static) do - AddStatic(Theme.PartyNewRound.Static[I]); - - for I := 0 to High(Theme.PartyNewRound.Text) do - AddText(Theme.PartyNewRound.Text[I]); - - Interaction := 0; + LoadFromTheme(Theme.PartyNewRound); end; procedure TScreenPartyNewRound.onShow; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index fd7b5107..f0df9871 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -45,37 +45,6 @@ uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I, J: Integer; - - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -137,8 +106,8 @@ begin // Up and Down could be done at the same time, // but I don't want to declare variables inside // functions like this one, called so many times - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; SDLK_RIGHT: begin Music.PlayOption; @@ -193,6 +162,7 @@ begin SetLength(IPlaylist2, 1); IPlaylist2[0] := '---'; + //Clear all Selects NumTeams := 0; NumPlayer1 := 0; NumPlayer2 := 0; @@ -201,7 +171,8 @@ begin PlayList := 0; PlayList2 := 0; - AddBackground(Theme.PartyOptions.Background.Tex); + //Load Screen From Theme + LoadFromTheme(Theme.PartyOptions); SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); @@ -212,12 +183,6 @@ begin SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); - for I := 0 to High(Theme.PartyOptions.Static) do - AddStatic(Theme.PartyOptions.Static[I]); - - for I := 0 to High(Theme.PartyOptions.Text) do - AddText(Theme.PartyOptions.Text[I]); - Interaction := 0; //Hide Team3 Players diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 02f87710..d6e13d65 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -108,7 +108,7 @@ var begin inherited Create; - AddBackground(Theme.PartyPlayer.Background.Tex); + LoadFromTheme(Theme.PartyPlayer); Team1Name := AddButton(Theme.PartyPlayer.Team1Name); AddButton(Theme.PartyPlayer.Player1Name); @@ -128,12 +128,6 @@ begin AddButton(Theme.PartyPlayer.Player11Name); AddButton(Theme.PartyPlayer.Player12Name); - for I := 0 to High(Theme.PartyPlayer.Static) do - AddStatic(Theme.PartyPlayer.Static[I]); - - for I := 0 to High(Theme.PartyPlayer.Text) do - AddText(Theme.PartyPlayer.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 142ec947..805525a1 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -72,8 +72,6 @@ var begin inherited Create; - AddBackground(Theme.PartyScore.Background.Tex); - TextScoreTeam1 := AddText (Theme.PartyScore.TextScoreTeam1); TextScoreTeam2 := AddText (Theme.PartyScore.TextScoreTeam2); TextScoreTeam3 := AddText (Theme.PartyScore.TextScoreTeam3); @@ -87,11 +85,7 @@ begin TextWinner := AddText (Theme.PartyScore.TextWinner); - for I := 0 to High(Theme.PartyScore.Static) do - AddStatic(Theme.PartyScore.Static[I]); - - for I := 0 to High(Theme.PartyScore.Text) do - AddText(Theme.PartyScore.Text[I]); + LoadFromTheme(Theme.PartyScore); end; procedure TScreenPartyScore.onShow; diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index ac5f38d9..ff65e82f 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -61,8 +61,6 @@ var begin inherited Create; - AddBackground(Theme.PartyWin.Background.Tex); - TextScoreTeam1 := AddText (Theme.PartyWin.TextScoreTeam1); TextScoreTeam2 := AddText (Theme.PartyWin.TextScoreTeam2); TextScoreTeam3 := AddText (Theme.PartyWin.TextScoreTeam3); @@ -76,11 +74,7 @@ begin TextWinner := AddText (Theme.PartyWin.TextWinner); - for I := 0 to High(Theme.PartyWin.Static) do - AddStatic(Theme.PartyWin.Static[I]); - - for I := 0 to High(Theme.PartyWin.Text) do - AddText(Theme.PartyWin.Text[I]); + LoadFromTheme(Theme.PartyWin); end; procedure TScreenPartyWin.onShow; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 72c42cb8..af1ccb59 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -40,7 +40,7 @@ type Animation: real; Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; function Draw: boolean; override; @@ -92,60 +92,14 @@ begin end; end; -constructor TScreenScore.Create(Back: String); +constructor TScreenScore.Create; var P: integer; I, C: integer; begin - inherited Create(Back); + inherited Create; - // background arrows sorted from farthest to nearest -{ AddStatic(-2000 + 400, 100, 360, 60, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); - AddStatic(-2000 + -50, 200, 420, 70, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + 90, 30, 500, 90, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - - Static[0].Texture.Rot := 100 * pi/180; - Static[1].Texture.Rot := 7 * pi/180; - Static[2].Texture.Rot := 35 * pi/180; - - - // main arrow with text - AddStatic(0, 340, 1000, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); -// AddText(450, 409, 4, 15, 1, 1, 1, 'Smile'); - AddText(450, 409, 4, 15, 1, 1, 1, 'Let''s see the results'); - Text[0].Y := 401; - - Static[4].Texture.Rot := -3 * pi/180; - - - // two mid arrows - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - - - // last arrow - AddStatic(-2000, 340, 1100, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); -// AddText(-2000, 407, 4, 17, 1, 1, 1, 'SHUFFLE !'); - AddText(-2000, 407, 4, 15, 1, 1, 1, 'SHUFFLE !'); - - Static[7].Texture.Rot := 184 * pi/180; - - // score text - AddText(-2000, 407, 4, 17, 1, 1, 1, '10010 points'); - AddText(-2000, 407, 4, 17, 1, 1, 1, 'Cheater'); - - Fadeout := false;} - - - // Singstar Theme - AddBackground(Theme.Score.Background.Tex); - - for I := 0 to High(Theme.Score.Static) do - AddStatic(Theme.Score.Static[I]); - - for I := 0 to High(Theme.Score.Text) do - AddText(Theme.Score.Text[I]); + LoadFromTheme(Theme.Score); TextArtist := AddText(Theme.Score.TextArtist); TextTitle := AddText(Theme.Score.TextTitle); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index cca398a1..93c3ac48 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -163,13 +163,7 @@ var begin inherited Create; - AddBackground(Theme.Sing.Background.Tex); - - for I := 0 to High(Theme.Sing.Static) do - AddStatic(Theme.Sing.Static[I]); - - for I := 0 to High(Theme.Sing.Text) do - AddText(Theme.Sing.Text[I]); + LoadFromTheme(Theme.Sing); // time TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 16ac46ab..5c383168 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -630,13 +630,7 @@ begin // AddStatic(200, 10, 400, 90, Skin.SelectSong); // AddStatic(200-10, 140-5, 400+20, 50+10, Skin.Selection, 'JPG', 'Font Gray'); - AddBackground(Theme.Song.Background.Tex); - - for I := 0 to High(Theme.Song.Static) do - AddStatic(Theme.Song.Static[I]); - - for I := 0 to High(Theme.Song.Text) do - AddText(Theme.Song.Text[I]); + LoadFromTheme(Theme.Song); TextArtist := AddText(Theme.Song.TextArtist); TextTitle := AddText(Theme.Song.TextTitle); diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 123146c7..b90c558b 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -154,7 +154,9 @@ var begin inherited Create; - AddBackground(Theme.SongJumpto.Background.Tex); + AddText(Theme.SongJumpto.TextFound); + + LoadFromTheme(Theme.SongJumpto); AddButton(Theme.SongJumpto.ButtonSearchText); if (Length(Button[0].Text) = 0) then @@ -163,13 +165,6 @@ begin SelectType := 0; AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); - AddText(Theme.SongJumpto.TextFound); - - for I := 0 to High(Theme.SongJumpto.Static) do - AddStatic(Theme.SongJumpto.Static[I]); - - for I := 0 to High(Theme.SongJumpto.Text) do - AddText(Theme.SongJumpto.Text[I]); Interaction := 0; LastPlayed := 0; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index d4ad8016..fd875527 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -45,36 +45,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -113,8 +83,8 @@ begin HandleReturn; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; SDLK_RIGHT: begin @@ -141,10 +111,15 @@ var I: integer; begin inherited Create; + + //Create Dummy SelectSlide Entrys SetLength(ISelections, 1); ISelections[0] := 'Dummy'; - AddBackground(Theme.SongMenu.Background.Tex); + + AddText(Theme.SongMenu.TextMenu); + + LoadFromTheme(Theme.SongMenu); AddButton(Theme.SongMenu.Button1); if (Length(Button[0].Text) = 0) then @@ -164,13 +139,6 @@ begin if (Length(Button[3].Text) = 0) then AddButtonText(14, 20, 'Button 4'); - AddText(Theme.SongMenu.TextMenu); - - for I := 0 to High(Theme.SongMenu.Static) do - AddStatic(Theme.SongMenu.Static[I]); - - for I := 0 to High(Theme.SongMenu.Text) do - AddText(Theme.SongMenu.Text[I]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index dc4a0f1f..1461a9da 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -102,7 +102,15 @@ var begin inherited Create; - AddBackground(Theme.StatDetail.Background.Tex); + for I := 0 to High(Theme.StatDetail.TextList) do + AddText(Theme.StatDetail.TextList[I]); + + Count := Length(Theme.StatDetail.TextList); + + AddText(Theme.StatDetail.TextDescription); + AddText(Theme.StatDetail.TextPage); + + LoadFromTheme(Theme.StatDetail); AddButton(Theme.StatDetail.ButtonNext); if (Length(Button[0].Text)=0) then @@ -120,22 +128,6 @@ begin if (Length(Button[3].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); - for I := 0 to High(Theme.StatDetail.TextList) do - AddText(Theme.StatDetail.TextList[I]); - - Count := Length(Theme.StatDetail.TextList); - - AddText(Theme.StatDetail.TextDescription); - AddText(Theme.StatDetail.TextPage); - - for I := 0 to High(Theme.StatDetail.Static) do - AddStatic(Theme.StatDetail.Static[I]); - - for I := 0 to High(Theme.StatDetail.Text) do - AddText(Theme.StatDetail.Text[I]); - - - Interaction := 0; Typ := 0; end; diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 337ed745..219ccd57 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -80,7 +80,9 @@ var begin inherited Create; - AddBackground(Theme.StatMain.Background.Tex); + TextOverview := AddText(Theme.StatMain.TextOverview); + + LoadFromTheme(Theme.StatMain); AddButton(Theme.StatMain.ButtonScores); if (Length(Button[0].Text)=0) then @@ -102,16 +104,9 @@ begin if (Length(Button[4].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[4]); - TextOverview := AddText(Theme.StatMain.TextOverview); - - for I := 0 to High(Theme.StatMain.Static) do - AddStatic(Theme.StatMain.Static[I]); - - for I := 0 to High(Theme.StatMain.Text) do - AddText(Theme.StatMain.Text[I]); - Interaction := 0; + //Set Songs with Vid SongswithVid := 0; For I := 0 to high(Songs.Song) do if (Songs.Song[I].Video <> '') AND FileExists(Songs.Song[I].Path + Songs.Song[I].Video) then diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 94f3de1e..4d542bf0 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -58,13 +58,7 @@ var begin inherited Create; - AddBackground(Theme.Top5.Background.Tex); - - for I := 0 to High(Theme.Top5.Static) do - AddStatic(Theme.Top5.Static[I]); - - for I := 0 to High(Theme.Top5.Text) do - AddText(Theme.Top5.Text[I]); + LoadFromTheme(Theme.Top5); TextLevel := AddText(Theme.Top5.TextLevel); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 0db37635..b7466d84 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,6 +6,9 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -15,6 +18,11 @@ uses UMenuSelect in 'Menu\UMenuSelect.pas', UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -43,6 +51,10 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', + + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -69,14 +81,26 @@ uses UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', UScreenStatMain in 'Screens\UScreenStatMain.pas', UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenCredits in 'Screens\UScreenCredits.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - UScreenCredits in 'Screens\UScreenCredits.pas', + + //------------------------------ + //Includes - Delphi + //------------------------------ Windows, SDL, SysUtils; -- cgit v1.2.3