From 5ed6620bad808381fce94f2cd67ee911b4d45bff Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:19:04 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsRecord.pas | 136 +++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 Game/Code/Screens/UScreenOptionsRecord.pas (limited to 'Game/Code/Screens/UScreenOptionsRecord.pas') diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas new file mode 100644 index 00000000..c27ec02a --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -0,0 +1,136 @@ +unit UScreenOptionsRecord; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsRecord = class(TMenu) + private + SelectSlideInput: integer; + SelectSlideChannelL: integer; + SelectSlideChannelR: integer; + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure UpdateCard; + end; + +implementation + +uses SysUtils, UGraphic, URecord, ULog; + +function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE, SDLK_BACKSPACE: + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 4 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractInc; + end; + if SelInteraction = 0 then UpdateCard; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractDec; + end; + if SelInteraction = 0 then UpdateCard; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + I: integer; + SC: integer; + SCI: integer; +begin + AddBackground(Theme.OptionsRecord.Background.Tex); + for I := 0 to High(Theme.OptionsRecord.Static) do + AddStatic(Theme.OptionsRecord.Static[I]); + + for I := 0 to High(Theme.OptionsRecord.Text) do + AddText(Theme.OptionsRecord.Text[I]); + +// SetLength(ICard, 0); +// ICard[0] := 'karta'; + +// SetLength(IInput, 0); +// IInput[0] := 'wejscie'; + +// if Length(Recording.SoundCard) > 0 then begin + SetLength(ICard, Length(Recording.SoundCard)); + for SC := 0 to High(Recording.SoundCard) do + ICard[SC] := Recording.SoundCard[SC].Description; +// end; + +// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin + SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); + for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do + IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; +// end; + + + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + + AddButton(Theme.OptionsRecord.ButtonExit); + AddButtonText(14, 20, 'Exit'); + + Interaction := 0; +end; + +procedure TScreenOptionsRecord.onShow; +begin + Interaction := 0; +end; + +procedure TScreenOptionsRecord.UpdateCard; +var + SC: integer; + SCI: integer; +begin + SC := Ini.Card; +// if SC = 1 then beep; + + SetLength(IInput, Length(Recording.SoundCard[SC].Input)); + for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin + IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; +// Log.LogError(IInput[SCI]); + end; + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); +end; + +end. \ No newline at end of file -- cgit v1.2.3