aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-06-04 21:31:23 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-06-04 21:31:23 +0000
commit133f0b4ebcc3b731e680a72ced52d00638791bf7 (patch)
treef1d1fa58f4c1660ef9b8cc61d8be5a76326a6510 /src
parentd57509c0c5cbd154bde26be993bd2bb9324d89d6 (diff)
downloadusdx-133f0b4ebcc3b731e680a72ced52d00638791bf7.tar.gz
usdx-133f0b4ebcc3b731e680a72ced52d00638791bf7.tar.xz
usdx-133f0b4ebcc3b731e680a72ced52d00638791bf7.zip
cosmetics
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1800 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src')
-rw-r--r--src/base/UMain.pas22
-rw-r--r--src/base/USingScores.pas2
-rw-r--r--src/base/UThemes.pas8
-rw-r--r--src/base/UTime.pas28
-rw-r--r--src/menu/UDisplay.pas76
-rw-r--r--src/menu/UMenu.pas239
-rw-r--r--src/menu/UMenuSelectSlide.pas75
-rw-r--r--src/menu/UMenuText.pas152
-rw-r--r--src/screens/UScreenOptionsGame.pas35
-rw-r--r--src/screens/UScreenSong.pas46
-rw-r--r--src/screens/UScreenTop5.pas35
11 files changed, 393 insertions, 325 deletions
diff --git a/src/base/UMain.pas b/src/base/UMain.pas
index 3900c877..275510fc 100644
--- a/src/base/UMain.pas
+++ b/src/base/UMain.pas
@@ -359,9 +359,11 @@ begin
CountMidTime;
Delay := Floor(1000 / MAX_FPS - 1000 * TimeMid);
+ Log.LogError ('MainLoop', 'Delay: ' + intToStr(Delay));
if Delay >= 1 then
SDL_Delay(Delay); // dynamic, maximum is 100 fps
+ Log.LogError ('MainLoop', 'Delay: ok ' + intToStr(Delay));
CountSkipTime;
@@ -386,15 +388,15 @@ begin
begin
Display.Fade := 0;
Display.NextScreenWithCheck := nil;
- Display.CheckOK := True;
+ Display.CheckOK := true;
end;
end;
procedure CheckEvents;
var
- Event: TSDL_event;
- mouseDown: Boolean;
- mouseBtn: Integer;
+ Event: TSDL_event;
+ mouseDown: boolean;
+ mouseBtn: integer;
begin
if Assigned(Display.NextScreen) then
Exit;
@@ -416,18 +418,18 @@ begin
case Event.type_ of
SDL_MOUSEMOTION:
begin
- mouseDown := False;
- mouseBtn := 0;
+ mouseDown := false;
+ mouseBtn := 0;
end;
SDL_MOUSEBUTTONDOWN:
begin
- mouseDown := True;
- mouseBtn := Event.button.button;
+ mouseDown := true;
+ mouseBtn := Event.button.button;
end;
SDL_MOUSEBUTTONUP:
begin
- mouseDown := False;
- mouseBtn := Event.button.button;
+ mouseDown := false;
+ mouseBtn := Event.button.button;
end;
end;
diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas
index 32b63197..499e1188 100644
--- a/src/base/USingScores.pas
+++ b/src/base/USingScores.pas
@@ -530,7 +530,7 @@ var
Result := 0;
bPlayerCount := 1 shl (bPlayerCount - 1);
- for I := 0 to PositionCount-1 do
+ for I := 0 to PositionCount - 1 do
begin
if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then
Inc(Result);
diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas
index 832e17d9..3fd77853 100644
--- a/src/base/UThemes.pas
+++ b/src/base/UThemes.pas
@@ -42,13 +42,13 @@ uses
type
TRGB = record
- R: single;
- G: single;
- B: single;
+ R: single;
+ G: single;
+ B: single;
end;
TRGBA = record
- R, G, B, A: Double;
+ R, G, B, A: double;
end;
type
diff --git a/src/base/UTime.pas b/src/base/UTime.pas
index 3f35dffd..83844cb5 100644
--- a/src/base/UTime.pas
+++ b/src/base/UTime.pas
@@ -61,20 +61,20 @@ procedure CountSkipTime;
procedure CountMidTime;
var
- USTime : TTime;
+ USTime: TTime;
VideoBGTimer: TRelativeTimer;
- TimeNew : int64;
- TimeOld : int64;
- TimeSkip : real;
- TimeMid : real;
- TimeMidTemp : int64;
+ TimeNew: int64;
+ TimeOld: int64;
+ TimeSkip: real;
+ TimeMid: real;
+ TimeMidTemp: int64;
implementation
uses
sdl,
- ucommon;
+ UCommon;
const
cSDLCorrectionRatio = 1000;
@@ -91,14 +91,14 @@ http://www.gamedev.net/community/forums/topic.asp?topic_id=466145&whichpage=1%EE
procedure CountSkipTimeSet;
begin
- TimeNew := SDL_GetTicks();
+ TimeNew := SDL_GetTicks();
end;
procedure CountSkipTime;
begin
- TimeOld := TimeNew;
- TimeNew := SDL_GetTicks();
- TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
+ TimeOld := TimeNew;
+ TimeNew := SDL_GetTicks();
+ TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
end;
procedure CountMidTime;
@@ -127,10 +127,10 @@ end;
**}
(*
- * Creates a new timer.
- * If TriggerMode is false (default), the timer
+ * creates a new timer.
+ * if triggermode is false (default), the timer
* will immediately begin with counting.
- * If TriggerMode is true, it will wait until Get/SetTime() or Pause() is called
+ * if triggermode is true, it will wait until get/settime() or pause() is called
* for the first time.
*)
constructor TRelativeTimer.Create(TriggerMode: boolean);
diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas
index e4e2839d..f2eb2ced 100644
--- a/src/menu/UDisplay.pas
+++ b/src/menu/UDisplay.pas
@@ -45,7 +45,7 @@ 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.)
@@ -61,15 +61,15 @@ type
OSD_LastError: string;
{ software cursor data }
- Cursor_X: Double;
- Cursor_Y: Double;
- Cursor_Pressed: Boolean;
- Cursor_HiddenByScreen: Boolean; // hides software cursor and deactivate auto fade in
+ Cursor_X: double;
+ Cursor_Y: double;
+ Cursor_Pressed: boolean;
+ Cursor_HiddenByScreen: boolean; // hides software cursor and deactivate auto fade in
// used for cursor fade out when there is no movement
- Cursor_Visible: Boolean;
- Cursor_LastMove: Cardinal;
- Cursor_Fade: Boolean;
+ Cursor_Visible: boolean;
+ Cursor_LastMove: cardinal;
+ Cursor_Fade: boolean;
procedure DrawDebugInformation;
public
@@ -94,7 +94,7 @@ type
procedure SetCursor;
{ called when cursor moves, positioning of software cursor }
- procedure MoveCursor(X, Y: Double; Pressed: Boolean);
+ procedure MoveCursor(X, Y: double; Pressed: boolean);
{ draws software cursor }
@@ -102,7 +102,7 @@ type
end;
var
- Display: TDisplay;
+ Display: TDisplay;
const
{ constants for software cursor effects
@@ -138,9 +138,9 @@ begin
BlackScreen := false;
// fade mod
- FadeState := 0;
+ FadeState := 0;
FadeEnabled := (Ini.ScreenFade = 1);
- FadeFailed:= false;
+ FadeFailed := false;
glGenTextures(2, @FadeTex);
@@ -350,8 +350,8 @@ end;
{ sets SDL_ShowCursor depending on options set in Ini }
procedure TDisplay.SetCursor;
- var
- Cursor: Integer;
+var
+ Cursor: Integer;
begin
Cursor := 0;
@@ -393,11 +393,12 @@ begin
end;
{ called when cursor moves, positioning of software cursor }
-procedure TDisplay.MoveCursor(X, Y: Double; Pressed: Boolean);
+procedure TDisplay.MoveCursor(X, Y: double; Pressed: boolean);
var
- Ticks: Cardinal;
+ Ticks: cardinal;
begin
- if (Ini.Mouse = 2) and ((X <> Cursor_X) or (Y <> Cursor_Y) or (Pressed <> Cursor_Pressed)) then
+ if (Ini.Mouse = 2) and
+ ((X <> Cursor_X) or (Y <> Cursor_Y) or (Pressed <> Cursor_Pressed)) then
begin
Cursor_X := X;
Cursor_Y := Y;
@@ -408,13 +409,13 @@ begin
{ fade in on movement (or button press) if not first movement }
if (not Cursor_Visible) and (Cursor_LastMove <> 0) then
begin
- if (Cursor_Fade) then // we use a trick here to consider progress of fade out
+ if Cursor_Fade then // we use a trick here to consider progress of fade out
Cursor_LastMove := Ticks - round(Cursor_FadeIn_Time * (1 - (Ticks - Cursor_LastMove)/Cursor_FadeOut_Time))
else
Cursor_LastMove := Ticks;
- Cursor_Visible := True;
- Cursor_Fade := True;
+ Cursor_Visible := true;
+ Cursor_Fade := true;
end
else if not Cursor_Fade then
begin
@@ -425,9 +426,9 @@ end;
{ draws software cursor }
procedure TDisplay.DrawCursor;
- var
- Alpha: Single;
- Ticks: Cardinal;
+var
+ Alpha: single;
+ Ticks: cardinal;
begin
if (Ini.Mouse = 2) then
begin // draw software cursor
@@ -435,25 +436,25 @@ begin
if (Cursor_Visible) and (Cursor_LastMove + Cursor_AutoHide_Time <= Ticks) then
begin // start fade out after 5 secs w/o activity
- Cursor_Visible := False;
+ Cursor_Visible := false;
Cursor_LastMove := Ticks;
- Cursor_Fade := True;
+ Cursor_Fade := true;
end;
// fading
- if (Cursor_Fade) then
+ if Cursor_Fade then
begin
- if (Cursor_Visible) then
+ if Cursor_Visible then
begin // fade in
if (Cursor_LastMove + Cursor_FadeIn_Time <= Ticks) then
- Cursor_Fade := False
+ Cursor_Fade := false
else
Alpha := sin((Ticks - Cursor_LastMove) * 0.5 * pi / Cursor_FadeIn_Time) * 0.7;
end
else
begin //fade out
if (Cursor_LastMove + Cursor_FadeOut_Time <= Ticks) then
- Cursor_Fade := False
+ Cursor_Fade := false
else
Alpha := cos((Ticks - Cursor_LastMove) * 0.5 * pi / Cursor_FadeOut_Time) * 0.7;
end;
@@ -552,10 +553,11 @@ begin
end;
//------------
-// DrawDebugInformation - Procedure draw FPS and some other Informations on Screen
+// 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
glEnable(GL_BLEND);
@@ -569,13 +571,13 @@ begin
glEnd;
glDisable(GL_BLEND);
-// Set Font Specs
+// set font specs
SetFontStyle(0);
SetFontSize(21);
SetFontItalic(false);
glColor4f(0, 0, 0, 1);
-// Calculate FPS
+// calculate fps
Ticks := SDL_GetTicks();
if (Ticks >= NextFPSSwap) then
begin
@@ -586,17 +588,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 7d8bdce8..a3f47b3d 100644
--- a/src/menu/UMenu.pas
+++ b/src/menu/UMenu.pas
@@ -34,20 +34,20 @@ interface
{$I switches.inc}
uses
+ SysUtils,
+ Math,
gl,
SDL,
- SysUtils,
- UTexture,
- UMenuStatic,
- UMenuText,
- UMenuButton,
- UMenuSelectSlide,
- UMenuInteract,
UMenuBackground,
- UThemes,
+ UMenuButton,
UMenuButtonCollection,
- Math,
- UMusic;
+ UMenuInteract,
+ UMenuSelectSlide,
+ UMenuStatic,
+ UMenuText,
+ UMusic,
+ UTexture,
+ UThemes;
type
{ Int16 = SmallInt;}
@@ -87,7 +87,7 @@ type
procedure SetInteraction(Num: integer); virtual;
property Interaction: integer read SelInteraction write SetInteraction;
- //Procedure Load BG, Texts, Statics and Button Collections from ThemeBasic
+ // procedure load bg, texts, statics and button collections from themebasic
procedure LoadFromTheme(const ThemeBasic: TThemeBasic);
procedure PrepareButtonCollections(const Collections: AThemeButtonCollection);
@@ -147,10 +147,10 @@ type
function DrawFG: boolean; virtual;
function Draw: boolean; virtual;
function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown : boolean): boolean; virtual;
- function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; virtual;
- function InRegion(X1, Y1, W, H, X, Y: real): Boolean;
- function InteractAt(X, Y: real): Integer;
- function CollectionAt(X, Y: real): Integer;
+ function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; virtual;
+ function InRegion(X1, Y1, W, H, X, Y: real): boolean;
+ function InteractAt(X, Y: real): integer;
+ function CollectionAt(X, Y: real): integer;
procedure onShow; virtual;
procedure onShowFinish; virtual;
procedure onHide; virtual;
@@ -171,10 +171,10 @@ type
const
MENU_MDOWN = 8;
- MENU_MUP = 0;
+ MENU_MUP = 0;
- pmMove = 1;
- pmClick = 2;
+ pmMove = 1;
+ pmClick = 2;
pmUnClick = 3;
iButton = 0; // interaction type
@@ -189,14 +189,14 @@ implementation
uses
UCommon,
- ULog,
- UMain,
+ UCovers,
+ UDisplay,
UDrawTexture,
UGraphic,
- UDisplay,
- UCovers,
- UTime,
+ ULog,
+ UMain,
USkins,
+ UTime,
//Background types
UMenuBackgroundNone,
UMenuBackgroundColor,
@@ -228,7 +228,7 @@ begin
Background := nil;
- RightMbESC := True;
+ RightMbESC := true;
end;
{
constructor TMenu.Create(Back: string);
@@ -260,7 +260,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
@@ -299,8 +299,8 @@ begin
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
+ // 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;
@@ -604,17 +604,25 @@ begin
Result := AddStatic(X, Y, W, H, Name, TEXTURE_TYPE_PLAIN);
end;
-function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType): integer;
+function TMenu.AddStatic(X, Y, W, H: real;
+ ColR, ColG, ColB: real;
+ const Name: string;
+ Typ: TTextureType): integer;
begin
Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Typ, $FFFFFF);
end;
-function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType): integer;
+function TMenu.AddStatic(X, Y, W, H, Z: real;
+ ColR, ColG, ColB: real;
+ const Name: string;
+ Typ: TTextureType): integer;
begin
Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Typ, $FFFFFF);
end;
-function TMenu.AddStatic(X, Y, W, H: real; const Name: string; Typ: TTextureType): integer;
+function TMenu.AddStatic(X, Y, W, H: real;
+ const Name: string;
+ Typ: TTextureType): integer;
var
StatNum: integer;
begin
@@ -632,17 +640,32 @@ begin
Result := StatNum;
end;
-function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer;
+function TMenu.AddStatic(X, Y, W, H: real;
+ ColR, ColG, ColB: real;
+ const Name: string;
+ Typ: TTextureType;
+ Color: integer): integer;
begin
Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Typ, Color);
end;
-function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer;
+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);
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;
begin
@@ -714,12 +737,22 @@ begin
Result := TextNum;
end;
-function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: string): integer;
+function TMenu.AddText(X, Y: real;
+ Style: integer;
+ Size, ColR, ColG, ColB: real
+ ; const Text: string): integer;
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;
begin
@@ -789,10 +822,10 @@ begin
ThemeButton.Text[BT].Text);
end;
- //BAutton Collection Mod
+ // bautton collection mod
if (ThemeButton.Parent <> 0) then
begin
- //If Collection Exists then Change Interaction to Child Button
+ // if collection exists then change interaction to child button
if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then
begin
Interactions[High(Interactions)].Typ := iBCollectionChild;
@@ -821,8 +854,10 @@ begin
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
@@ -875,7 +910,7 @@ begin
Button[Result].Reflectionspacing := ReflectionSpacing;
Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing;
- //Button Collection Mod
+ // button collection mod
Button[Result].Parent := 0;
// adds interaction
@@ -888,11 +923,10 @@ begin
Setlength(Button, 0);
end;
-// Method to draw our TMenu and all his child buttons
+// method to draw our tmenu and all his child buttons
function TMenu.DrawBG: boolean;
begin
Background.Draw;
-
Result := true;
end;
@@ -1011,9 +1045,10 @@ begin
Int := Int - ceil(Length(Interactions) / 2);
//Set Interaction
- if ((Int < 0) or (Int > Length(Interactions) - 1))
- then Int := Interaction //nonvalid button, keep current one
- else Interaction := Int; //select row above
+ if ((Int < 0) or (Int > Length(Interactions) - 1)) then
+ Int := Interaction // invalid button, keep current one
+ else
+ Interaction := Int; // select row above
end;
procedure TMenu.InteractNextRow;
@@ -1025,9 +1060,10 @@ begin
Int := Int + ceil(Length(Interactions) / 2);
//Set Interaction
- if ((Int < 0) or (Int > Length(Interactions) - 1))
- then Int := Interaction //nonvalid button, keep current one
- else Interaction := Int; //select row above
+ if ((Int < 0) or (Int > Length(Interactions) - 1)) then
+ Int := Interaction // invalid button, keep current one
+ else
+ Interaction := Int; // select row above
end;
procedure TMenu.InteractNext;
@@ -1041,7 +1077,8 @@ begin
Int := (Int + 1) mod Length(Interactions);
//If no Interaction is Selectable Simply Select Next
- if (Int = Interaction) then Break;
+ if (Int = Interaction) then
+ Break;
until IsSelectable(Int);
@@ -1058,10 +1095,12 @@ begin
// change interaction as long as it's needed
repeat
Int := Int - 1;
- if Int = -1 then Int := High(Interactions);
+ if Int = -1 then
+ Int := High(Interactions);
//If no Interaction is Selectable Simply Select Next
- if (Int = Interaction) then Break;
+ if (Int = Interaction) then
+ Break;
until IsSelectable(Int);
//Set Interaction
@@ -1086,7 +1125,8 @@ begin
while (Again = true) do
begin
Num := SelInteraction - CustomSwitch;
- if Num = -1 then Num := High(Interactions);
+ if Num = -1 then
+ Num := High(Interactions);
Interaction := Num;
Again := false; // reset, default to accept changing interaction
@@ -1387,10 +1427,12 @@ begin
SetLength(SelectsS[SelectNo].TextOptT, SO + 1);
SelectsS[SelectNo].TextOptT[SO] := AddText;
+{
+ SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh
- //SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh
-
- //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO;
+ if SO = Selects[S].PData^ then
+ Selects[S].SelectedOption := SO;
+}
end;
procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer);
@@ -1490,11 +1532,11 @@ begin
end;
end;
end;
- //interact Prev if there is Nothing to Change
+ // interact prev if there is nothing to change
else
begin
InteractPrev;
- //If ButtonCollection with more than 1 Entry then Select Last Entry
+ // 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
begin
//Select Last Child
@@ -1603,43 +1645,51 @@ begin
Result := true;
end;
-function TMenu.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean;
+function TMenu.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean;
var
- nBut: Integer;
+ nBut: integer;
begin
//default mouse parsing: clicking generates return keypress,
// mousewheel selects in select slide
//override ParseMouse to customize
Result := true;
- if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then begin
+ if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then
+ begin
//if RightMbESC is set, send ESC keypress
- Result:=ParseInput(SDLK_ESCAPE, #0, True);
+ Result:=ParseInput(SDLK_ESCAPE, #0, true);
end;
nBut := InteractAt(X, Y);
- if nBut >= 0 then begin
+ if nBut >= 0 then
+ begin
//select on mouse-over
if nBut <> Interaction then
SetInteraction(nBut);
- if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin
+ if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then
+ begin
//click button
- Result:=ParseInput(SDLK_RETURN, #0, True);
+ Result:=ParseInput(SDLK_RETURN, #0, true);
end;
- if (Interactions[nBut].Typ = iSelectS) then begin
+ if (Interactions[nBut].Typ = iSelectS) then
+ begin
//forward/backward in select slide with mousewheel
- if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then begin
+ if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then
+ begin
ParseInput(SDLK_RIGHT, #0, true);
end;
- if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then begin
+ if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then
+ begin
ParseInput(SDLK_LEFT, #0, true);
end;
end;
end
- else begin
+ else
+ begin
nBut := CollectionAt(X, Y);
- if nBut >= 0 then begin
- //if over button collection, select first child but don't allow click
+ if nBut >= 0 then
+ begin
+ // if over button collection, select first child but don't allow click
nBut := ButtonCollection[nBut].FirstChild - 1;
if nBut <> Interaction then
SetInteraction(nBut);
@@ -1647,37 +1697,41 @@ begin
end;
end;
-function TMenu.InRegion(X1, Y1, W, H, X, Y: real): Boolean;
+function TMenu.InRegion(X1, Y1, W, H, X, Y: real): boolean;
begin
- Result:=False;
- X1 := X1 * Screen.w/800;
- W := W * Screen.w/800;
- Y1 := Y1 * Screen.h/600;
- H := H * Screen.h/600;
- if (X >= X1) and (X <= X1+W) and (Y >= Y1) and (Y <= Y1+H) then
+ Result := false;
+ X1 := X1 * Screen.w / 800;
+ W := W * Screen.w / 800;
+ Y1 := Y1 * Screen.h / 600;
+ H := H * Screen.h / 600;
+ if (X >= X1) and (X <= X1 + W) and (Y >= Y1) and (Y <= Y1 + H) then
Result := true;
end;
//takes x,y coordinates and returns the interaction number
//of the control at this position
-function TMenu.InteractAt(X, Y: real): Integer;
+function TMenu.InteractAt(X, Y: real): integer;
var
- i, nBut: Integer;
+ i, nBut: integer;
begin
- Result:=-1;
- for i:=Low(Interactions) to High(Interactions) do begin
+ Result := -1;
+ for i := Low(Interactions) to High(Interactions) do
+ begin
case Interactions[i].Typ of
- iButton:if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) and
- Button[Interactions[i].Num].Visible then begin
+ iButton: if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) and
+ Button[Interactions[i].Num].Visible then
+ begin
Result:=i;
exit;
end;
- iBCollectionChild:if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) then begin
+ iBCollectionChild: if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) then
+ begin
Result:=i;
exit;
end;
- iSelectS:if InRegion(SelectSs[Interactions[i].Num].X, SelectSs[Interactions[i].Num].Y, SelectSs[Interactions[i].Num].W, SelectSs[Interactions[i].Num].H, X, Y) or
- InRegion(SelectSs[Interactions[i].Num].TextureSBG.X, SelectSs[Interactions[i].Num].TextureSBG.Y, SelectSs[Interactions[i].Num].TextureSBG.W, SelectSs[Interactions[i].Num].TextureSBG.H, X, Y) then begin
+ iSelectS: if InRegion(SelectSs[Interactions[i].Num].X, SelectSs[Interactions[i].Num].Y, SelectSs[Interactions[i].Num].W, SelectSs[Interactions[i].Num].H, X, Y) or
+ InRegion(SelectSs[Interactions[i].Num].TextureSBG.X, SelectSs[Interactions[i].Num].TextureSBG.Y, SelectSs[Interactions[i].Num].TextureSBG.W, SelectSs[Interactions[i].Num].TextureSBG.H, X, Y) then
+ begin
Result:=i;
exit;
end;
@@ -1686,14 +1740,16 @@ begin
end;
//takes x,y coordinates and returns the button collection id
-function TMenu.CollectionAt(X, Y: real): Integer;
+function TMenu.CollectionAt(X, Y: real): integer;
var
- i, nBut: Integer;
+ i, nBut: integer;
begin
- Result:=-1;
- for i:=Low(ButtonCollection) to High(ButtonCollection) do begin
+ Result := -1;
+ for i:= Low(ButtonCollection) to High(ButtonCollection) do
+ begin
if InRegion(ButtonCollection[i].X, ButtonCollection[i].Y, ButtonCollection[i].W, ButtonCollection[i].H, X, Y) and
- ButtonCollection[i].Visible then begin
+ ButtonCollection[i].Visible then
+ begin
Result:=i;
exit;
end;
@@ -1706,4 +1762,3 @@ begin
end;
end.
-
diff --git a/src/menu/UMenuSelectSlide.pas b/src/menu/UMenuSelectSlide.pas
index a5929a3e..f9f6bbae 100644
--- a/src/menu/UMenuSelectSlide.pas
+++ b/src/menu/UMenuSelectSlide.pas
@@ -34,10 +34,10 @@ interface
{$I switches.inc}
uses
- TextGL,
- UTexture,
gl,
- UMenuText;
+ TextGL,
+ UMenuText,
+ UTexture;
type
PSelectSlide = ^TSelectSlide;
@@ -64,10 +64,10 @@ type
Lines: byte;
//Arrows on/off
- showArrows: Boolean; //default is false
+ showArrows: boolean; //default is false
//whether to show one item or all that fit into the select
- oneItemOnly:Boolean; //default is false
+ oneItemOnly: boolean; //default is false
//Visibility
Visible: boolean;
@@ -138,11 +138,12 @@ type
end;
implementation
+
uses
- UDrawTexture,
math,
- ULog,
- SysUtils;
+ SysUtils,
+ UDrawTexture,
+ ULog;
// ------------ Select
constructor TSelectSlide.Create;
@@ -206,7 +207,7 @@ var
var
I: integer;
begin
- for I := low(TextOpt) to high(TextOpt) do
+ for I := Low(TextOpt) to High(TextOpt) do
begin
TextOpt[I].ColR := STDColR;
TextOpt[I].ColG := STDColG;
@@ -214,7 +215,7 @@ var
TextOpt[I].Int := STDInt;
end;
- if (integer(Sel) <= high(TextOpt)) then
+ if (integer(Sel) <= High(TextOpt)) then
begin
TextOpt[Sel].ColR := STColR;
TextOpt[Sel].ColG := STColG;
@@ -227,7 +228,7 @@ begin
SelectOptInt := Value;
PData^ := Value;
- if (Length(TextOpt)>0) AND (Length(TextOptT)>0) then
+ if (Length(TextOpt) > 0) and (Length(TextOptT) > 0) then
begin
//First option selected
@@ -238,7 +239,7 @@ begin
Tex_SelectS_ArrowL.alpha := 0;
Tex_SelectS_ArrowR.alpha := 1;
- for SO := low(TextOpt) to high(TextOpt) do
+ for SO := Low(TextOpt) to High(TextOpt) do
begin
TextOpt[SO].Text := TextOptT[SO];
end;
@@ -247,18 +248,18 @@ begin
end
//Last option selected
- else if (Value >= high(TextOptT)) then
+ else if (Value >= High(TextOptT)) then
begin
- Value := high(TextOptT);
+ Value := High(TextOptT);
Tex_SelectS_ArrowL.alpha := 1;
Tex_SelectS_ArrowR.alpha := 0;
- for SO := high(TextOpt) downto low (TextOpt) do
+ 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);
+ DoSelection(Lines - 1);
end
//in between first and last
@@ -267,14 +268,14 @@ begin
Tex_SelectS_ArrowL.alpha := 1;
Tex_SelectS_ArrowR.alpha := 1;
- HalfL := Ceil((Lines-1)/2);
- HalfR := Lines-1-HalfL;
+ HalfL := Ceil((Lines - 1) / 2);
+ HalfR := Lines - 1 - HalfL;
//Selected option is near to the left side
if (Value <= HalfL) then
begin
//Change texts
- for SO := low (TextOpt) to high(TextOpt) do
+ for SO := Low(TextOpt) to High(TextOpt) do
begin
TextOpt[SO].Text := TextOptT[SO];
end;
@@ -283,25 +284,25 @@ begin
end
//Selected option is near to the right side
- else if (Value > High(TextOptT)-HalfR) then
+ else if (Value > High(TextOptT) - HalfR) then
begin
- HalfR := high(TextOptT) - Value;
- HalfL := Lines-1-HalfR;
+ HalfR := High(TextOptT) - Value;
+ HalfL := Lines - 1 - HalfR;
//Change texts
- for SO := high(TextOpt) downto low (TextOpt) do
+ 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 (HalfL);
+ DoSelection (HalfL);
end
else
begin
//Change Texts
- for SO := low (TextOpt) to high(TextOpt) do
+ for SO := Low(TextOpt) to High(TextOpt) do
begin
- TextOpt[SO].Text := TextOptT[Value - HalfL + SO];
+ TextOpt[SO].Text := TextOptT[Value - HalfL + SO];
end;
DoSelection(HalfL);
@@ -319,7 +320,7 @@ begin
DrawTexture(Texture);
DrawTexture(TextureSBG);
- if (showArrows) then
+ if showArrows then
begin
DrawTexture(Tex_SelectS_ArrowL);
DrawTexture(Tex_SelectS_ArrowR);
@@ -327,7 +328,7 @@ begin
Text.Draw;
- for SO := low(TextOpt) to high(TextOpt) do
+ for SO := Low(TextOpt) to High(TextOpt) do
TextOpt[SO].Draw;
end;
end;
@@ -341,14 +342,14 @@ begin
SetFontSize(Text.Size);
maxlength := 0;
- for I := low(TextOptT) to high (TextOptT) do
+ for I := Low(TextOptT) to High(TextOptT) do
begin
if (glTextWidth(TextOptT[I]) > maxlength) then
maxlength := glTextWidth(TextOptT[I]);
end;
- if(oneItemOnly = false) then
+ if (oneItemOnly = false) then
begin
//show all items
Lines := floor((TextureSBG.W-40) / (maxlength+7));
@@ -365,12 +366,12 @@ begin
end;
//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
+ for I := Low(TextOpt) to High(TextOpt) do
begin
TextOpt[I] := TText.Create;
TextOpt[I].Size := Text.Size;
@@ -385,7 +386,7 @@ begin
//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
+ 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;
@@ -393,10 +394,10 @@ begin
TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H - Text.Size) / 2;
//Better Look with 2 Options
- if (Lines=2) AND (Length(TextOptT)= 2) then
+ if (Lines = 2) and (Length(TextOptT) = 2) then
TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I;
- if (Lines=1) then
+ if (Lines = 1) then
begin
TextOpt[I].Align := 1; //center text
TextOpt[I].X := TextureSBG.X + (TextureSBG.W / 2);
diff --git a/src/menu/UMenuText.pas b/src/menu/UMenuText.pas
index b000cc73..b5507327 100644
--- a/src/menu/UMenuText.pas
+++ b/src/menu/UMenuText.pas
@@ -34,29 +34,29 @@ interface
{$I switches.inc}
uses
- TextGL,
- UTexture,
- gl,
math,
SysUtils,
- SDL;
+ gl,
+ SDL,
+ TextGL,
+ UTexture;
type
TText = class
private
- SelectBool: boolean;
- TextString: string;
- TextTiles: array of string;
+ SelectBool: boolean;
+ TextString: string;
+ TextTiles: array of string;
- STicks: cardinal;
- SelectBlink: boolean;
+ STicks: cardinal;
+ SelectBlink: boolean;
public
X: real;
Y: real;
Z: real;
- MoveX: real; //Some Modifier for X - Position that don't affect the real Y
- MoveY: real; //Some Modifier for Y - Position that don't affect the real Y
- W: real; //text wider than W is broken
+ MoveX: real; // some modifier for x - position that don't affect the real Y
+ MoveY: real; // some modifier for y - position that don't affect the real Y
+ W: real; // text wider than W is broken
// H: real;
Size: real;
ColR: real;
@@ -64,13 +64,13 @@ type
ColB: real;
Alpha: real;
Int: real;
- Style: integer;
- Visible: boolean;
- Align: integer; // 0 = left, 1 = center, 2 = right
+ Style: integer;
+ Visible: boolean;
+ Align: integer; // 0 = left, 1 = center, 2 = right
- //Reflection
- Reflection: boolean;
- ReflectionSpacing: real;
+ // reflection
+ Reflection: boolean;
+ ReflectionSpacing: real;
procedure SetSelect(Value: boolean);
property Selected: boolean read SelectBool write SetSelect;
@@ -78,7 +78,7 @@ type
procedure SetText(Value: string);
property Text: string read TextString write SetText;
- procedure DeleteLastL; //Procedure to Delete Last Letter
+ procedure DeleteLastL; // procedure to delete last letter
procedure Draw;
constructor Create; overload;
@@ -88,26 +88,27 @@ type
implementation
-uses UGraphic,
- StrUtils;
+uses
+ StrUtils,
+ UGraphic;
procedure TText.SetSelect(Value: boolean);
begin
SelectBool := Value;
- //Set Cursor Visible
- SelectBlink := True;
+ // set cursor visible
+ SelectBlink := true;
STicks := SDL_GetTicks() div 550;
end;
procedure TText.SetText(Value: string);
var
- NextPos: cardinal; // NextPos of a Space etc.
- LastPos: cardinal; // LastPos "
- LastBreak: cardinal; // Last Break
- isBreak: boolean; // True if the Break is not Caused because the Text is out of the area
- FirstWord: word; // Is First Word after Break?
- Len: word; // Length of the Tiles Array
+ NextPos: cardinal; // next pos of a space etc.
+ LastPos: cardinal; // last pos "
+ LastBreak: cardinal; // last break
+ isBreak: boolean; // true if the break is not caused because the text is out of the area
+ FirstWord: word; // is first word after break?
+ Len: word; // length of the tiles array
function GetNextPos: boolean;
var
@@ -115,16 +116,16 @@ var
begin
LastPos := NextPos;
- //Next Space (If Width is given)
+ // next space (if width is given)
if (W > 0) then
T1 := PosEx(' ', Value, LastPos + 1)
else
T1 := Length(Value);
- {//Next -
+ {// next -
T2 := PosEx('-', Value, LastPos + 1);}
- //Next Break
+ // next break
T3 := PosEx('\n', Value, LastPos + 1);
if T1 = 0 then
@@ -134,7 +135,7 @@ var
if T3 = 0 then
T3 := Length(Value);
- //Get Nearest Pos
+ // get nearest pos
NextPos := min(T1, T3{min(T2, T3)});
if (LastPos = cardinal(Length(Value))) then
@@ -161,14 +162,14 @@ var
end;
begin
- //Set TExtstring
+ // set TextString
TextString := Value;
- //Set Cursor Visible
- SelectBlink := True;
+ // set cursor visible
+ SelectBlink := true;
STicks := SDL_GetTicks() div 550;
- //Exit if there is no Need to Create Tiles
+ // exit if there is no need to create tiles
if (W <= 0) and (Pos('\n', Value) = 0) then
begin
SetLength (TextTiles, 1);
@@ -176,12 +177,12 @@ begin
Exit;
end;
- //Create Tiles
- //Reset Text Array
+ // create tiles
+ // reset text array
SetLength (TextTiles, 0);
Len := 0;
- //Reset Counter Vars
+ // reset counter vars
LastPos := 1;
NextPos := 1;
LastBreak := 1;
@@ -189,57 +190,57 @@ begin
if (W > 0) then
begin
- //Set Font Properties
+ // set font properties
SetFontStyle(Style);
SetFontSize(Size);
end;
- //go Through Text
+ // go through text
while (GetNextPos) do
begin
- //Break in Text
+ // break in text
if isBreak then
begin
- //Look for Break before the Break
+ // look for break before the break
if (glTextWidth(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
+ isBreak := false;
+ // not the first word after break, so we don't have to break within a word
if (FirstWord > 1) then
begin
- //Add Break before actual Position, because there the Text fits the Area
+ // add break before actual position, because there the text fits the area
AddBreak(LastBreak, LastPos);
end
- else //First Word after Break Break within the Word
+ else // first word after break break within the word
begin
- //ToDo
- //AddBreak(LastBreak, LastBreak + 155);
+ // to do
+ // AddBreak(LastBreak, LastBreak + 155);
end;
end;
- isBreak := True;
- //Add Break from Text
+ isBreak := true;
+ // add break from text
AddBreak(LastBreak, NextPos);
end
- //Text comes out of the Text Area -> CreateBreak
+ // text comes out of the text area -> createbreak
else if (glTextWidth(Copy(Value, LastBreak, NextPos - LastBreak + 1)) > W) then
begin
- //Not the First word after Break, so we don't have to break within a word
+ // not the first word after break, so we don't have to break within a word
if (FirstWord > 1) then
begin
- //Add Break before actual Position, because there the Text fits the Area
+ // add break before actual position, because there the text fits the area
AddBreak(LastBreak, LastPos);
end
- else //First Word after Break -> Break within the Word
+ else // first word after break -> break within the word
begin
- //ToDo
- //AddBreak(LastBreak, LastBreak + 155);
+ // to do
+ // AddBreak(LastBreak, LastBreak + 155);
end;
end;
//end;
Inc(FirstWord)
end;
- //Add Ending
+ // add ending
AddBreak(LastBreak, Length(Value)+1);
end;
@@ -260,35 +261,35 @@ procedure TText.Draw;
var
X2, Y2: real;
Text2: string;
- I: Integer;
- Ticks: Cardinal;
+ I: integer;
+ Ticks: cardinal;
begin
if Visible then
begin
SetFontStyle(Style);
SetFontSize(Size);
- SetFontItalic(False);
+ SetFontItalic(false);
glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha);
- //Reflection
- if Reflection = true then
+ // reflection
+ if Reflection then
SetFontReflection(true, ReflectionSpacing)
else
SetFontReflection(false,0);
- //if selected set blink...
+ // if selected set blink...
if SelectBool then
begin
Ticks := SDL_GetTicks() div 550;
if Ticks <> STicks then
- begin //Change Visability
+ begin // change visability
STicks := Ticks;
SelectBlink := Not SelectBlink;
end;
end;
- {if (False) then //no width set draw as one long string
+ {if (false) then // no width set draw as one long string
begin
if not (SelectBool AND SelectBlink) then
Text2 := Text
@@ -307,8 +308,8 @@ begin
end
else
begin}
- //now use allways:
- //draw text as many strings
+ // now use always:
+ // draw text as many strings
Y2 := Y + MoveY;
for I := 0 to High(TextTiles) do
begin
@@ -353,7 +354,14 @@ begin
Create(X, Y, 0, 0, 30, 0, 0, 0, 0, Text, false, 0, 0);
end;
-constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParText: string; ParReflection: boolean; ParReflectionSpacing: real; ParZ:real);
+constructor TText.Create(ParX, ParY, ParW: real;
+ ParStyle: integer;
+ ParSize, ParColR, ParColG, ParColB: real;
+ ParAlign: integer;
+ ParText: string;
+ ParReflection: boolean;
+ ParReflectionSpacing: real;
+ ParZ: real);
begin
inherited Create;
Alpha := 1;
@@ -371,8 +379,8 @@ begin
Align := ParAlign;
SelectBool := false;
Visible := true;
- Reflection:= ParReflection;
- ReflectionSpacing:= ParReflectionSpacing;
+ Reflection := ParReflection;
+ ReflectionSpacing := ParReflectionSpacing;
end;
end.
diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas
index 3f1cca81..00ff372d 100644
--- a/src/screens/UScreenOptionsGame.pas
+++ b/src/screens/UScreenOptionsGame.pas
@@ -34,14 +34,14 @@ interface
{$I switches.inc}
uses
- UMenu,
SDL,
UDisplay,
- UMusic,
UFiles,
UIni,
- UThemes,
- USongs;
+ UMenu,
+ UMusic,
+ USongs,
+ UThemes;
type
TScreenOptionsGame = class(TMenu)
@@ -56,13 +56,15 @@ type
implementation
uses
- UGraphic,
- SysUtils;
+ SysUtils,
+ UGraphic;
-function TScreenOptionsGame.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean;
+function TScreenOptionsGame.ParseInput(PressedKey: cardinal;
+ CharCode: WideChar;
+ PressedDown: boolean): boolean;
begin
Result := true;
- if (PressedDown) then
+ if PressedDown then
begin // Key Down
// check normal keys
case WideCharUpperCase(CharCode)[1] of
@@ -80,7 +82,6 @@ begin
begin
AudioPlayback.PlaySound(SoundLib.Back);
RefreshSongs;
-
FadeTo(@ScreenOptions);
end;
SDLK_RETURN:
@@ -126,34 +127,34 @@ begin
old_Sorting := Ini.Sorting;
old_Tabs := Ini.Tabs;
- Theme.OptionsGame.SelectPlayers.showArrows := true;
+ Theme.OptionsGame.SelectPlayers.showArrows := true;
Theme.OptionsGame.SelectPlayers.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers);
- Theme.OptionsGame.SelectDifficulty.showArrows := true;
+ Theme.OptionsGame.SelectDifficulty.showArrows := true;
Theme.OptionsGame.SelectDifficulty.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty);
- Theme.OptionsGame.SelectLanguage.showArrows := true;
+ Theme.OptionsGame.SelectLanguage.showArrows := true;
Theme.OptionsGame.SelectLanguage.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage);
- Theme.OptionsGame.SelectTabs.showArrows := true;
+ Theme.OptionsGame.SelectTabs.showArrows := true;
Theme.OptionsGame.SelectTabs.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs);
- Theme.OptionsGame.SelectSorting.showArrows := true;
+ Theme.OptionsGame.SelectSorting.showArrows := true;
Theme.OptionsGame.SelectSorting.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting);
- Theme.OptionsGame.SelectDebug.showArrows := true;
+ Theme.OptionsGame.SelectDebug.showArrows := true;
Theme.OptionsGame.SelectDebug.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug);
AddButton(Theme.OptionsGame.ButtonExit);
- if (Length(Button[0].Text)=0) then
+ if (Length(Button[0].Text) = 0) then
AddButtonText(14, 20, Theme.Options.Description[7]);
end;
@@ -161,7 +162,7 @@ end;
//Refresh Songs Patch
procedure TScreenOptionsGame.RefreshSongs;
begin
-if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then
+ if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then
ScreenSong.Refresh;
end;
diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas
index 5e794891..fa3c836e 100644
--- a/src/screens/UScreenSong.pas
+++ b/src/screens/UScreenSong.pas
@@ -34,22 +34,22 @@ interface
{$I switches.inc}
uses
- UMenu,
- SDL,
- UMusic,
- UFiles,
- UTime,
- UDisplay,
- USongs,
SysUtils,
+ SDL,
UCommon,
- ULog,
- UThemes,
- UTexture,
+ UDisplay,
+ UFiles,
+ UIni,
ULanguage,
+ ULog,
+ UMenu,
+ UMenuEqualizer,
+ UMusic,
USong,
- UIni,
- UMenuEqualizer;
+ USongs,
+ UTexture,
+ UThemes,
+ UTime;
type
TScreenSong = class(TMenu)
@@ -119,7 +119,7 @@ type
procedure SetScroll5;
procedure SetScroll6;
function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override;
- function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override;
+ function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override;
function Draw: boolean; override;
procedure GenerateThumbnails();
procedure onShow; override;
@@ -738,26 +738,24 @@ begin
end; // if (PressedDown)
end;
-function TScreenSong.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean;
+function TScreenSong.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean;
begin
- Result := True;
+ Result := true;
- if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then begin
+ if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then
//if RightMbESC is set, send ESC keypress
- Result:=ParseInput(SDLK_ESCAPE, #0, True);
- end;
+ Result:=ParseInput(SDLK_ESCAPE, #0, true);
//song scrolling with mousewheel
- if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then begin
+ if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then
ParseInput(SDLK_RIGHT, #0, true);
- end;
- if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then begin
+
+ if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then
ParseInput(SDLK_LEFT, #0, true);
- end;
+
//LMB anywhere starts
- if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin
+ if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then
ParseInput(SDLK_RETURN, #0, true);
- end;
end;
constructor TScreenSong.Create;
diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas
index 39de61c3..1013a9b5 100644
--- a/src/screens/UScreenTop5.pas
+++ b/src/screens/UScreenTop5.pas
@@ -57,7 +57,7 @@ type
constructor Create; override;
function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override;
- function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override;
+ function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override;
procedure onShow; override;
function Draw: boolean; override;
end;
@@ -70,10 +70,12 @@ uses
UIni,
UNote;
-function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean;
+function TScreenTop5.ParseInput(PressedKey: cardinal;
+ CharCode: WideChar;
+ PressedDown: boolean): boolean;
begin
Result := true;
- if (PressedDown) then
+ if PressedDown then
begin
// check normal keys
case WideCharUpperCase(CharCode)[1] of
@@ -104,13 +106,14 @@ begin
end;
end;
-function TScreenTop5.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean;
+function TScreenTop5.ParseMouse(MouseButton: integer;
+ BtnDown: boolean;
+ X, Y: integer): boolean;
begin
- Result := True;
- if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin
+ Result := true;
+ if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then
//left-click anywhere sends return
ParseInput(SDLK_RETURN, #0, true);
- end;
end;
constructor TScreenTop5.Create;
@@ -121,18 +124,16 @@ begin
LoadFromTheme(Theme.Top5);
- TextLevel := AddText(Theme.Top5.TextLevel);
+ TextLevel := AddText(Theme.Top5.TextLevel);
TextArtistTitle := AddText(Theme.Top5.TextArtistTitle);
for I := 0 to 4 do
- StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] );
-
- for I := 0 to 4 do
- TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]);
- for I := 0 to 4 do
- TextName[I+1] := AddText(Theme.Top5.TextName[I]);
- for I := 0 to 4 do
- TextScore[I+1] := AddText(Theme.Top5.TextScore[I]);
+ begin
+ StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]);
+ TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]);
+ TextName[I+1] := AddText (Theme.Top5.TextName[I]);
+ TextScore[I+1] := AddText (Theme.Top5.TextScore[I]);
+ end;
end;
@@ -169,7 +170,7 @@ begin
Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score);
end;
- for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do
+ for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do
begin
Static[StaticNumber[I]].Visible := false;
Text[TextNumber[I]].Visible := false;