aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-02 11:09:31 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-02 11:09:31 +0000
commitbbf47cc4bca831d9884bbecce8771f51d8ac9f8a (patch)
tree2b804c20dc1ed06ff127c638473b176e6abd4144 /Game/Code
parentee4020d458bf0922f4f18c3b52161b55592f6ba9 (diff)
downloadusdx-bbf47cc4bca831d9884bbecce8771f51d8ac9f8a.tar.gz
usdx-bbf47cc4bca831d9884bbecce8771f51d8ac9f8a.tar.xz
usdx-bbf47cc4bca831d9884bbecce8771f51d8ac9f8a.zip
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
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/UGraphic.pas68
-rw-r--r--Game/Code/Classes/USkins.pas7
-rw-r--r--Game/Code/Screens/UScreenOptionsThemes.pas49
3 files changed, 111 insertions, 13 deletions
diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas
index 105dcfd7..9e494b5c 100644
--- a/Game/Code/Classes/UGraphic.pas
+++ b/Game/Code/Classes/UGraphic.pas
@@ -174,7 +174,8 @@ procedure SwapBuffers;
procedure LoadTextures;
procedure InitializeScreen;
-procedure LoadScreens;
+procedure LoadScreens( aShowLoading : boolean = true );
+procedure UnLoadScreens;
implementation
@@ -397,15 +398,19 @@ begin
ScreenH := H;
end;
-procedure LoadScreens;
+procedure LoadScreens( aShowLoading : boolean = true );
begin
- ScreenLoading := TScreenLoading.Create;
- ScreenLoading.onShow;
- Display.ActualScreen := @ScreenLoading;
- ScreenLoading.Draw;
- Display.Draw;
- SwapBuffers;
+ ScreenLoading := TScreenLoading.Create;
+ if aShowLoading then
+ begin
+ ScreenLoading.onShow;
+ Display.ActualScreen := @ScreenLoading;
+ ScreenLoading.Draw;
+ Display.Draw;
+ SwapBuffers;
+ end;
+
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3);
{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3);
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);}
@@ -481,4 +486,51 @@ begin
end;
+procedure UnLoadScreens;
+begin
+(*
+ ScreenLoading := TScreenLoading.Create;
+ ScreenLoading.onShow;
+
+ Display.ActualScreen := @ScreenLoading;
+
+ ScreenLoading.Draw;
+ Display.Draw;
+ SwapBuffers;
+*)
+
+ freeandnil( ScreenMain );
+ freeandnil( ScreenName );
+ freeandnil( ScreenLevel);
+ freeandnil( ScreenSong );
+ freeandnil( ScreenSongMenu );
+ freeandnil( ScreenSing );
+ freeandnil( ScreenScore);
+ freeandnil( ScreenTop5 );
+ freeandnil( ScreenOptions );
+ freeandnil( ScreenOptionsGame );
+ freeandnil( ScreenOptionsGraphics );
+ freeandnil( ScreenOptionsSound );
+ freeandnil( ScreenOptionsLyrics );
+// freeandnil( ScreenOptionsThemes );
+ freeandnil( ScreenOptionsRecord );
+ freeandnil( ScreenOptionsAdvanced );
+ freeandnil( ScreenEditSub );
+ freeandnil( ScreenEdit );
+ freeandnil( ScreenEditConvert );
+ freeandnil( ScreenOpen );
+ freeandnil( ScreenSingModi );
+ freeandnil( ScreenSongMenu );
+ freeandnil( ScreenSongJumpto);
+ freeandnil( ScreenPopupCheck );
+ freeandnil( ScreenPopupError );
+ freeandnil( ScreenPartyNewRound );
+ freeandnil( ScreenPartyScore );
+ freeandnil( ScreenPartyWin );
+ freeandnil( ScreenPartyOptions );
+ freeandnil( ScreenPartyPlayer );
+ freeandnil( ScreenStatMain );
+ freeandnil( ScreenStatDetail );
+end;
+
end.
diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas
index 67b0ae93..547f4c2c 100644
--- a/Game/Code/Classes/USkins.pas
+++ b/Game/Code/Classes/USkins.pas
@@ -36,7 +36,11 @@ var
implementation
-uses IniFiles, Classes, SysUtils, ULog, UIni;
+uses IniFiles,
+ Classes,
+ SysUtils,
+ ULog,
+ UIni;
constructor TSkin.Create;
begin
@@ -153,7 +157,6 @@ begin
SetLength(ISkin, Length(ISkin)+1);
ISkin[High(ISkin)] := Skin[S].Name;
end;
-
end;
end.
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);