aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-13 14:14:32 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-10-13 14:14:32 +0000
commit322b798413826681915eca1960f081cbc4dd302c (patch)
tree03feeba5d30f0757015d844db2a7687c63382ef5 /src/base
parentdc2616a471905229cebc6225c98264c737161825 (diff)
downloadusdx-322b798413826681915eca1960f081cbc4dd302c.tar.gz
usdx-322b798413826681915eca1960f081cbc4dd302c.tar.xz
usdx-322b798413826681915eca1960f081cbc4dd302c.zip
Abstraction of the menus background
5 different bg types: none(fallback), colored, texture, video, and fade(for overlays) Some sideeffect is 5 mb less memory usage, don't know for which reasons :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1446 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r--src/base/UGraphic.pas64
-rw-r--r--src/base/UThemes.pas42
2 files changed, 71 insertions, 35 deletions
diff --git a/src/base/UGraphic.pas b/src/base/UGraphic.pas
index a624d14f..eea7db0b 100644
--- a/src/base/UGraphic.pas
+++ b/src/base/UGraphic.pas
@@ -767,39 +767,39 @@ begin
end;
procedure UnLoadScreens;
+var I: Integer;
begin
- 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 );
+ ScreenMain.Destroy;
+ ScreenName.Destroy;
+ ScreenLevel.Destroy;
+ ScreenSong.Destroy;
+ ScreenSing.Destroy;
+ ScreenScore.Destroy;
+ ScreenTop5.Destroy;
+ ScreenOptions.Destroy;
+ ScreenOptionsGame.Destroy;
+ ScreenOptionsGraphics.Destroy;
+ ScreenOptionsSound.Destroy;
+ ScreenOptionsLyrics.Destroy;
+// ScreenOptionsThemes.Destroy;
+ ScreenOptionsRecord.Destroy;
+ ScreenOptionsAdvanced.Destroy;
+ ScreenEditSub.Destroy;
+ ScreenEdit.Destroy;
+ ScreenEditConvert.Destroy;
+ ScreenOpen.Destroy;
+ ScreenSingModi.Destroy;
+ ScreenSongMenu.Destroy;
+ ScreenSongJumpto.Destroy;
+ ScreenPopupCheck.Destroy;
+ ScreenPopupError.Destroy;
+ ScreenPartyNewRound.Destroy;
+ ScreenPartyScore.Destroy;
+ ScreenPartyWin.Destroy;
+ ScreenPartyOptions.Destroy;
+ ScreenPartyPlayer.Destroy;
+ ScreenStatMain.Destroy;
+ ScreenStatDetail.Destroy;
end;
end.
diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas
index 3ee2798e..e5232c17 100644
--- a/src/base/UThemes.pas
+++ b/src/base/UThemes.pas
@@ -51,10 +51,29 @@ type
R, G, B, A: Double;
end;
- TThemeBackground = record
- Tex: string;
+TThemeBackground = record
+ BGType: Byte;
+ Color: TRGB;
+ Tex: string;
+ Alpha: Real;
end;
+const
+ BGT_Names: Array [0..4] of String = ('none', 'color', 'texture', 'video', 'fade');
+ BGT_None = 0;
+ BGT_Color = 1;
+ BGT_Texture = 2;
+ BGT_Video = 3;
+ BGT_Fade = 4;
+ BGT_Auto = 255;
+ //Defaul Background for Screens w/o Theme e.g. editor
+ DEFAULTBACKGROUND: TThemeBackground = (BGType: BGT_Color;
+ Color: (R:1; G:1; B:1);
+ Tex: '';
+ Alpha: 1.0);
+
+
+type
TThemeStatic = record
X: integer;
Y: integer;
@@ -1468,8 +1487,25 @@ begin
end;
procedure TTheme.ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string);
+var
+ BGType: String;
+ I: Integer;
begin
- ThemeBackground.Tex := ThemeIni.ReadString(Name + 'Background', 'Tex', '');
+ BGType := lowercase(ThemeIni.ReadString(Name + 'Background', 'Type', 'auto'));
+
+ ThemeBackground.BGType := BGT_Auto;
+ For I := 0 to high(BGT_Names) do
+ If (BGT_Names[I] = BGType) then
+ begin
+ ThemeBackground.BGType := I;
+ Break;
+ end;
+
+ ThemeBackground.Tex := ThemeIni.ReadString(Name + 'Background', 'Tex', '');
+ ThemeBackground.Color.R := ThemeIni.ReadFloat(Name + 'Background', 'ColR', 1);
+ ThemeBackground.Color.G := ThemeIni.ReadFloat(Name + 'Background', 'ColG', 1);
+ ThemeBackground.Color.B := ThemeIni.ReadFloat(Name + 'Background', 'ColB', 1);
+ ThemeBackground.Alpha := ThemeIni.ReadFloat(Name + 'Background', 'Alpha', 1);
end;
procedure TTheme.ThemeLoadText(var ThemeText: TThemeText; Name: string);