From 873f177f08dc7c4fe2d7e50bbe7709df98e238d3 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 27 Aug 2008 14:58:32 +0000 Subject: rename Screen part2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1306 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 256 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 src/screens/UScreenMain.pas (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas new file mode 100644 index 00000000..4dbdaaa1 --- /dev/null +++ b/src/screens/UScreenMain.pas @@ -0,0 +1,256 @@ +unit UScreenMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; + +type + TScreenMain = class(TMenu) + public + TextDescription: integer; + TextDescriptionLong: integer; + + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins; + +function TScreenMain.ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; +var + SDL_ModState: word; +begin + Result := True; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + if (PressedDown) then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := False; + Exit; + end; + 'C': + begin + if (SDL_ModState = KMOD_LALT) then + begin + FadeTo(@ScreenCredits, SoundLib.Start); + Exit; + end; + end; + 'M': + begin + if (Ini.Players >= 1) and (Length(DLLMan.Plugins) >= 1) then + begin + FadeTo(@ScreenPartyOptions, SoundLib.Start); + Exit; + end; + end; + + 'S': + begin + FadeTo(@ScreenStatMain, SoundLib.Start); + Exit; + end; + + 'E': + begin + FadeTo(@ScreenEdit, SoundLib.Start); + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE: + begin + Result := False; + end; + + SDLK_RETURN: + begin + //Solo + if (Interaction = 0) then + begin + if (Songs.SongList.Count >= 1) then + begin + if (Ini.Players >= 0) and (Ini.Players <= 3) then + PlayersPlay := Ini.Players + 1; + if (Ini.Players = 4) then + PlayersPlay := 6; + + ScreenName.Goto_SingScreen := False; + FadeTo(@ScreenName, SoundLib.Start); + end + else //show error message + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Multi + if Interaction = 1 then + begin + if (Songs.SongList.Count >= 1) then + begin + if (Length(DLLMan.Plugins) >= 1) then + begin + FadeTo(@ScreenPartyOptions, SoundLib.Start); + end + else //show error message, No Plugins Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + end + else //show error message, No Songs Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Stats + if Interaction = 2 then + begin + FadeTo(@ScreenStatMain, SoundLib.Start); + end; + + //Editor + if Interaction = 3 then + begin + FadeTo(@ScreenEdit, SoundLib.Start); + end; + + //Options + if Interaction = 4 then + begin + FadeTo(@ScreenOptions, SoundLib.Start); + end; + + //Exit + if Interaction = 5 then + begin + Result := False; + end; + end; + {** + * Up and Down could be done at the same time, + * but I don't want to declare variables inside + * functions like this one, called so many times + *} + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN: + begin + end; + end; +end; + +constructor TScreenMain.Create; +begin + inherited Create; +{** + * Attention ^^: + * New Creation Order needed because of LoadFromTheme + * and Button Collections. + * At First Custom Texts and Statics + * Then LoadFromTheme + * after LoadFromTheme the Buttons and Selects + *} + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); + + LoadFromTheme(Theme.Main); + + AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonMulti); + AddButton(Theme.Main.ButtonStat); + AddButton(Theme.Main.ButtonEditor); + AddButton(Theme.Main.ButtonOptions); + AddButton(Theme.Main.ButtonExit); + + Interaction := 0; +end; + +procedure TScreenMain.onShow; +begin + inherited; +{** + * Start background music + *} + SoundLib.StartBgMusic; +end; + +procedure TScreenMain.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.SetAnimationProgress(Progress: real); +begin + Static[0].Texture.ScaleW := Progress; + Static[0].Texture.ScaleH := Progress; +end; + +end. -- cgit v1.2.3 From f16756422a5dbb24ce1b751bb9e2bb1de4f19713 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 23 Sep 2008 21:17:50 +0000 Subject: added file headers git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1404 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 4dbdaaa1..2a2d0613 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenMain; interface -- cgit v1.2.3 From f469075a0335399c753ae5d2d362047dedf116b1 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 7 Mar 2009 21:14:14 +0000 Subject: final cleanup of Umain. Creation of UNote git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1627 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 2a2d0613..4980021e 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -63,7 +63,7 @@ implementation uses UGraphic, - UMain, + UNote, UIni, UTexture, USongs, -- cgit v1.2.3 From c7f5d683c1eae49e30ee42a76557661f57311b9e Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 25 Apr 2009 10:09:59 +0000 Subject: Cosmetics. No code change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1694 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 4980021e..36cf84b0 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -79,7 +79,7 @@ function TScreenMain.ParseInput(PressedKey: cardinal; CharCode: widechar; var SDL_ModState: word; begin - Result := True; + Result := true; SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); @@ -90,7 +90,7 @@ begin case WideCharUpperCase(CharCode)[1] of 'Q': begin - Result := False; + Result := false; Exit; end; 'C': @@ -128,7 +128,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE: begin - Result := False; + Result := false; end; SDLK_RETURN: @@ -143,7 +143,7 @@ begin if (Ini.Players = 4) then PlayersPlay := 6; - ScreenName.Goto_SingScreen := False; + ScreenName.Goto_SingScreen := false; FadeTo(@ScreenName, SoundLib.Start); end else //show error message @@ -187,7 +187,7 @@ begin //Exit if Interaction = 5 then begin - Result := False; + Result := false; end; end; {** -- cgit v1.2.3 From 257854c587f0876a912cfbeb4fe0a30970d25a9b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 31 May 2009 14:10:42 +0000 Subject: merged (experimental) mouse support patch by d0ccrazy some changes to patch - implemented software cursor (texturable) - option to turn of mouse support or switch between hardware and software cursor - hide software cursor if there is no mouse activity for 5 seconds - soft fade in and out for software cursor - some test cursor-textures for deluxe theme (mog pls change these horible looking images) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1789 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 36cf84b0..a4e6009f 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -52,10 +52,7 @@ type function ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; override; procedure onShow; override; - procedure InteractNext; override; - procedure InteractPrev; override; - procedure InteractInc; override; - procedure InteractDec; override; + procedure SetInteraction(Num: integer); override; procedure SetAnimationProgress(Progress: real); override; end; @@ -238,36 +235,19 @@ end; procedure TScreenMain.onShow; begin inherited; + + { display cursor (on moved) } + Display.SetCursor; + {** * Start background music *} SoundLib.StartBgMusic; end; -procedure TScreenMain.InteractNext; -begin - inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractPrev; -begin - inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractDec; -begin - inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractInc; +procedure TScreenMain.SetInteraction(Num: integer); begin - inherited InteractInc; + inherited SetInteraction(Num); Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; end; -- cgit v1.2.3 From 917901e8e33438c425aef50a0a7417f32d77b760 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Mon, 9 Nov 2009 00:27:55 +0000 Subject: merged unicode branch (r1931) into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1939 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index a4e6009f..7237eb80 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -49,9 +49,9 @@ type TextDescriptionLong: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: widechar; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - procedure onShow; override; + procedure OnShow; override; procedure SetInteraction(Num: integer); override; procedure SetAnimationProgress(Progress: real); override; end; @@ -69,9 +69,10 @@ uses UParty, UDLLManager, UScreenCredits, - USkins; + USkins, + UUnicodeUtils; -function TScreenMain.ParseInput(PressedKey: cardinal; CharCode: widechar; +function TScreenMain.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var SDL_ModState: word; @@ -84,22 +85,19 @@ begin if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': - begin + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; end; - 'C': - begin + Ord('C'): begin if (SDL_ModState = KMOD_LALT) then begin FadeTo(@ScreenCredits, SoundLib.Start); Exit; end; end; - 'M': - begin + Ord('M'): begin if (Ini.Players >= 1) and (Length(DLLMan.Plugins) >= 1) then begin FadeTo(@ScreenPartyOptions, SoundLib.Start); @@ -107,14 +105,12 @@ begin end; end; - 'S': - begin + Ord('S'): begin FadeTo(@ScreenStatMain, SoundLib.Start); Exit; end; - 'E': - begin + Ord('E'): begin FadeTo(@ScreenEdit, SoundLib.Start); Exit; end; @@ -172,7 +168,11 @@ begin //Editor if Interaction = 3 then begin + {$IFDEF UseMIDIPort} FadeTo(@ScreenEdit, SoundLib.Start); + {$ELSE} + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_EDITOR')); + {$ENDIF} end; //Options @@ -232,7 +232,7 @@ begin Interaction := 0; end; -procedure TScreenMain.onShow; +procedure TScreenMain.OnShow; begin inherited; -- cgit v1.2.3 From ba2e579b547b5331a2bcd900de04ae50818ada84 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Sun, 6 Dec 2009 14:40:10 +0000 Subject: fix bugtracker issue 2817034 if selected to show the name screen after song select, than this screen is now not shown before song select git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1975 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 7237eb80..ca4ba7cc 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -136,8 +136,13 @@ begin if (Ini.Players = 4) then PlayersPlay := 6; - ScreenName.Goto_SingScreen := false; - FadeTo(@ScreenName, SoundLib.Start); + if Ini.OnSongClick = sSelectPlayer then + FadeTo(@ScreenLevel) + else + begin + ScreenName.Goto_SingScreen := false; + FadeTo(@ScreenName, SoundLib.Start); + end; end else //show error message ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); -- cgit v1.2.3 From 4711217f127aa0c10fa52755fd567c570277a1a1 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Tue, 12 Jan 2010 17:42:41 +0000 Subject: merged lua into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2071 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index ca4ba7cc..b342281c 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -153,12 +153,7 @@ begin begin if (Songs.SongList.Count >= 1) then begin - if (Length(DLLMan.Plugins) >= 1) then - begin - FadeTo(@ScreenPartyOptions, SoundLib.Start); - end - else //show error message, No Plugins Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end else //show error message, No Songs Loaded ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); @@ -241,12 +236,18 @@ procedure TScreenMain.OnShow; begin inherited; + {** + * Clean up TPartyGame here + * at the moment there is no better place for this + *} + Party.Clear; + { display cursor (on moved) } Display.SetCursor; -{** - * Start background music - *} + {** + * Start background music + *} SoundLib.StartBgMusic; end; -- cgit v1.2.3 From f29685523465fb0d2d0d6bbe9985cf11207cde23 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 12 Jan 2010 19:55:25 +0000 Subject: deleted leftovers from old plugin system and party mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2080 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index b342281c..8bdfe419 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -67,7 +67,6 @@ uses Textgl, ULanguage, UParty, - UDLLManager, UScreenCredits, USkins, UUnicodeUtils; @@ -98,7 +97,7 @@ begin end; end; Ord('M'): begin - if (Ini.Players >= 1) and (Length(DLLMan.Plugins) >= 1) then + if (Ini.Players >= 1) and (Party.ModesAvailable) then begin FadeTo(@ScreenPartyOptions, SoundLib.Start); Exit; -- cgit v1.2.3 From f761eb20ce8d3b5ef718be4a305b78712641248d Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 18 Apr 2010 13:43:36 +0000 Subject: change variable names "static" to "statics" - "static" is a reserved name and should not be used - code-completion in lazarus does not work as it is not able to cope with variables that are named "static" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2246 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 8bdfe419..2973fbb9 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -259,8 +259,8 @@ end; procedure TScreenMain.SetAnimationProgress(Progress: real); begin - Static[0].Texture.ScaleW := Progress; - Static[0].Texture.ScaleH := Progress; + Statics[0].Texture.ScaleW := Progress; + Statics[0].Texture.ScaleH := Progress; end; end. -- cgit v1.2.3 From 354ffda49ecb2d76ab5f3100d095b0dbed13f6fa Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 18 May 2010 16:27:02 +0000 Subject: forgotten changes from last commit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2381 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 2973fbb9..8bb9365b 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -234,20 +234,11 @@ end; procedure TScreenMain.OnShow; begin inherited; - {** * Clean up TPartyGame here * at the moment there is no better place for this *} Party.Clear; - - { display cursor (on moved) } - Display.SetCursor; - - {** - * Start background music - *} - SoundLib.StartBgMusic; end; procedure TScreenMain.SetInteraction(Num: integer); -- cgit v1.2.3 From f53aa00aaef03e3c28f4e9b71184ce2668472b38 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 Jun 2010 14:45:09 +0000 Subject: - enter credits screen after 30 seconds w/o user interaction in main screen - leave credits screen w/ left / right mouse button, enter, return, escape and backspace git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2536 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 8bb9365b..777922de 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -44,6 +44,10 @@ uses type TScreenMain = class(TMenu) + private + { ticks when the user interacted, used to start credits + after a period of time w/o user interaction } + UserInteractionTicks: cardinal; public TextDescription: integer; TextDescriptionLong: integer; @@ -51,11 +55,17 @@ type constructor Create; override; function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; procedure OnShow; override; procedure SetInteraction(Num: integer); override; procedure SetAnimationProgress(Progress: real); override; + function Draw: boolean; override; end; +const + { start credits after 30 seconds w/o interaction } + TicksUntilCredits = 30 * 1000; + implementation uses @@ -78,6 +88,9 @@ var begin Result := true; + { reset user interaction timer } + UserInteractionTicks := SDL_GetTicks; + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); @@ -205,6 +218,15 @@ begin end; end; +function TScreenMain.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; +begin + // default mouse behaviour + Result := inherited ParseMouse(MouseButton, BtnDown, X, Y); + + { reset user interaction timer } + UserInteractionTicks := SDL_GetTicks; +end; + constructor TScreenMain.Create; begin inherited Create; @@ -239,6 +261,20 @@ begin * at the moment there is no better place for this *} Party.Clear; + + { reset user interaction timer } + UserInteractionTicks := SDL_GetTicks; +end; + +function TScreenMain.Draw: boolean; +begin + Result := inherited Draw; + + { start credits after a period w/o user interaction } + if (UserInteractionTicks + TicksUntilCredits < SDL_GetTicks) then + begin + FadeTo(@ScreenCredits, SoundLib.Start); + end; end; procedure TScreenMain.SetInteraction(Num: integer); -- cgit v1.2.3 From acbd932cf7f7ee23d39fac8230bf90b9c112f30c Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 10 Oct 2010 10:39:21 +0000 Subject: start bg-music in main-screen (additionally to start in main()) - needed if a screen without music returns to main screen - bg-music start in main() was left in case the first screen is not the main-screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2650 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 777922de..e6d98c27 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -256,6 +256,9 @@ end; procedure TScreenMain.OnShow; begin inherited; + + SoundLib.StartBgMusic; + {** * Clean up TPartyGame here * at the moment there is no better place for this -- cgit v1.2.3 From ee45b0c875de2c978bbf80243d9661b35610836c Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 10 Oct 2010 10:46:28 +0000 Subject: show credits after one minute instead of a half git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2651 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenMain.pas') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index e6d98c27..aa313cf6 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -63,8 +63,8 @@ type end; const - { start credits after 30 seconds w/o interaction } - TicksUntilCredits = 30 * 1000; + { start credits after 60 seconds w/o interaction } + TicksUntilCredits = 60 * 1000; implementation -- cgit v1.2.3