aboutsummaryrefslogtreecommitdiffstats
path: root/src/Screens/UScreenOptionsGame.pas
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screens/UScreenOptionsGame.pas')
-rw-r--r--src/Screens/UScreenOptionsGame.pas117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/Screens/UScreenOptionsGame.pas b/src/Screens/UScreenOptionsGame.pas
new file mode 100644
index 00000000..2dc8dd7f
--- /dev/null
+++ b/src/Screens/UScreenOptionsGame.pas
@@ -0,0 +1,117 @@
+unit UScreenOptionsGame;
+
+interface
+
+{$I switches.inc}
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs;
+
+type
+ TScreenOptionsGame = class(TMenu)
+ public
+ old_Tabs, old_Sorting: integer;
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ procedure RefreshSongs;
+ end;
+
+implementation
+
+uses UGraphic, SysUtils;
+
+function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ // check normal keys
+ case WideCharUpperCase(CharCode)[1] of
+ 'Q':
+ begin
+ Result := false;
+ Exit;
+ end;
+ end;
+
+ // check special keys
+ case PressedKey of
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ AudioPlayback.PlaySound(SoundLib.Back);
+ RefreshSongs;
+
+ FadeTo(@ScreenOptions);
+ end;
+ SDLK_RETURN:
+ begin
+ if SelInteraction = 6 then begin
+ AudioPlayback.PlaySound(SoundLib.Back);
+ RefreshSongs;
+ FadeTo(@ScreenOptions);
+ end;
+ end;
+ SDLK_DOWN:
+ InteractNext;
+ SDLK_UP :
+ InteractPrev;
+ SDLK_RIGHT:
+ begin
+ if (SelInteraction >= 0) and (SelInteraction <= 5) then
+ begin
+ AudioPlayback.PlaySound(SoundLib.Option);
+ InteractInc;
+ end;
+ end;
+ SDLK_LEFT:
+ begin
+ if (SelInteraction >= 0) and (SelInteraction <= 5) then
+ begin
+ AudioPlayback.PlaySound(SoundLib.Option);
+ InteractDec;
+ end;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenOptionsGame.Create;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.OptionsGame);
+
+ //Refresh Songs Patch
+ old_Sorting := Ini.Sorting;
+ old_Tabs := Ini.Tabs;
+
+ AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers);
+ AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty);
+ AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage);
+ AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs);
+ AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting);
+ AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug);
+
+ AddButton(Theme.OptionsGame.ButtonExit);
+ if (Length(Button[0].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[7]);
+
+end;
+
+//Refresh Songs Patch
+procedure TScreenOptionsGame.RefreshSongs;
+begin
+if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then
+ ScreenSong.Refresh;
+end;
+
+procedure TScreenOptionsGame.onShow;
+begin
+ inherited;
+
+// Interaction := 0;
+end;
+
+end.