diff options
author | mogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-05-06 16:46:35 +0000 |
---|---|---|
committer | mogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-05-06 16:46:35 +0000 |
commit | eaa18fd6da15849eb20c06320c66d51191ffcdf9 (patch) | |
tree | 624b7644b4f9b1f6b5ce45dd14628eb596bbbfbf | |
parent | 6ec8f23c79ff9b4ff3c4a47167b237dc61f39738 (diff) | |
download | usdx-eaa18fd6da15849eb20c06320c66d51191ffcdf9.tar.gz usdx-eaa18fd6da15849eb20c06320c66d51191ffcdf9.tar.xz usdx-eaa18fd6da15849eb20c06320c66d51191ffcdf9.zip |
Option screen has two rows of buttons, to select the row beneath press [cursor down] / [cursor up] for the row above
Settings are not saved if you press [escape] (just for the "main" option screen atm)
Long descriptions are used to explain what hides behind a option screen
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1063 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r-- | Game/Code/Classes/UThemes.pas | 28 | ||||
-rw-r--r-- | Game/Code/Menu/UMenu.pas | 51 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenOptions.pas | 21 |
3 files changed, 80 insertions, 20 deletions
diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 366e478e..f38871a9 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -1117,13 +1117,13 @@ begin ThemeLoadButton(Options.ButtonAdvanced, 'OptionsButtonAdvanced');
ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit');
- Options.Description[0] := Language.Translate('SING_OPTIONS_GAME');
- Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS');
- Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND');
- Options.Description[3] := Language.Translate('SING_OPTIONS_LYRICS');
- Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES');
- Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD');
- Options.Description[6] := Language.Translate('SING_OPTIONS_ADVANCED');
+ Options.Description[0] := Language.Translate('SING_OPTIONS_GAME_DESC');
+ Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS_DESC');
+ Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND_DESC');
+ Options.Description[3] := Language.Translate('SING_OPTIONS_LYRICS_DESC');
+ Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES_DESC');
+ Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD_DESC');
+ Options.Description[6] := Language.Translate('SING_OPTIONS_ADVANCED_DESC');
Options.Description[7] := Language.Translate('SING_OPTIONS_EXIT');
ThemeLoadText(Options.TextDescription, 'OptionsTextDescription');
@@ -1132,13 +1132,13 @@ begin // Options Game
ThemeLoadBasic(OptionsGame, 'OptionsGame');
- ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers');
- ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty');
- ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage');
- ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs');
- ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting');
- ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug');
- ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit');
+ ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers');
+ ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty');
+ ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage');
+ ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs');
+ ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting');
+ ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug');
+ ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit');
// Options Graphics
ThemeLoadBasic(OptionsGraphics, 'OptionsGraphics');
diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 0eebeaf6..3cdccb0b 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -143,7 +143,8 @@ type procedure InteractPrev; virtual; procedure InteractInc; virtual; procedure InteractDec; virtual; - + procedure InteractNextRow; virtual; // this is for the options screen, so button down makes sense + procedure InteractPrevRow; virtual; // this is for the options screen, so button up makes sense procedure AddBox(X, Y, W, H: real); end; @@ -886,6 +887,53 @@ begin end; end; +// implemented for the sake of usablility +// [curser down] picks the button left to the actual atm +// this behaviour doesn't make sense for two rows of buttons +procedure TMenu.InteractPrevRow; +var + 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 + Int := Interaction; + + // change interaction as long as it's needed + repeat + Int := int - ceil(Length(Interactions) / 2); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then Break; + + Until IsSelectable(Int); + + //Set Interaction + if ((Int < 0) or (Int > Length(Interactions) - 1)) + then Int := Interaction //nonvalid button, keep current one + else Interaction := Int; //select row above +end; + +procedure TMenu.InteractNextRow; +var + Int: Integer; +begin + Int := Interaction; + + // change interaction as long as it's needed + repeat + Int := int + ceil(Length(Interactions) / 2); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then Break; + + Until IsSelectable(Int); + + //Set Interaction + if ((Int < 0) or (Int > Length(Interactions) - 1)) + then Int := Interaction //nonvalid button, keep current one + else Interaction := Int; //select row above +end; + procedure TMenu.InteractNext; var Int: Integer; @@ -905,7 +953,6 @@ begin Interaction := Int; end; - procedure TMenu.InteractPrev; var Int: Integer; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 3f936602..24633115 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -16,6 +16,8 @@ type procedure onShow; override; procedure InteractNext; override; procedure InteractPrev; override; + procedure InteractNextRow; override; + procedure InteractPrevRow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -36,13 +38,13 @@ begin Exit; end; end; - + // check special keys case PressedKey of SDLK_ESCAPE, SDLK_BACKSPACE : begin - Ini.Save; +// Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; @@ -97,8 +99,8 @@ begin FadeTo(@ScreenMain); end; end; - SDLK_DOWN: InteractInc; - SDLK_UP: InteractDec; + SDLK_DOWN: InteractNextRow; + SDLK_UP: InteractPrevRow; SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; @@ -167,6 +169,17 @@ begin Text[TextDescription].Text := Theme.Options.Description[Interaction]; end; +procedure TScreenOptions.InteractNextRow; +begin + inherited InteractNextRow; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + +procedure TScreenOptions.InteractPrevRow; +begin + inherited InteractPrevRow; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; procedure TScreenOptions.SetAnimationProgress(Progress: real); begin |