From bbf47cc4bca831d9884bbecce8771f51d8ac9f8a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 11:09:31 +0000 Subject: Runtime theme changing - jira#USDX-156 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.01@551 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsThemes.pas | 49 ++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 7c804274..e5f928c1 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -34,13 +34,26 @@ begin SDLK_BACKSPACE : begin Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens( false ); + Music.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin - if SelInteraction = 3 then begin + if SelInteraction = 3 then + begin Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens( false ); + Music.PlayBack; FadeTo(@ScreenOptions); end; @@ -51,14 +64,16 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin Music.PlayOption; InteractDec; end; @@ -75,6 +90,20 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.ActualScreen := @ScreenOptionsThemes; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); + end; end; @@ -86,6 +115,19 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + + Display.ActualScreen := @ScreenOptionsThemes; + ScreenOptionsThemes.Draw; + + Display.Draw; + SwapBuffers; + + freeandnil( self ); end; end; @@ -94,6 +136,7 @@ var I: integer; begin inherited Create; + LoadFromTheme(Theme.OptionsThemes); -- cgit v1.2.3