aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/UThemes.pas
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/UThemes.pas
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/UThemes.pas')
-rw-r--r--src/base/UThemes.pas42
1 files changed, 39 insertions, 3 deletions
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);