diff options
Diffstat (limited to 'src/menu')
-rw-r--r-- | src/menu/UDisplay.pas | 94 | ||||
-rw-r--r-- | src/menu/UMenu.pas | 81 | ||||
-rw-r--r-- | src/menu/UMenuBackgroundFade.pas | 20 | ||||
-rw-r--r-- | src/menu/UMenuButtonCollection.pas | 32 | ||||
-rw-r--r-- | src/menu/UMenuEqualizer.pas | 145 | ||||
-rw-r--r-- | src/menu/UMenuInteract.pas | 4 | ||||
-rw-r--r-- | src/menu/UMenuSelectSlide.pas | 164 | ||||
-rw-r--r-- | src/menu/UMenuStatic.pas | 11 |
8 files changed, 283 insertions, 268 deletions
diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas index 3e653183..58c416db 100644 --- a/src/menu/UDisplay.pas +++ b/src/menu/UDisplay.pas @@ -45,39 +45,39 @@ type TDisplay = class private //fade-to-black-hack - BlackScreen: Boolean; + BlackScreen: boolean; - FadeEnabled: Boolean; // true if fading is enabled - FadeFailed: Boolean; // true if fading is possible (enough memory, etc.) - FadeState: integer; // fading state, 0 means that the fade texture must be initialized - LastFadeTime: Cardinal; // last fade update time + FadeEnabled: boolean; // true if fading is enabled + FadeFailed: boolean; // true if fading is possible (enough memory, etc.) + FadeState: integer; // fading state, 0 means that the fade texture must be initialized + LastFadeTime: cardinal; // last fade update time - FadeTex: array[1..2] of GLuint; + FadeTex: array[1..2] of GLuint; + + FPSCounter: cardinal; + LastFPS: cardinal; + NextFPSSwap: cardinal; - FPSCounter : Cardinal; - LastFPS : Cardinal; - NextFPSSwap : Cardinal; - - OSD_LastError : String; + OSD_LastError: string; procedure DrawDebugInformation; public - NextScreen : PMenu; - CurrentScreen : PMenu; + NextScreen: PMenu; + CurrentScreen: PMenu; //popup data NextScreenWithCheck: Pmenu; - CheckOK : Boolean; + CheckOK: boolean; // FIXME: Fade is set to 0 in UMain and other files but not used here anymore. - Fade : Real; + Fade: real; constructor Create; destructor Destroy; override; procedure SaveScreenShot; - function Draw: Boolean; + function Draw: boolean; end; var @@ -104,10 +104,10 @@ begin inherited Create; //popup hack - CheckOK := False; + CheckOK := false; NextScreen := nil; NextScreenWithCheck := nil; - BlackScreen := False; + BlackScreen := false; // fade mod FadeState := 0; @@ -133,14 +133,14 @@ begin inherited Destroy; end; -function TDisplay.Draw: Boolean; +function TDisplay.Draw: boolean; var - S: integer; - FadeStateSquare: Real; - currentTime: Cardinal; - glError: glEnum; + S: integer; + FadeStateSquare: real; + currentTime: cardinal; + glError: glEnum; begin - Result := True; + Result := true; //We don't need this here anymore, //Because the background care about cleaning the buffers @@ -166,12 +166,12 @@ begin begin NextScreen := NextScreenWithCheck; NextScreenWithCheck := nil; - CheckOk := False; + CheckOk := false; end else begin // on end of game fade to black before exit - BlackScreen := True; + BlackScreen := true; end; end; @@ -188,16 +188,16 @@ begin // fade mod FadeState := 0; if ((Ini.ScreenFade = 1) and (not FadeFailed)) then - FadeEnabled := True + FadeEnabled := true else if (Ini.ScreenFade = 0) then - FadeEnabled := False; + FadeEnabled := false; end else begin // disable fading if initialization failed if (FadeEnabled and FadeFailed) then begin - FadeEnabled := False; + FadeEnabled := false; end; if (FadeEnabled and not FadeFailed) then @@ -275,7 +275,7 @@ begin glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); end - // blackscreen hack +// blackscreen hack else if not BlackScreen then begin NextScreen.OnShow; @@ -286,7 +286,7 @@ begin // fade out complete... FadeState := 0; CurrentScreen.onHide; - CurrentScreen.ShowFinish := False; + CurrentScreen.ShowFinish := false; CurrentScreen := NextScreen; NextScreen := nil; if not BlackScreen then @@ -296,13 +296,13 @@ begin end else begin - Result := False; + Result := false; Break; end; end; end; // if - //Draw OSD only on first Screen if Debug Mode is enabled +// Draw OSD only on first Screen if Debug Mode is enabled if ((Ini.Debug = 1) or (Params.Debug)) and (S = 1) then DrawDebugInformation; end; // for @@ -318,7 +318,7 @@ var Align: integer; RowSize: integer; begin - // Exit if Screenshot-path does not exist or read-only +// Exit if Screenshot-path does not exist or read-only if (ScreenshotsPath = '') then Exit; @@ -332,9 +332,9 @@ begin break end; - // we must take the row-alignment (4byte by default) into account +// we must take the row-alignment (4byte by default) into account glGetIntegerv(GL_PACK_ALIGNMENT, @Align); - // calc aligned row-size +// calc aligned row-size RowSize := ((ScreenW*3 + (Align-1)) div Align) * Align; GetMem(ScreenData, RowSize * ScreenH); @@ -347,8 +347,8 @@ begin ScreenData, ScreenW, ScreenH, 24, RowSize, $0000FF, $00FF00, $FF0000, 0); - //Success := WriteJPGImage(FileName, Surface, 95); - //Success := WriteBMPImage(FileName, Surface); +// Success := WriteJPGImage(FileName, Surface, 95); +// Success := WriteBMPImage(FileName, Surface); Success := WritePNGImage(FileName, Surface); if Success then ScreenPopupError.ShowPopup('Screenshot saved: ' + ExtractFileName(FileName)) @@ -363,9 +363,9 @@ end; // DrawDebugInformation - Procedure draw FPS and some other Informations on Screen //------------ procedure TDisplay.DrawDebugInformation; -var Ticks: Cardinal; +var Ticks: cardinal; begin - //Some White Background for information +// Some White Background for information glEnable(GL_BLEND); glDisable(GL_TEXTURE_2D); glColor4f(1, 1, 1, 0.5); @@ -377,13 +377,13 @@ begin glEnd; glDisable(GL_BLEND); - //Set Font Specs +// Set Font Specs SetFontStyle(0); SetFontSize(21); - SetFontItalic(False); + SetFontItalic(false); glColor4f(0, 0, 0, 1); - //Calculate FPS +// Calculate FPS Ticks := SDL_GetTicks(); if (Ticks >= NextFPSSwap) then begin @@ -394,17 +394,17 @@ begin Inc(FPSCounter); - //Draw Text +// Draw Text - //FPS +// FPS SetFontPos(695, 0); glPrint ('FPS: ' + InttoStr(LastFPS)); - //RSpeed +// RSpeed SetFontPos(695, 13); glPrint ('RSpeed: ' + InttoStr(Round(1000 * TimeMid))); - //LastError +// LastError SetFontPos(695, 26); glColor4f(1, 0, 0, 1); glPrint (OSD_LastError); diff --git a/src/menu/UMenu.pas b/src/menu/UMenu.pas index 16ecc658..f86746ed 100644 --- a/src/menu/UMenu.pas +++ b/src/menu/UMenu.pas @@ -54,15 +54,15 @@ type PMenu = ^TMenu; TMenu = class protected - Background: TMenuBackground; + Background: TMenuBackground; - Interactions: array of TInteract; - SelInteraction: integer; + Interactions: array of TInteract; + SelInteraction: integer; - ButtonPos: integer; - Button: array of TButton; + ButtonPos: integer; + Button: array of TButton; - SelectsS: array of TSelectSlide; + SelectsS: array of TSelectSlide; ButtonCollection: array of TButtonCollection; public Text: array of TText; @@ -111,7 +111,7 @@ type 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; @@ -167,13 +167,13 @@ type end; const - pmMove = 1; - pmClick = 2; + pmMove = 1; + pmClick = 2; pmUnClick = 3; - iButton = 0; // interaction type - iText = 2; - iSelectS = 3; + iButton = 0; // interaction type + iText = 2; + iSelectS = 3; iBCollectionChild = 5; // fBlack = 0; // fade type @@ -181,21 +181,22 @@ const implementation -uses UCommon, - ULog, - UMain, - UDrawTexture, - UGraphic, - UDisplay, - UCovers, - UTime, - USkins, - //Background types - UMenuBackgroundNone, - UMenuBackgroundColor, - UMenuBackgroundTexture, - UMenuBackgroundVideo, - UMenuBackgroundFade; +uses + UCommon, + ULog, + UMain, + UDrawTexture, + UGraphic, + UDisplay, + UCovers, + UTime, + USkins, + //Background types + UMenuBackgroundNone, + UMenuBackgroundColor, + UMenuBackgroundTexture, + UMenuBackgroundVideo, + UMenuBackgroundFade; destructor TMenu.Destroy; begin @@ -339,8 +340,9 @@ procedure TMenu.AddBackground(ThemedSettings: TThemeBackground); var 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; @@ -352,7 +354,7 @@ procedure TMenu.AddBackground(ThemedSettings: TThemeBackground); end; end; - Function TryBGCreate(Typ: cMenuBackground): boolean; + function TryBGCreate(Typ: cMenuBackground): boolean; begin Result := true; @@ -374,7 +376,7 @@ begin Background := nil; end; - Case ThemedSettings.BGType of + case ThemedSettings.BGType of bgtAuto: begin //Automaticly choose one out of BGT_Texture, BGT_Video or BGT_Color if (Length(ThemedSettings.Tex) > 0) then @@ -491,7 +493,7 @@ end; //---------------------- procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; const Num: byte); var - BT, BTLen: integer; + BT, BTLen: integer; TempCol, TempDCol: cardinal; begin @@ -711,9 +713,9 @@ begin end; //Function that Set Length of Button boolean in one Step instead of register new Memory for every Button -Procedure TMenu.SetButtonLength(Length: cardinal); +procedure TMenu.SetButtonLength(Length: cardinal); begin - if (ButtonPos = -1) AND (Length > 0) then + if (ButtonPos = -1) and (Length > 0) then begin //Set Length of Button SetLength(Button, Length); @@ -920,9 +922,9 @@ end; } { -function TMenu.AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; +function TMenu.AddWidget(X, Y: UInt16; WidgetSrc: PSDL_Surface): Int16; var - WidgetNum : Int16; + WidgetNum: Int16; begin if (Assigned(WidgetSrc)) then begin @@ -946,9 +948,9 @@ end; } { -procedure TMenu.ClearWidgets(MinNumber : Int16); +procedure TMenu.ClearWidgets(MinNumber: Int16); var - J : Int16; + J: Int16; begin for J := MinNumber to (Length(WidgetsSrc) - 1) do begin @@ -1252,6 +1254,7 @@ begin SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp, RGBFloatToInt(SBGColR, SBGColG, SBGColB)) else SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); + SelectsS[S].TextureSBG.X := X + W + SkipX; SelectsS[S].TextureSBG.Y := Y; //SelectsS[S].TextureSBG.W := 450; @@ -1460,7 +1463,7 @@ begin begin InteractPrev; //If ButtonCollection with more than 1 Entry then Select Last Entry - if (Button[Interactions[Interaction].Num].Parent <> 0) AND (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then + 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 diff --git a/src/menu/UMenuBackgroundFade.pas b/src/menu/UMenuBackgroundFade.pas index dc37da45..b61a4542 100644 --- a/src/menu/UMenuBackgroundFade.pas +++ b/src/menu/UMenuBackgroundFade.pas @@ -62,15 +62,17 @@ const FADEINTIME = 1500; //Time the bg fades in
implementation
-uses sdl,
- gl,
- glext,
- USkins,
- UCommon,
- UGraphic;
+uses
+ sdl,
+ gl,
+ glext,
+ USkins,
+ UCommon,
+ UGraphic;
constructor TMenuBackgroundFade.Create(const ThemedSettings: TThemeBackground);
-var texFilename: string;
+var
+ texFilename: string;
begin
inherited;
FadeTime := 0;
@@ -122,7 +124,7 @@ begin if (UseTexture) then
begin //Draw Texture to Screen
- If (ScreenAct = 1) then //Clear just once when in dual screen mode
+ if (ScreenAct = 1) then //Clear just once when in dual screen mode
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
@@ -151,7 +153,7 @@ begin end
else
begin //Clear Screen w/ progress Alpha + Color
- If (ScreenAct = 1) then //Clear just once when in dual screen mode
+ if (ScreenAct = 1) then //Clear just once when in dual screen mode
glClear(GL_DEPTH_BUFFER_BIT);
glDisable(GL_TEXTURE_2D);
diff --git a/src/menu/UMenuButtonCollection.pas b/src/menu/UMenuButtonCollection.pas index c6c6dd81..8b7a1c3f 100644 --- a/src/menu/UMenuButtonCollection.pas +++ b/src/menu/UMenuButtonCollection.pas @@ -41,61 +41,61 @@ type //TButtonCollection //No Extra Attributes or Functions ATM //---------------- - AButton = Array of TButton; + AButton = array of TButton; PAButton = ^AButton; TButtonCollection = class(TButton) //num of the First Button, that can be Selected - FirstChild: Byte; - CountChilds: Byte; + FirstChild: byte; + CountChilds: byte; ScreenButton: PAButton; - procedure SetSelect(Value : Boolean); override; + procedure SetSelect(Value : boolean); override; procedure Draw; override; end; implementation -procedure TButtonCollection.SetSelect(Value : Boolean); -var I: Integer; +procedure TButtonCollection.SetSelect(Value : boolean); +var + Index: 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; + if (not Fade) then + for Index := 0 to High(ScreenButton^) do + if (ScreenButton^[Index].Parent = Parent) then + ScreenButton^[Index].Visible := Value; end; procedure TButtonCollection.Draw; -var I, J: Integer; +var + I, J: integer; begin inherited; //If fading is activated, Fade Child Buttons if (Fade) then begin - For I := 0 to High(ScreenButton^) do + for I := 0 to High(ScreenButton^) do if (ScreenButton^[I].Parent = Parent) then begin if (FadeProgress < 0.5) then begin ScreenButton^[I].Visible := SelectBool; - For J := 0 to High(ScreenButton^[I].Text) do + for J := 0 to High(ScreenButton^[I].Text) do ScreenButton^[I].Text[J].Visible := SelectBool; end else begin ScreenButton^[I].Texture.Alpha := (FadeProgress-0.666)*3; - For J := 0 to High(ScreenButton^[I].Text) do + for J := 0 to High(ScreenButton^[I].Text) do ScreenButton^[I].Text[J].Alpha := (FadeProgress-0.666)*3; end; end; end; end; - - end. diff --git a/src/menu/UMenuEqualizer.pas b/src/menu/UMenuEqualizer.pas index 6d77721c..8f57e44a 100644 --- a/src/menu/UMenuEqualizer.pas +++ b/src/menu/UMenuEqualizer.pas @@ -45,69 +45,71 @@ type Tms_Equalizer = class(TObject) private FFTData: TFFTData; // moved here to avoid stack overflows - BandData: array of Byte; - RefreshTime: Cardinal; + BandData: array of byte; + RefreshTime: cardinal; Source: IAudioPlayback; - Procedure Analyse; + procedure Analyse; public - X: Integer; - Y: Integer; - Z: Real; + X: integer; + Y: integer; + Z: real; - W: Integer; - H: Integer; - Space: Integer; + W: integer; + H: integer; + Space: integer; - Visible: Boolean; - Alpha: real; - Color: TRGB; + Visible: boolean; + Alpha: real; + Color: TRGB; - Direction: Boolean; + Direction: boolean; + BandLength: integer; - BandLength: Integer; - - Reflection: boolean; - Reflectionspacing: Real; + Reflection: boolean; + Reflectionspacing: real; constructor Create(Source: IAudioPlayback; mySkin: TThemeEqualizer); procedure Draw; - - Procedure SetBands(Value: Byte); - Function GetBands: Byte; - Property Bands: Byte read GetBands write SetBands; + procedure SetBands(Value: byte); + function GetBands: byte; + property Bands: byte read GetBands write SetBands; procedure SetSource(newSource: IAudioPlayback); end; implementation -uses math, SDL, gl, glext; - +uses + math, + SDL, + gl, + glext; constructor Tms_Equalizer.Create(Source: IAudioPlayback; mySkin: TThemeEqualizer); -var I: Integer; +var + I: integer; begin - If (Source <> nil) then + if (Source <> nil) then begin - X := mySkin.X; - Y := mySkin.Y; - W := mySkin.W; - H := mySkin.H; - Z := mySkin.Z; + X := mySkin.X; + Y := mySkin.Y; + W := mySkin.W; + H := mySkin.H; + Z := mySkin.Z; - Space := mySkin.Space; + Space := mySkin.Space; - Visible := mySkin.Visible; - Alpha := mySkin.Alpha; - Color.R := mySkin.ColR; - Color.G := mySkin.ColG; - Color.B := mySkin.ColB; + Visible := mySkin.Visible; + Alpha := mySkin.Alpha; + Color.R := mySkin.ColR; + Color.G := mySkin.ColG; + Color.B := mySkin.ColB; - Direction := mySkin.Direction; - Bands := mySkin.Bands; - BandLength := mySkin.Length; + Direction := mySkin.Direction; + Bands := mySkin.Bands; + BandLength := mySkin.Length; Reflection := mySkin.Reflection; Reflectionspacing := mySkin.Reflectionspacing; @@ -116,31 +118,31 @@ begin //Check if Visible - If (Bands <= 0) OR - (BandLength <= 0) OR - (W <= 0) OR - (H <= 0) OR + if (Bands <= 0) or + (BandLength <= 0) or + (W <= 0) or + (H <= 0) or (Alpha <= 0) then - Visible := False; + Visible := false; //ClearArray - For I := low(BandData) to high(BandData) do + for I := low(BandData) to high(BandData) do BandData[I] := 3; end else - Visible := False; + Visible := false; end; //-------- // evaluate FFT-Data //-------- -Procedure Tms_Equalizer.Analyse; - var - I: Integer; - ChansPerBand: byte; // channels per band - MaxChannel: Integer; - Pos: Real; - CurBand: Integer; +procedure Tms_Equalizer.Analyse; +var + I: integer; + ChansPerBand: byte; // channels per band + MaxChannel: integer; + Pos: real; + CurBand: integer; begin Source.GetFFTData(FFTData); @@ -188,25 +190,26 @@ end; // Draw SpectrumAnalyser, Call Analyse //-------- procedure Tms_Equalizer.Draw; - var - CurTime: Cardinal; - PosX, PosY: Real; - I, J: Integer; - Diff: Real; +var + CurTime: cardinal; + PosX, PosY: real; + I, J: integer; + Diff: real; - Function GetAlpha(Diff: Single): Single; + function GetAlpha(Diff: single): single; begin - If Direction then - Result := (Alpha * 0.6) *(0.5 - Diff/(BandLength * (H + Space))) + if Direction then + Result := (Alpha * 0.6) * (0.5 - Diff/(BandLength * (H + Space))) else - Result := (Alpha * 0.6) *(0.5 - Diff/(Bands * (H + Space))); + Result := (Alpha * 0.6) * (0.5 - Diff/(Bands * (H + Space))); end; + begin - If (Visible) AND not (AudioPlayback.Finished) then + if (Visible) and not (AudioPlayback.Finished) then begin //Call Analyse if necessary CurTime := SDL_GetTicks(); - If (CurTime > RefreshTime) then + if (CurTime > RefreshTime) then begin Analyse; @@ -244,12 +247,12 @@ begin glVertex3f(PosX+W, PosY, Z); glEnd; - If (Reflection) AND (J <= BandLength div 2) then + if (Reflection) and (J <= BandLength div 2) then begin Diff := (Y-PosY) + H; //Draw Reflection - If Direction then + if Direction then begin glBegin(GL_QUADS); glColorRGB(Color, GetAlpha(Diff)); @@ -298,22 +301,20 @@ begin end; end; -Procedure Tms_Equalizer.SetBands(Value: Byte); +procedure Tms_Equalizer.SetBands(Value: byte); begin SetLength(BandData, Value); end; -Function Tms_Equalizer.GetBands: Byte; +function Tms_Equalizer.GetBands: byte; begin Result := Length(BandData); end; -Procedure Tms_Equalizer.SetSource(newSource: IAudioPlayback); +procedure Tms_Equalizer.SetSource(newSource: IAudioPlayback); begin - If (newSource <> nil) then + if (newSource <> nil) then Source := newSource; end; - - end.
\ No newline at end of file diff --git a/src/menu/UMenuInteract.pas b/src/menu/UMenuInteract.pas index 4c2d4e86..beb6bcef 100644 --- a/src/menu/UMenuInteract.pas +++ b/src/menu/UMenuInteract.pas @@ -35,8 +35,8 @@ interface type TInteract = record // for moving thru menu - 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 + 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; implementation diff --git a/src/menu/UMenuSelectSlide.pas b/src/menu/UMenuSelectSlide.pas index 1a0fa725..a7133492 100644 --- a/src/menu/UMenuSelectSlide.pas +++ b/src/menu/UMenuSelectSlide.pas @@ -61,10 +61,10 @@ type PData: ^integer; //For automatically Setting LineCount - Lines: Byte; + Lines: byte; //Visibility - Visible: Boolean; + Visible: boolean; // for selection and deselection // main static @@ -121,7 +121,7 @@ type // procedures procedure SetSelect(Value: boolean); - property Selected: Boolean read SelectBool write SetSelect; + property Selected: boolean read SelectBool write SetSelect; procedure SetSelectOpt(Value: integer); property SelectedOption: integer read SelectOptInt write SetSelectOpt; procedure Draw; @@ -132,7 +132,11 @@ type end; implementation -uses UDrawTexture, math, ULog, SysUtils; +uses + UDrawTexture, + math, + ULog, + SysUtils; // ------------ Select constructor TSelectSlide.Create; @@ -145,7 +149,7 @@ begin //Set Standard Width for Selections Background SBGW := 450; - Visible := True; + Visible := true; {SetLength(TextOpt, 3); TextOpt[0] := TText.Create; TextOpt[1] := TText.Create; @@ -154,11 +158,12 @@ end; procedure TSelectSlide.SetSelect(Value: boolean); {var - SO: integer; - I: integer;} + SO: integer; + I: integer;} begin SelectBool := Value; - if Value then begin + if Value then + begin Texture.ColR := ColR; Texture.ColG := ColG; Texture.ColB := ColB; @@ -181,7 +186,9 @@ begin TextOpt[I].Int := STInt; end;} - end else begin + end + else + begin Texture.ColR := DColR; Texture.ColG := DColG; Texture.ColB := DColB; @@ -208,12 +215,13 @@ end; procedure TSelectSlide.SetSelectOpt(Value: integer); var - SO: integer; - HalfL: integer; - HalfR: integer; + SO: integer; + HalfL: integer; + HalfR: integer; -procedure DoSelection(Sel: Cardinal); - var I: Integer; +procedure DoSelection(Sel: cardinal); + var + I: integer; begin for I := low(TextOpt) to high(TextOpt) do begin @@ -244,7 +252,7 @@ begin for SO := low (TextOpt) to high(TextOpt) do begin - TextOpt[SO].Text := TextOptT[SO]; + TextOpt[SO].Text := TextOptT[SO]; end; DoSelection(0); @@ -255,50 +263,50 @@ begin for SO := high(TextOpt) downto low (TextOpt) do begin - TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; end; DoSelection(Lines-1); end else begin - HalfL := Ceil((Lines-1)/2); - HalfR := Lines-1-HalfL; - - if (Value <= HalfL) then - begin //Selected Option is near to the left side - {HalfL := Value; - HalfR := Lines-1-HalfL;} - //Change Texts - for SO := low (TextOpt) to high(TextOpt) do + HalfL := Ceil((Lines-1)/2); + HalfR := Lines-1-HalfL; + + if (Value <= HalfL) then + begin //Selected Option is near to the left side + {HalfL := Value; + HalfR := Lines-1-HalfL;} + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[SO]; + end; + + DoSelection(Value); + end + else if (Value > High(TextOptT)-HalfR) then + begin //Selected is too near to the right border + HalfR := high(TextOptT) - Value; + HalfL := Lines-1-HalfR; + //Change Texts + for SO := high(TextOpt) downto low (TextOpt) do + begin + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + end; + + DoSelection (HalfL); + end + else begin - TextOpt[SO].Text := TextOptT[SO]; - end; + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; + end; - DoSelection(Value); - end - else if (Value > High(TextOptT)-HalfR) then - begin //Selected is too near to the right border - HalfR := high(TextOptT) - Value; - HalfL := Lines-1-HalfR; - //Change Texts - for SO := high(TextOpt) downto low (TextOpt) do - begin - TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + DoSelection(HalfL); end; - DoSelection (HalfL); - end - else - begin - //Change Texts - for SO := low (TextOpt) to high(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; - end; - - DoSelection(HalfL); - end; - end; end; @@ -307,7 +315,7 @@ end; procedure TSelectSlide.Draw; var - SO: integer; + SO: integer; begin if Visible then begin @@ -323,8 +331,8 @@ end; procedure TSelectSlide.GenLines; var -maxlength: Real; -I: Integer; + maxlength: real; + I: integer; begin SetFontStyle(0{Text.Style}); SetFontSize(Text.Size); @@ -344,37 +352,37 @@ begin Lines := 1; //Free old Space used by Texts - For I := low(TextOpt) to high(TextOpt) do + for I := low(TextOpt) to high(TextOpt) do TextOpt[I].Free; setLength (TextOpt, Lines); - for I := low(TextOpt) to high(TextOpt) do - begin - TextOpt[I] := TText.Create; - TextOpt[I].Size := Text.Size; - //TextOpt[I].Align := 1; - TextOpt[I].Align := 0; - TextOpt[I].Visible := True; - - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - - //Generate Positions - //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); - if (I <> High(TextOpt)) OR (High(TextOpt) = 0) OR (Length(TextOptT) = Lines) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I - else - TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; + for I := low(TextOpt) to high(TextOpt) do + begin + TextOpt[I] := TText.Create; + TextOpt[I].Size := Text.Size; + //TextOpt[I].Align := 1; + TextOpt[I].Align := 0; + TextOpt[I].Visible := true; + + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + + //Generate Positions + //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); + if (I <> High(TextOpt)) OR (High(TextOpt) = 0) OR (Length(TextOptT) = Lines) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I + else + TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; - TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H - Text.Size) / 2; + TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H - Text.Size) / 2; - //Better Look with 2 Options - if (Lines=2) AND (Length(TextOptT)= 2) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I; - end; + //Better Look with 2 Options + if (Lines=2) AND (Length(TextOptT)= 2) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I; + end; end; end. diff --git a/src/menu/UMenuStatic.pas b/src/menu/UMenuStatic.pas index 9a10fade..72f4eb36 100644 --- a/src/menu/UMenuStatic.pas +++ b/src/menu/UMenuStatic.pas @@ -40,19 +40,20 @@ uses type TStatic = class public - Texture: TTexture; // Button Screen position and size - Visible: boolean; + Texture: TTexture; // Button Screen position and size + Visible: boolean; //Reflection Mod - Reflection: boolean; - Reflectionspacing: Real; + Reflection: boolean; + Reflectionspacing: real; procedure Draw; constructor Create(Textura: TTexture); overload; end; implementation -uses UDrawTexture; +uses + UDrawTexture; procedure TStatic.Draw; begin |