From eaa18fd6da15849eb20c06320c66d51191ffcdf9 Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 6 May 2008 16:46:35 +0000 Subject: 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 --- Game/Code/Menu/UMenu.pas | 51 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'Game/Code/Menu/UMenu.pas') 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; -- cgit v1.2.3