From e60c0d3e29be2c77e7ab8deca6c37d0b07ebf085 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 18 Oct 2008 21:13:16 +0000 Subject: style adjustments. no code change. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1456 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UThemes.pas | 215 +++++++++++++++------------- src/menu/UMenu.pas | 275 ++++++++++++++++++------------------ src/menu/UMenuBackground.pas | 22 ++- src/menu/UMenuBackgroundColor.pas | 8 +- src/menu/UMenuBackgroundFade.pas | 46 +++--- src/menu/UMenuBackgroundNone.pas | 8 +- src/menu/UMenuBackgroundTexture.pas | 18 +-- src/menu/UMenuBackgroundVideo.pas | 68 +++++---- 8 files changed, 337 insertions(+), 323 deletions(-) diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas index e5232c17..3f00ce52 100644 --- a/src/base/UThemes.pas +++ b/src/base/UThemes.pas @@ -52,14 +52,14 @@ type end; TThemeBackground = record - BGType: Byte; + BGType: byte; Color: TRGB; Tex: string; - Alpha: Real; + Alpha: real; end; const - BGT_Names: Array [0..4] of String = ('none', 'color', 'texture', 'video', 'fade'); + BGT_Names: array [0..4] of string = ('none', 'color', 'texture', 'video', 'fade'); BGT_None = 0; BGT_Color = 1; BGT_Texture = 2; @@ -92,7 +92,7 @@ type TexY2: real; //Reflection Reflection: boolean; - Reflectionspacing: Real; + Reflectionspacing: real; end; AThemeStatic = array of TThemeStatic; @@ -111,7 +111,7 @@ type Text: string; //Reflection Reflection: boolean; - ReflectionSpacing: Real; + ReflectionSpacing: real; end; AThemeText = array of TThemeText; @@ -119,7 +119,7 @@ type Text: AThemeText; X: integer; Y: integer; - Z: Real; + Z: real; W: integer; H: integer; Color: string; @@ -135,29 +135,29 @@ type Tex: string; Typ: TTextureType; - Visible: Boolean; + Visible: boolean; //Reflection Mod Reflection: boolean; - Reflectionspacing: Real; + Reflectionspacing: real; //Fade Mod SelectH: integer; SelectW: integer; Fade: boolean; FadeText: boolean; - DeSelectReflectionspacing : Real; + 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 + 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 + ChildCount: byte; //No of assigned Childs + FirstChild: byte; //No of Child on whose Interaction Position the Button should be end; AThemeButtonCollection = array of TThemeButtonCollection; @@ -172,8 +172,8 @@ type H: integer; Z: real; - TextSize: integer; - + TextSize: integer; + //SBGW Mod SBGW: integer; @@ -190,20 +190,20 @@ type end; TThemeEqualizer = record - Visible: Boolean; - Direction: Boolean; + Visible: boolean; + Direction: boolean; Alpha: real; - X: Integer; - Y: Integer; - Z: Real; - W: Integer; - H: Integer; - Space: Integer; - Bands: Integer; - Length: Integer; - ColR, ColG, ColB: Real; + X: integer; + Y: integer; + Z: real; + W: integer; + H: integer; + Space: integer; + Bands: integer; + Length: integer; + ColR, ColG, ColB: real; Reflection: boolean; - Reflectionspacing: Real; + Reflectionspacing: real; end; PThemeBasic = ^TThemeBasic; @@ -259,13 +259,13 @@ type //Cover Mod Cover: record - Reflections: Boolean; - X: Integer; - Y: Integer; - Z: Integer; - W: Integer; - H: Integer; - Style: Integer; + Reflections: boolean; + X: integer; + Y: integer; + Z: integer; + W: integer; + H: integer; + Style: integer; end; //Equalizer Mod @@ -349,7 +349,7 @@ type TextP3RScore: TThemeText; //Linebonus Translations - LineBonusText: Array [0..8] of String; + LineBonusText: array [0..8] of string; //Pause Popup PausePopUp: TThemeStatic; @@ -428,7 +428,7 @@ type SelectFullscreen: TThemeSelectSlide; SelectResolution: TThemeSelectSlide; SelectDepth: TThemeSelectSlide; - SelectVisualizer: TThemeSelectSlide; + SelectVisualizer: TThemeSelectSlide; SelectOscilloscope: TThemeSelectSlide; SelectLineBonus: TThemeSelectSlide; SelectMovieSize: TThemeSelectSlide; @@ -511,10 +511,10 @@ type TextFound: TThemeText; //Translated Texts - Songsfound: String; - NoSongsfound: String; - CatText: String; - IType: array [0..2] of String; + Songsfound: string; + NoSongsfound: string; + CatText: string; + IType: array [0..2] of string; end; //Party Screens @@ -556,7 +556,7 @@ type TextTeam1Players: TThemeText; TextTeam2Players: TThemeText; TextTeam3Players: TThemeText; - + StaticTeam1: TThemeStatic; StaticTeam2: TThemeStatic; StaticTeam3: TThemeStatic; @@ -583,19 +583,19 @@ type StaticTeam3Deco: TThemeStatic; DecoTextures: record - ChangeTextures: Boolean; + ChangeTextures: boolean; - FirstTexture: String; + FirstTexture: string; FirstTyp: TTextureType; - FirstColor: String; + FirstColor: string; - SecondTexture: String; + SecondTexture: string; SecondTyp: TTextureType; - SecondColor: String; + SecondColor: string; - ThirdTexture: String; + ThirdTexture: string; ThirdTyp: TTextureType; - ThirdColor: String; + ThirdColor: string; end; @@ -683,7 +683,7 @@ type Description: array[0..3] of string; DescriptionR: array[0..3] of string; FormatStr: array[0..3] of string; - PageStr: String; + PageStr: string; end; //Playlist Translations @@ -738,7 +738,7 @@ type Playlist: TThemePlaylist; - ILevel: array[0..2] of String; + ILevel: array[0..2] of string; constructor Create(FileName: string); overload; // Initialize theme system constructor Create(FileName: string; Color: integer); overload; // Initialize theme system with color @@ -775,9 +775,9 @@ type end; procedure glColorRGB(Color: TRGB); overload; -procedure glColorRGB(Color: TRGB; Alpha: Real); overload; +procedure glColorRGB(Color: TRGB; Alpha: real); overload; procedure glColorRGB(Color: TRGBA); overload; -procedure glColorRGB(Color: TRGBA; Alpha: Real); overload; +procedure glColorRGB(Color: TRGBA; Alpha: real); overload; function ColorExists(Name: string): integer; procedure LoadColor(var R, G, B: real; ColorName: string); @@ -808,7 +808,7 @@ begin glColor3f(Color.R, Color.G, Color.B); end; -procedure glColorRGB(Color: TRGB; Alpha: Real); overload; +procedure glColorRGB(Color: TRGB; Alpha: real); overload; begin glColor4f(Color.R, Color.G, Color.B, Alpha); end; @@ -818,12 +818,11 @@ begin glColor4f(Color.R, Color.G, Color.B, Color.A); end; -procedure glColorRGB(Color: TRGBA; Alpha: Real); overload; +procedure glColorRGB(Color: TRGBA; Alpha: real); overload; begin glColor4f(Color.R, Color.G, Color.B, Min(Color.A, Alpha)); end; - constructor TTheme.Create(FileName: string); begin Create(FileName, 0); @@ -870,7 +869,6 @@ begin end; - function TTheme.LoadTheme(FileName: string; sColor: integer): boolean; var I: integer; @@ -879,7 +877,7 @@ begin Result := false; create_theme_objects(); - + Log.LogStatus('Loading: '+ FileName, 'TTheme.LoadTheme'); FileName := AdaptFilePaths(FileName); @@ -1109,7 +1107,8 @@ begin ThemeLoadText(Score.TextTitle, 'ScoreTextTitle'); ThemeLoadText(Score.TextArtistTitle, 'ScoreTextArtistTitle'); - for I := 1 to 6 do begin + for I := 1 to 6 do + begin ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); ThemeLoadTexts(Score.PlayerTexts[I], 'ScorePlayer' + IntToStr(I) + 'Text'); @@ -1138,7 +1137,7 @@ begin // Top5 ThemeLoadBasic(Top5, 'Top5'); - + ThemeLoadText(Top5.TextLevel, 'Top5TextLevel'); ThemeLoadText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); ThemeLoadStatics(Top5.StaticNumber, 'Top5StaticNumber'); @@ -1488,14 +1487,14 @@ end; procedure TTheme.ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); var - BGType: String; - I: Integer; + BGType: string; + I: integer; begin BGType := lowercase(ThemeIni.ReadString(Name + 'Background', 'Type', 'auto')); ThemeBackground.BGType := BGT_Auto; - For I := 0 to high(BGT_Names) do - If (BGT_Names[I] = BGType) then + for I := 0 to high(BGT_Names) do + if (BGT_Names[I] = BGType) then begin ThemeBackground.BGType := I; Break; @@ -1510,7 +1509,7 @@ end; procedure TTheme.ThemeLoadText(var ThemeText: TThemeText; Name: string); var - C: integer; + C: integer; begin ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); @@ -1534,7 +1533,8 @@ begin ThemeText.Reflectionspacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); C := ColorExists(ThemeText.Color); - if C >= 0 then begin + if C >= 0 then + begin ThemeText.ColR := Color[C].RGB.R; ThemeText.ColG := Color[C].RGB.G; ThemeText.ColB := Color[C].RGB.B; @@ -1543,10 +1543,11 @@ end; procedure TTheme.ThemeLoadTexts(var ThemeText: AThemeText; Name: string); var - T: integer; + T: integer; begin T := 1; - while ThemeIni.SectionExists(Name + IntToStr(T)) do begin + while ThemeIni.SectionExists(Name + IntToStr(T)) do + begin SetLength(ThemeText, T); ThemeLoadText(ThemeText[T-1], Name + IntToStr(T)); Inc(T); @@ -1555,7 +1556,7 @@ end; procedure TTheme.ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); var - C: integer; + C: integer; begin ThemeStatic.Tex := ThemeIni.ReadString(Name, 'Tex', ''); @@ -1569,7 +1570,8 @@ begin ThemeStatic.Color := ThemeIni.ReadString(Name, 'Color', ''); C := ColorExists(ThemeStatic.Color); - if C >= 0 then begin + if C >= 0 then + begin ThemeStatic.ColR := Color[C].RGB.R; ThemeStatic.ColG := Color[C].RGB.G; ThemeStatic.ColB := Color[C].RGB.B; @@ -1587,10 +1589,11 @@ end; procedure TTheme.ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); var - S: integer; + S: integer; begin S := 1; - while ThemeIni.SectionExists(Name + IntToStr(S)) do begin + while ThemeIni.SectionExists(Name + IntToStr(S)) do + begin SetLength(ThemeStatic, S); ThemeLoadStatic(ThemeStatic[S-1], Name + IntToStr(S)); Inc(S); @@ -1599,7 +1602,7 @@ end; //Button Collection Mod procedure TTheme.ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); -var T: Integer; +var T: integer; begin //Load Collection Style ThemeLoadButton(Collection.Style, Name); @@ -1614,10 +1617,11 @@ end; procedure TTheme.ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); var - I: integer; + I: integer; begin I := 1; - while ThemeIni.SectionExists(Name + IntToStr(I)) do begin + while ThemeIni.SectionExists(Name + IntToStr(I)) do + begin SetLength(Collections, I); ThemeLoadButtonCollection(Collections[I-1], Name + IntToStr(I)); Inc(I); @@ -1627,9 +1631,9 @@ end; procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection); var - C: integer; - TLen: integer; - T: integer; + C: integer; + TLen: integer; + T: integer; Collections2: PAThemeButtonCollection; begin if not ThemeIni.SectionExists(Name) then @@ -1660,7 +1664,8 @@ begin ThemeButton.Color := ThemeIni.ReadString(Name, 'Color', ''); C := ColorExists(ThemeButton.Color); - if C >= 0 then begin + if C >= 0 then + begin ThemeButton.ColR := Color[C].RGB.R; ThemeButton.ColG := Color[C].RGB.G; ThemeButton.ColB := Color[C].RGB.B; @@ -1668,7 +1673,8 @@ begin ThemeButton.DColor := ThemeIni.ReadString(Name, 'DColor', ''); C := ColorExists(ThemeButton.DColor); - if C >= 0 then begin + if C >= 0 then + begin ThemeButton.DColR := Color[C].RGB.R; ThemeButton.DColG := Color[C].RGB.G; ThemeButton.DColB := Color[C].RGB.B; @@ -1717,7 +1723,7 @@ end; procedure TTheme.ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); var - C: integer; + C: integer; begin ThemeSelectS.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); @@ -1759,7 +1765,7 @@ begin end; procedure TTheme.ThemeLoadEqualizer(var ThemeEqualizer: TThemeEqualizer; Name: string); -var I: Integer; +var I: integer; begin ThemeEqualizer.Visible := (ThemeIni.ReadInteger(Name, 'Visible', 0) = 1); ThemeEqualizer.Direction := (ThemeIni.ReadInteger(Name, 'Direction', 0) = 1); @@ -1777,12 +1783,14 @@ begin //Color I := ColorExists(ThemeIni.ReadString(Name, 'Color', 'Black')); - if I >= 0 then begin + if I >= 0 then + begin ThemeEqualizer.ColR := Color[I].RGB.R; ThemeEqualizer.ColG := Color[I].RGB.G; ThemeEqualizer.ColB := Color[I].RGB.B; end - else begin + else + begin ThemeEqualizer.ColR := 0; ThemeEqualizer.ColG := 0; ThemeEqualizer.ColB := 0; @@ -1791,18 +1799,19 @@ end; procedure TTheme.LoadColors; var - SL: TStringList; - C: integer; - S: string; - Col: integer; - RGB: TRGB; + SL: TStringList; + C: integer; + S: string; + Col: integer; + RGB: TRGB; begin SL := TStringList.Create; ThemeIni.ReadSection('Colors', SL); // normal colors SetLength(Color, SL.Count); - for C := 0 to SL.Count-1 do begin + for C := 0 to SL.Count-1 do + begin Color[C].Name := SL.Strings[C]; S := ThemeIni.ReadString('Colors', SL.Strings[C], ''); @@ -1917,19 +1926,21 @@ end; function ColorExists(Name: string): integer; var - C: integer; + C: integer; begin Result := -1; for C := 0 to High(Color) do - if Color[C].Name = Name then Result := C; + if Color[C].Name = Name then + Result := C; end; procedure LoadColor(var R, G, B: real; ColorName: string); var - C: integer; + C: integer; begin C := ColorExists(ColorName); - if C >= 0 then begin + if C >= 0 then + begin R := Color[C].RGB.R; G := Color[C].RGB.G; B := Color[C].RGB.B; @@ -2011,7 +2022,7 @@ end; procedure TTheme.ThemeSave(FileName: string); var - I: integer; + I: integer; begin {$IFDEF THEMESAVE} ThemeIni := TIniFile.Create(FileName); @@ -2101,7 +2112,8 @@ begin ThemeSaveText(Score.TextArtist, 'ScoreTextArtist'); ThemeSaveText(Score.TextTitle, 'ScoreTextTitle'); - for I := 1 to 6 do begin + for I := 1 to 6 do + begin ThemeSaveStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); ThemeSaveText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); @@ -2146,7 +2158,8 @@ procedure TTheme.ThemeSaveBackground(ThemeBackground: TThemeBackground; Name: st begin if ThemeBackground.Tex <> '' then ThemeIni.WriteString(Name, 'Tex', ThemeBackground.Tex) - else begin + else + begin ThemeIni.EraseSection(Name); end; end; @@ -2170,7 +2183,7 @@ end; procedure TTheme.ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); var - S: integer; + S: integer; begin for S := 0 to Length(ThemeStatic)-1 do ThemeSaveStatic(ThemeStatic[S], Name + {'Static' +} IntToStr(S+1)); @@ -2196,7 +2209,7 @@ end; procedure TTheme.ThemeSaveTexts(ThemeText: AThemeText; Name: string); var - T: integer; + T: integer; begin for T := 0 to Length(ThemeText)-1 do ThemeSaveText(ThemeText[T], Name + {'Text' + }IntToStr(T+1)); @@ -2206,7 +2219,7 @@ end; procedure TTheme.ThemeSaveButton(ThemeButton: TThemeButton; Name: string); var - T: integer; + T: integer; begin ThemeIni.WriteString(Name, 'Tex', ThemeButton.Tex); ThemeIni.WriteInteger(Name, 'X', ThemeButton.X); @@ -2228,14 +2241,16 @@ begin ThemeButton.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1);} { C := ColorExists(ThemeIni.ReadString(Name, 'Color', '')); - if C >= 0 then begin + if C >= 0 then + begin ThemeButton.ColR := Color[C].RGB.R; ThemeButton.ColG := Color[C].RGB.G; ThemeButton.ColB := Color[C].RGB.B; end; C := ColorExists(ThemeIni.ReadString(Name, 'DColor', '')); - if C >= 0 then begin + if C >= 0 then + begin ThemeButton.DColR := Color[C].RGB.R; ThemeButton.DColG := Color[C].RGB.G; ThemeButton.DColB := Color[C].RGB.B; diff --git a/src/menu/UMenu.pas b/src/menu/UMenu.pas index 9068e4cb..c4e0ece6 100644 --- a/src/menu/UMenu.pas +++ b/src/menu/UMenu.pas @@ -59,9 +59,9 @@ type Interactions: array of TInteract; SelInteraction: integer; - ButtonPos: Integer; + ButtonPos: integer; Button: array of TButton; - + SelectsS: array of TSelectSlide; ButtonCollection: array of TButtonCollection; public @@ -73,7 +73,6 @@ type Fade: integer; // fade type ShowFinish: boolean; // true if there is no fade - destructor Destroy; override; constructor Create; overload; virtual; //constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background @@ -90,7 +89,7 @@ type procedure LoadFromTheme(const ThemeBasic: TThemeBasic); procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); - procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); + procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; const Num: byte); // background procedure AddBackground(ThemedSettings: TThemeBackground); @@ -103,20 +102,20 @@ type function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType): integer; overload; function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer; overload; function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name: string; Typ: TTextureType; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name: string; Typ: TTextureType; Color: integer; Reflection: boolean; ReflectionSpacing: real): integer; overload; // text function AddText(ThemeText: TThemeText): integer; overload; function AddText(X, Y: real; const Text_: string): integer; overload; function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: string): integer; overload; - function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string; Reflection_: Boolean; ReflectionSpacing_: Real; Z : Real): integer; overload; + function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; overload; // button - Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button + Procedure SetButtonLength(Length: cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button function AddButton(ThemeButton: TThemeButton): integer; overload; - function AddButton(X, Y, W, H: real; const Name: String): integer; overload; - function AddButton(X, Y, W, H: real; const Name: String; Typ: TTextureType; Reflection: Boolean): integer; overload; - function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; const Name: String; Typ: TTextureType; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; overload; + function AddButton(X, Y, W, H: real; const Name: string): integer; overload; + function AddButton(X, Y, W, H: real; const Name: string; Typ: TTextureType; Reflection: boolean): integer; overload; + function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; const Name: string; Typ: TTextureType; Reflection: boolean; ReflectionSpacing, DeSelectReflectionSpacing: real): integer; overload; procedure ClearButtons; procedure AddButtonText(AddX, AddY: real; const AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: string); overload; @@ -129,10 +128,10 @@ type 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; - const Name: String; Typ: TTextureType; const SBGName: String; SBGTyp: TTextureType; + const Name: string; Typ: TTextureType; const SBGName: string; SBGTyp: TTextureType; const Caption: string; var Data: integer): integer; overload; procedure AddSelectSlideOption(const AddText: string); overload; - procedure AddSelectSlideOption(SelectNo: Cardinal; const AddText: string); overload; + procedure AddSelectSlideOption(SelectNo: cardinal; const AddText: string); overload; procedure UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); // function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; @@ -140,23 +139,23 @@ type procedure FadeTo(Screen: PMenu); overload; procedure FadeTo(Screen: PMenu; aSound: TAudioPlaybackStream); overload; //popup hack - procedure CheckFadeTo(Screen: PMenu; msg: String); + procedure CheckFadeTo(Screen: PMenu; msg: string); function DrawBG: boolean; virtual; function DrawFG: boolean; virtual; function Draw: boolean; virtual; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown : Boolean): Boolean; virtual; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown : boolean): boolean; virtual; // FIXME: ParseMouse is not implemented in any subclass and not even used anywhere in the code // -> do this before activation of this method - //function ParseMouse(Typ: integer; X: integer; Y: integer): Boolean; virtual; abstract; + //function ParseMouse(Typ: integer; X: integer; Y: integer): boolean; virtual; abstract; procedure onShow; virtual; procedure onShowFinish; virtual; procedure onHide; virtual; procedure SetAnimationProgress(Progress: real); virtual; - function IsSelectable(Int: Cardinal): Boolean; - + function IsSelectable(Int: cardinal): boolean; + procedure InteractNext; virtual; procedure InteractCustom(CustomSwitch: integer); virtual; procedure InteractPrev; virtual; @@ -200,7 +199,7 @@ uses UCommon, destructor TMenu.Destroy; begin - If (Background <> nil) then + if (Background <> nil) then begin Background.Destroy; end; @@ -223,21 +222,23 @@ begin Background := nil; end; { -constructor TMenu.Create(Back: String); +constructor TMenu.Create(Back: string); begin inherited Create; - if Back <> '' then begin + if Back <> '' then + begin // BackImg := Texture.GetTexture(true, Back, TEXTURE_TYPE_PLAIN, 0); BackImg := Texture.GetTexture(Back, TEXTURE_TYPE_PLAIN, 0); // new theme system BackImg.W := 800;//640; BackImg.H := 600;//480; BackW := 1; BackH := 1; - end else + end + else BackImg.TexNum := 0; - //Set ButtonPos to Autoset Length + //Set ButtonPos to Autoset Length ButtonPos := -1; end; @@ -250,7 +251,7 @@ begin BackH := H; end; } -function RGBFloatToInt(R, G, B: Double): Cardinal; +function RGBFloatToInt(R, G, B: Double): cardinal; begin Result := (Trunc(255 * R) shl 16) or (Trunc(255 * G) shl 8) or @@ -259,7 +260,7 @@ end; procedure TMenu.AddInteraction(Typ, Num: integer); var - IntNum: integer; + IntNum: integer; begin IntNum := Length(Interactions); SetLength(Interactions, IntNum+1); @@ -270,8 +271,8 @@ end; procedure TMenu.SetInteraction(Num: integer); var - OldNum, OldTyp: integer; - NewNum, NewTyp: integer; + OldNum, OldTyp: integer; + NewNum, NewTyp: integer; begin // set inactive OldNum := Interactions[Interaction].Num; @@ -281,32 +282,32 @@ begin NewTyp := Interactions[Num].Typ; case OldTyp of - iButton: Button[OldNum].Selected := False; - iText: Text[OldNum].Selected := False; - iSelectS: SelectsS[OldNum].Selected := False; + iButton: Button[OldNum].Selected := false; + iText: Text[OldNum].Selected := false; + iSelectS: SelectsS[OldNum].Selected := false; //Button Collection Mod iBCollectionChild: begin - Button[OldNum].Selected := False; - + 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; + ButtonCollection[Button[OldNum].Parent-1].Selected := false; end; end; // set active SelInteraction := Num; case NewTyp of - iButton: Button[NewNum].Selected := True; - iText: Text[NewNum].Selected := True; - iSelectS: SelectsS[NewNum].Selected := True; + iButton: Button[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; + Button[NewNum].Selected := true; + ButtonCollection[Button[NewNum].Parent-1].Selected := true; end; end; end; @@ -317,7 +318,7 @@ end; //---------------------- procedure TMenu.LoadFromTheme(const ThemeBasic: TThemeBasic); var - I: Integer; + I: integer; begin //Add Button Collections (Set Button CollectionsLength) //Button Collections are Created when the first ChildButton is Created @@ -336,24 +337,24 @@ end; procedure TMenu.AddBackground(ThemedSettings: TThemeBackground); var - FileExt: String; + FileExt: string; - Function IsInArray(const Piece: String; const A: Array of String): Boolean; - var I: Integer; + Function IsInArray(const Piece: string; const A: array of string): boolean; + var I: integer; begin - Result := False; - - For I := 0 to High(A) do - If (A[I] = Piece) then + Result := false; + + for I := 0 to High(A) do + if (A[I] = Piece) then begin - Result := True; + Result := true; Exit; end; end; - Function TryBGCreate(Typ: cMenuBackground): Boolean; + Function TryBGCreate(Typ: cMenuBackground): boolean; begin - Result := True; + Result := true; try Background := Typ.Create(ThemedSettings); @@ -361,12 +362,13 @@ procedure TMenu.AddBackground(ThemedSettings: TThemeBackground); on E: EMenuBackgroundError do begin //Background failes to create Freeandnil(Background); - Result := False; + Result := false; end; end; end; + begin - If (Background <> nil) then + if (Background <> nil) then begin Background.Destroy; Background := nil; @@ -375,21 +377,20 @@ begin Case ThemedSettings.BGType of BGT_Auto: begin //Automaticly choose one out of BGT_Texture, BGT_Video or BGT_Color - If (Length(ThemedSettings.Tex) > 0) then + if (Length(ThemedSettings.Tex) > 0) then begin //At first some intelligent try to decide which BG to load FileExt := lowercase(ExtractFileExt(Skin.GetTextureFileName(ThemedSettings.Tex))); - If IsInArray(FileExt, SUPPORTED_EXTS_BACKGROUNDTEXTURE) then + if IsInArray(FileExt, SUPPORTED_EXTS_BACKGROUNDTEXTURE) then TryBGCreate(TMenuBackgroundTexture) - Else If IsInArray(FileExt, SUPPORTED_EXTS_BACKGROUNDVIDEO) then + else if IsInArray(FileExt, SUPPORTED_EXTS_BACKGROUNDVIDEO) then TryBGCreate(TMenuBackgroundVideo); - //If the intelligent method don't succeed //do it by trial and error - If (Background = nil) then + if (Background = nil) then begin //Try Textured Bg if not TryBGCreate(TMenuBackgroundTexture) then @@ -462,11 +463,11 @@ begin end; //Fallback to None Background or Colored Background - If (Background = nil) then + if (Background = nil) then begin - If (ThemedSettings.BGType = BGT_Color) then + if (ThemedSettings.BGType = BGT_Color) then Background := TMenuBackgroundNone.Create(ThemedSettings) - Else + else Background := TMenuBackgroundColor.Create(ThemedSettings) end; end; @@ -477,10 +478,10 @@ end; //---------------------- procedure TMenu.PrepareButtonCollections(const Collections: AThemeButtonCollection); var - I: Integer; + I: integer; begin SetLength(ButtonCollection, Length(Collections)); - For I := 0 to High(ButtonCollection) do + for I := 0 to High(ButtonCollection) do AddButtonCollection(Collections[I], I); end; @@ -488,10 +489,10 @@ end; //AddButtonCollection: //Create a Button Collection; //---------------------- -procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); +procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; const Num: byte); var - BT, BTLen: Integer; - TempCol, TempDCol: Cardinal; + BT, BTLen: integer; + TempCol, TempDCol: cardinal; begin if (Num > High(ButtonCollection)) then @@ -528,7 +529,8 @@ begin ButtonCollection[Num].Y := ThemeCollection.Style.Y; ButtonCollection[Num].W := ThemeCollection.Style.W; ButtonCollection[Num].H := ThemeCollection.Style.H; - if (ThemeCollection.Style.Typ <> TEXTURE_TYPE_COLORIZED) then begin + if (ThemeCollection.Style.Typ <> TEXTURE_TYPE_COLORIZED) then + begin ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; @@ -560,15 +562,17 @@ begin begin ButtonCollection[Num].FadeTex := Texture.GetTexture( Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), TEXTURE_TYPE_COLORIZED, TempCol) - end else begin + end + else + begin ButtonCollection[Num].FadeTex := Texture.GetTexture( Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ); end; ButtonCollection[Num].FadeTexPos := ThemeCollection.Style.FadeTexPos; - BTLen := Length(ThemeCollection.Style.Text); - for BT := 0 to BTLen-1 do begin + 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, @@ -602,7 +606,7 @@ end; function TMenu.AddStatic(X, Y, W, H: real; const Name: string; Typ: TTextureType): integer; var - StatNum: integer; + StatNum: integer; begin // adds static StatNum := Length(Static); @@ -625,12 +629,12 @@ end; function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer; begin - Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Typ, Color, False, 0); + Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Typ, Color, false, 0); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name: string; Typ: TTextureType; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name: string; Typ: TTextureType; Color: integer; Reflection: boolean; ReflectionSpacing: real): integer; var - StatNum: integer; + StatNum: integer; begin // adds static StatNum := Length(Static); @@ -681,7 +685,7 @@ end; function TMenu.AddText(X, Y: real; const Text_: string): integer; var - TextNum: integer; + TextNum: integer; begin // adds text TextNum := Length(Text); @@ -695,9 +699,9 @@ begin Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Text, false, 0, 0); end; -function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string; Reflection_: Boolean; ReflectionSpacing_: Real; Z : Real): integer; +function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; var - TextNum: integer; + TextNum: integer; begin // adds text TextNum := Length(Text); @@ -706,8 +710,8 @@ begin Result := TextNum; end; -//Function that Set Length of Button Array in one Step instead of register new Memory for every Button -Procedure TMenu.SetButtonLength(Length: Cardinal); +//Function that Set Length of Button boolean in one Step instead of register new Memory for every Button +Procedure TMenu.SetButtonLength(Length: cardinal); begin if (ButtonPos = -1) AND (Length > 0) then begin @@ -719,12 +723,11 @@ begin end; end; - // Method to add a button in our TMenu. It returns the assigned ButtonNumber function TMenu.AddButton(ThemeButton: TThemeButton): integer; var - BT: integer; - BTLen: integer; + BT: integer; + BTLen: integer; begin Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, @@ -773,7 +776,7 @@ begin if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then begin Interactions[High(Interactions)].Typ := iBCollectionChild; - Button[Result].Visible := False; + Button[Result].Visible := false; for BT := 0 to BTLen-1 do Button[Result].Text[BT].Alpha := 0; @@ -787,19 +790,19 @@ begin Log.LogBenchmark('====> Screen Options32', 6); end; -function TMenu.AddButton(X, Y, W, H: real; const Name: String): integer; +function TMenu.AddButton(X, Y, W, H: real; const Name: string): integer; begin - Result := AddButton(X, Y, W, H, Name, TEXTURE_TYPE_PLAIN, False); + Result := AddButton(X, Y, W, H, Name, TEXTURE_TYPE_PLAIN, false); end; -function TMenu.AddButton(X, Y, W, H: real; const Name: String; Typ: TTextureType; Reflection: Boolean): integer; +function TMenu.AddButton(X, Y, W, H: real; const Name: string; Typ: TTextureType; Reflection: boolean): integer; begin Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, TEXTURE_TYPE_PLAIN, Reflection, 15, 15); end; function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; - const Name: String; Typ: TTextureType; - Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; + const Name: string; Typ: TTextureType; + Reflection: boolean; ReflectionSpacing, DeSelectReflectionSpacing: real): integer; begin // adds button //SetLength is used once to reduce Memory usement @@ -855,7 +858,6 @@ begin //Button Collection Mod Button[Result].Parent := 0; - // adds interaction AddInteraction(iButton, Result); Interaction := 0; @@ -876,7 +878,7 @@ end; function TMenu.DrawFG: boolean; var - J: Integer; + J: integer; begin // We don't forget about newly implemented static for nice skin ... for J := 0 to Length(Static) - 1 do @@ -900,7 +902,7 @@ begin // Third, we draw all our widgets // for J := 0 to Length(WidgetsSrc) - 1 do // SDL_BlitSurface(WidgetsSrc[J], nil, ParentBackBuf, WidgetsRect[J]); - Result := True; + Result := true; end; function TMenu.Draw: boolean; @@ -959,9 +961,9 @@ begin end; } -function TMenu.IsSelectable(Int: Cardinal): Boolean; +function TMenu.IsSelectable(Int: cardinal): boolean; begin - Result := True; + Result := true; case Interactions[Int].Typ of //Button iButton: Result := Button[Interactions[Int].Num].Visible and Button[Interactions[Int].Num].Selectable; @@ -980,7 +982,7 @@ end; // this behaviour doesn't make sense for two rows of buttons procedure TMenu.InteractPrevRow; var - Int: integer; + Int: integer; begin // these two procedures just make sense for at least 5 buttons, because we // usually start a second row when there are more than 4 buttons @@ -996,7 +998,7 @@ end; procedure TMenu.InteractNextRow; var - Int: integer; + Int: integer; begin Int := Interaction; @@ -1046,22 +1048,23 @@ begin Interaction := Int end; - procedure TMenu.InteractCustom(CustomSwitch: integer); { needed only for below var - Num: integer; - Typ: integer; - Again: boolean; + Num: integer; + Typ: integer; + Again: boolean; } begin //Code Commented atm, because it needs to be Rewritten //it doesn't work with Button Collections - {then begin + {then + begin CustomSwitch:= CustomSwitch*(-1); Again := true; // change interaction as long as it's needed - while (Again = true) do begin + while (Again = true) do + begin Num := SelInteraction - CustomSwitch; if Num = -1 then Num := High(Interactions); Interaction := Num; @@ -1073,34 +1076,36 @@ begin case Typ of iButton: begin - if Button[Num].Selectable = false then Again := True; + if Button[Num].Selectable = false then + Again := true; end; end; // case end; // while end - else if num>0 then begin + else if num>0 then + begin Again := true; // change interaction as long as it's needed - while (Again = true) do begin + while (Again = true) do + begin Num := (Interaction + CustomSwitch) 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; + if Button[Num].Selectable = false then + Again := true; end; end; // case end; // while end } end; - procedure TMenu.FadeTo(Screen: PMenu); begin Display.Fade := 0; @@ -1113,13 +1118,12 @@ begin AudioPlayback.PlaySound( aSound ); end; - //popup hack -procedure TMenu.CheckFadeTo(Screen: PMenu; msg: String); +procedure TMenu.CheckFadeTo(Screen: PMenu; msg: string); begin Display.Fade := 0; Display.NextScreenWithCheck := Screen; - Display.CheckOK:=False; + Display.CheckOK := false; ScreenPopupCheck.ShowPopup(msg); end; @@ -1130,9 +1134,10 @@ end; procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: string); var - Il: integer; + Il: integer; begin - with Button[High(Button)] do begin + with Button[High(Button)] do + begin Il := Length(Text); SetLength(Text, Il+1); Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); @@ -1145,9 +1150,10 @@ end; procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); var - Il: integer; + Il: integer; begin - with Button[High(Button)] do begin + with Button[High(Button)] do + begin Il := Length(Text); SetLength(Text, Il+1); Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); @@ -1163,9 +1169,10 @@ end; procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); var - Il: integer; + Il: integer; begin - with CustomButton do begin + with CustomButton do + begin Il := Length(Text); SetLength(Text, Il+1); Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); @@ -1179,10 +1186,9 @@ begin end; end; - function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; var - SO: integer; + SO: integer; begin Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX, ThemeSelectS.SBGW, ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeSelectS.Int, @@ -1214,11 +1220,11 @@ function TMenu.AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DC 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; - const Name: String; Typ: TTextureType; const SBGName: String; SBGTyp: TTextureType; + const Name: string; Typ: TTextureType; const SBGName: string; SBGTyp: TTextureType; const Caption: string; var Data: integer): integer; var - S: integer; - I: integer; + S: integer; + I: integer; begin S := Length(SelectsS); SetLength(SelectsS, S + 1); @@ -1313,14 +1319,14 @@ begin SelectsS[S].SetSelect(false); {// Configures 3 select options - for I := 0 to 2 do begin + for I := 0 to 2 do + begin SelectsS[S].TextOpt[I].X := SelectsS[S].TextureSBG.X + 20 + (50 + 20) + (150 - 20) * I; SelectsS[S].TextOpt[I].Y := SelectsS[S].TextureSBG.Y + 20; SelectsS[S].TextOpt[I].Text := IntToStr(I+1); SelectsS[S].TextOpt[I].Size := 10; SelectsS[S].TextOpt[I].Align := 1; - SelectsS[S].TextOpt[I].ColR := SelectsS[S].STDColR; SelectsS[S].TextOpt[I].ColG := SelectsS[S].STDColG; SelectsS[S].TextOpt[I].ColB := SelectsS[S].STDColB; @@ -1328,7 +1334,6 @@ begin SelectsS[S].TextOpt[I].Visible := true; end;} - // adds interaction AddInteraction(iSelectS, S); Result := S; @@ -1339,12 +1344,12 @@ begin AddSelectSlideOption(High(SelectsS), AddText); end; -procedure TMenu.AddSelectSlideOption(SelectNo: Cardinal; const AddText: string); +procedure TMenu.AddSelectSlideOption(SelectNo: cardinal; const AddText: string); var - SO: integer; + SO: integer; begin SO := Length(SelectsS[SelectNo].TextOptT); - + SetLength(SelectsS[SelectNo].TextOptT, SO + 1); SelectsS[SelectNo].TextOptT[SO] := AddText; @@ -1355,7 +1360,7 @@ end; procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); var - SO: integer; + SO: integer; begin SetLength(SelectsS[SelectNum].TextOptT, 0); for SO := 0 to High(Values) do @@ -1376,8 +1381,8 @@ end; procedure TMenu.InteractInc; var - Num: integer; - Value: integer; + Num: integer; + Value: integer; begin case Interactions[Interaction].Typ of iSelectS: begin @@ -1395,7 +1400,7 @@ begin begin //Select Next Button in Collection - For Num := 1 to High(Button) do + for Num := 1 to High(Button) do begin Value := (Interaction + Num) Mod Length(Button); if Value = 0 then @@ -1417,8 +1422,8 @@ end; procedure TMenu.InteractDec; var - Num: integer; - Value: integer; + Num: integer; + Value: integer; begin case Interactions[Interaction].Typ of iSelectS: begin @@ -1435,7 +1440,7 @@ begin iBCollectionChild: begin //Select Prev Button in Collection - For Num := High(Button) downto 1 do + for Num := High(Button) downto 1 do begin Value := (Interaction + Num) Mod Length(Button); if Value = High(Button) then @@ -1458,7 +1463,7 @@ begin if (Button[Interactions[Interaction].Num].Parent <> 0) AND (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then begin //Select Last Child - For Num := High(Button) downto 1 do + for Num := High(Button) downto 1 do begin Value := (Interaction + Num) Mod Length(Button); if (Button[Value].Parent = Button[Interaction].Parent) then @@ -1484,7 +1489,7 @@ begin // VideoBackground so we can check whether a video-background is enabled or not. // Second, a video should be stopped if the screen is hidden, but the Video.Stop() // method is not implemented by now. This is necessary for theme-switching too. - // At the moment videos cannot be turned off without restarting USDX. + // At the moment videos cannot be turned off without restarting USDX. {// check if a background texture was found if (BackImg.TexNum = 0) then @@ -1501,7 +1506,7 @@ begin end; end; end; } - If (Background = nil) then + if (Background = nil) then AddBackground(DEFAULTBACKGROUND); Background.OnShow; @@ -1553,7 +1558,7 @@ begin Background.OnFinish; end; -function TMenu.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TMenu.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin // nothing Result := true; diff --git a/src/menu/UMenuBackground.pas b/src/menu/UMenuBackground.pas index 762faf34..6a73b621 100644 --- a/src/menu/UMenuBackground.pas +++ b/src/menu/UMenuBackground.pas @@ -45,39 +45,37 @@ uses type EMenuBackgroundError = class(Exception); TMenuBackground = class - Constructor Create(const ThemedSettings: TThemeBackground); virtual; - Procedure OnShow; virtual; - Procedure Draw; virtual; - Procedure OnFinish; virtual; - Destructor Destroy; virtual; + constructor Create(const ThemedSettings: TThemeBackground); virtual; + procedure OnShow; virtual; + procedure Draw; virtual; + procedure OnFinish; virtual; + destructor Destroy; virtual; end; cMenuBackground = class of TMenuBackground; implementation -Constructor TMenuBackground.Create(const ThemedSettings: TThemeBackground); +constructor TMenuBackground.Create(const ThemedSettings: TThemeBackground); begin inherited Create; end; -Destructor TMenuBackground.Destroy; +destructor TMenuBackground.Destroy; begin inherited; end; - -Procedure TMenuBackground.OnShow; +procedure TMenuBackground.OnShow; begin end; -Procedure TMenuBackground.OnFinish; +procedure TMenuBackground.OnFinish; begin end; - -Procedure TMenuBackground.Draw; +procedure TMenuBackground.Draw; begin end; diff --git a/src/menu/UMenuBackgroundColor.pas b/src/menu/UMenuBackgroundColor.pas index 26385b44..68cf2de4 100644 --- a/src/menu/UMenuBackgroundColor.pas +++ b/src/menu/UMenuBackgroundColor.pas @@ -45,8 +45,8 @@ type private Color: TRGB; public - Constructor Create(const ThemedSettings: TThemeBackground); override; - Procedure Draw; override; + constructor Create(const ThemedSettings: TThemeBackground); override; + procedure Draw; override; end; implementation @@ -54,13 +54,13 @@ uses gl, glext; -Constructor TMenuBackgroundColor.Create(const ThemedSettings: TThemeBackground); +constructor TMenuBackgroundColor.Create(const ThemedSettings: TThemeBackground); begin inherited; Color := ThemedSettings.Color; end; -Procedure TMenuBackgroundColor.Draw; +procedure TMenuBackgroundColor.Draw; begin glClearColor(Color.R, Color.G, Color.B, 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); diff --git a/src/menu/UMenuBackgroundFade.pas b/src/menu/UMenuBackgroundFade.pas index 3bdd631e..b6174738 100644 --- a/src/menu/UMenuBackgroundFade.pas +++ b/src/menu/UMenuBackgroundFade.pas @@ -44,18 +44,18 @@ uses type TMenuBackgroundFade = class (TMenuBackground) private - Tex: TTexture; + Tex: TTexture; Color: TRGB; - Alpha: Real; + Alpha: real; - useTexture: Boolean; + useTexture: boolean; - FadeTime: Cardinal; + FadeTime: cardinal; public - Constructor Create(const ThemedSettings: TThemeBackground); override; - Procedure OnShow; override; - Procedure Draw; override; - Destructor Destroy; override; + constructor Create(const ThemedSettings: TThemeBackground); override; + procedure OnShow; override; + procedure Draw; override; + destructor Destroy; override; end; const @@ -68,15 +68,15 @@ uses sdl, USkins, UCommon; -Constructor TMenuBackgroundFade.Create(const ThemedSettings: TThemeBackground); -var texFilename: String; +constructor TMenuBackgroundFade.Create(const ThemedSettings: TThemeBackground); +var texFilename: string; begin inherited; FadeTime := 0; Color := ThemedSettings.Color; Alpha := ThemedSettings.Alpha; - If (Length(ThemedSettings.Tex) > 0) then + if (Length(ThemedSettings.Tex) > 0) then begin texFilename := Skin.GetTextureFileName(ThemedSettings.Tex); texFilename := AdaptFilePaths(texFilename); @@ -85,43 +85,41 @@ begin UseTexture := (Tex.TexNum <> 0); end else - UseTexture := False; + UseTexture := false; - If (not UseTexture) then + if (not UseTexture) then FreeandNil(Tex); end; -Destructor TMenuBackgroundFade.Destroy; +destructor TMenuBackgroundFade.Destroy; begin //Why isn't there any Tex.free method? - {If UseTexture then + {if UseTexture then FreeandNil(Tex); } inherited; end; - -Procedure TMenuBackgroundFade.OnShow; +procedure TMenuBackgroundFade.OnShow; begin FadeTime := SDL_GetTicks; end; - -Procedure TMenuBackgroundFade.Draw; +procedure TMenuBackgroundFade.Draw; var - Progress: Real; + Progress: real; begin - If FadeTime = 0 then + if FadeTime = 0 then Progress := Alpha - Else + else Progress := Alpha * (SDL_GetTicks - FadeTime) / FADEINTIME; - If Progress > Alpha then + if Progress > Alpha then begin FadeTime := 0; Progress := Alpha; end; - If (UseTexture) then + if (UseTexture) then begin //Draw Texture to Screen glClear(GL_DEPTH_BUFFER_BIT); diff --git a/src/menu/UMenuBackgroundNone.pas b/src/menu/UMenuBackgroundNone.pas index d4188395..6b63742a 100644 --- a/src/menu/UMenuBackgroundNone.pas +++ b/src/menu/UMenuBackgroundNone.pas @@ -45,8 +45,8 @@ type private public - Constructor Create(const ThemedSettings: TThemeBackground); override; - Procedure Draw; override; + constructor Create(const ThemedSettings: TThemeBackground); override; + procedure Draw; override; end; implementation @@ -54,12 +54,12 @@ uses gl, glext; -Constructor TMenuBackgroundNone.Create(const ThemedSettings: TThemeBackground); +constructor TMenuBackgroundNone.Create(const ThemedSettings: TThemeBackground); begin inherited; end; -Procedure TMenuBackgroundNone.Draw; +procedure TMenuBackgroundNone.Draw; begin //Do just nothing in here! glClear(GL_DEPTH_BUFFER_BIT); diff --git a/src/menu/UMenuBackgroundTexture.pas b/src/menu/UMenuBackgroundTexture.pas index 55d1d0b6..e8678fc5 100644 --- a/src/menu/UMenuBackgroundTexture.pas +++ b/src/menu/UMenuBackgroundTexture.pas @@ -47,13 +47,13 @@ type Tex: TTexture; Color: TRGB; public - Constructor Create(const ThemedSettings: TThemeBackground); override; - Procedure Draw; override; - Destructor Destroy; override; + constructor Create(const ThemedSettings: TThemeBackground); override; + procedure Draw; override; + destructor Destroy; override; end; const - SUPPORTED_EXTS_BACKGROUNDTEXTURE: Array[0..13] of String = ('.png', '.bmp', '.jpg', '.jpeg', '.gif', '.pnm', '.ppm', '.pgm', '.pbm', '.xpm', '.lbm', '.pcx', '.tga', '.tiff'); + SUPPORTED_EXTS_BACKGROUNDTEXTURE: array[0..13] of string = ('.png', '.bmp', '.jpg', '.jpeg', '.gif', '.pnm', '.ppm', '.pgm', '.pbm', '.xpm', '.lbm', '.pcx', '.tga', '.tiff'); implementation uses @@ -63,12 +63,12 @@ uses gl, glext; -Constructor TMenuBackgroundTexture.Create(const ThemedSettings: TThemeBackground); -var texFilename: String; +constructor TMenuBackgroundTexture.Create(const ThemedSettings: TThemeBackground); +var texFilename: string; begin inherited; - If (Length(ThemedSettings.Tex) = 0) then + if (Length(ThemedSettings.Tex) = 0) then raise EMenuBackgroundError.Create('TMenuBackgroundTexture: No texture filename present'); Color := ThemedSettings.Color; @@ -84,13 +84,13 @@ begin end; end; -Destructor TMenuBackgroundTexture.Destroy; +destructor TMenuBackgroundTexture.Destroy; begin //freeandnil(Tex); <- this causes an Access Violation o0 inherited; end; -Procedure TMenuBackgroundTexture.Draw; +procedure TMenuBackgroundTexture.Draw; begin glClear(GL_DEPTH_BUFFER_BIT); glColorRGB(Color); diff --git a/src/menu/UMenuBackgroundVideo.pas b/src/menu/UMenuBackgroundVideo.pas index a6d02828..377c2170 100644 --- a/src/menu/UMenuBackgroundVideo.pas +++ b/src/menu/UMenuBackgroundVideo.pas @@ -44,57 +44,57 @@ uses type //DefaultBGVideoPlayback = TVideoPlayback_FFmpeg; -{type +{type TBGVideoPool = class; PBGVideoPoolItem = ^TBGVideoPoolItem; TBGVideoPoolItem = record Parent: TBGVideoPool; VideoPlayback = IVideoPlayback; - ReferenceCounter: Cardinal; //Number of Creations + ReferenceCounter: cardinal; //Number of Creations end; TBGVideo = class private myItem: PBGVideoPoolItem; public - Constructor Create(Item: PBGVideoPoolItem); override; + constructor Create(Item: PBGVideoPoolItem); override; - Function GetVideoPlayback: IVideoPlayback; - Procedure Draw; + function GetVideoPlayback: IVideoPlayback; + procedure Draw; - Destructor Destroy; + destructor Destroy; end; TBGVideoPool = class private Items: PBGVideoPoolItem; public - Constructor Create; + constructor Create; - Function GetBGVideo(filename: String): TBGVideo; - Procedure RemoveItem( - Procedure FreeAllItems; + function GetBGVideo(filename: string): TBGVideo; + procedure RemoveItem( + procedure FreeAllItems; - Destructor Destroy; + destructor Destroy; end; - + type } TMenuBackgroundVideo = class (TMenuBackground) private - fFilename: String; + fFilename: string; public - Constructor Create(const ThemedSettings: TThemeBackground); override; - Procedure OnShow; override; - Procedure Draw; override; - Procedure OnFinish; override; - Destructor Destroy; override; + constructor Create(const ThemedSettings: TThemeBackground); override; + procedure OnShow; override; + procedure Draw; override; + procedure OnFinish; override; + destructor Destroy; override; end; {var BGVideoPool: TBGVideoPool; } const - SUPPORTED_EXTS_BACKGROUNDVIDEO: Array[0..6] of String = ('.avi', '.mov', '.divx', '.mpg', '.mp4', '.mpeg', '.m2v'); + SUPPORTED_EXTS_BACKGROUNDVIDEO: array[0..6] of string = ('.avi', '.mov', '.divx', '.mpg', '.mp4', '.mpeg', '.m2v'); implementation @@ -107,10 +107,10 @@ uses USkins, UCommon; -Constructor TMenuBackgroundVideo.Create(const ThemedSettings: TThemeBackground); +constructor TMenuBackgroundVideo.Create(const ThemedSettings: TThemeBackground); begin inherited; - If (Length(ThemedSettings.Tex) = 0) then + if (Length(ThemedSettings.Tex) = 0) then raise EMenuBackgroundError.Create('TMenuBackgroundVideo: No video filename present'); fFileName := Skin.GetTextureFileName(ThemedSettings.Tex); @@ -125,13 +125,12 @@ begin raise EMenuBackgroundError.Create('TMenuBackgroundVideo: Can''t load background video: ' + fFilename); end; -Destructor TMenuBackgroundVideo.Destroy; +destructor TMenuBackgroundVideo.Destroy; begin end; - -Procedure TMenuBackgroundVideo.OnShow; +procedure TMenuBackgroundVideo.OnShow; begin if VideoPlayback.Open( fFileName ) then begin @@ -140,13 +139,12 @@ begin end; end; -Procedure TMenuBackgroundVideo.OnFinish; +procedure TMenuBackgroundVideo.OnFinish; begin end; - -Procedure TMenuBackgroundVideo.Draw; +procedure TMenuBackgroundVideo.Draw; begin glClear(GL_DEPTH_BUFFER_BIT); @@ -157,23 +155,23 @@ end; // Implementation of TBGVideo //-------- -{Constructor TBGVideo.Create(Item: PBGVideoPoolItem); +{constructor TBGVideo.Create(Item: PBGVideoPoolItem); begin myItem := PBGVideoPoolItem; Inc(myItem.ReferenceCounter); end; -Destructor TBGVideo.Destroy; +destructor TBGVideo.Destroy; begin Dec(myItem.ReferenceCounter); end; -Function TBGVideo.GetVideoPlayback: IVideoPlayback; +function TBGVideo.GetVideoPlayback: IVideoPlayback; begin end; -Procedure TBGVideo.Draw; +procedure TBGVideo.Draw; begin end; @@ -181,22 +179,22 @@ end; // Implementation of TBGVideoPool //-------- -Constructor TBGVideoPool.Create; +constructor TBGVideoPool.Create; begin end; -Destructor TBGVideoPool.Destroy; +destructor TBGVideoPool.Destroy; begin end; -Function TBGVideoPool.GetBGVideo(filename: String): TBGVideo; +function TBGVideoPool.GetBGVideo(filename: string): TBGVideo; begin end; -Procedure TBGVideoPool.FreeAllItems; +procedure TBGVideoPool.FreeAllItems; begin end; } -- cgit v1.2.3