aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Menu
diff options
context:
space:
mode:
authorb1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-02 21:06:08 +0000
committerb1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-02 21:06:08 +0000
commit69c42b2bde3146a61d4b1e8e1cbedfd7163b1c60 (patch)
tree1409e580f08e54e5214a51de0377730b9c138edf /Game/Code/Menu
parent3df211329573da9450b2388875ec952dcaa98eea (diff)
downloadusdx-69c42b2bde3146a61d4b1e8e1cbedfd7163b1c60.tar.gz
usdx-69c42b2bde3146a61d4b1e8e1cbedfd7163b1c60.tar.xz
usdx-69c42b2bde3146a61d4b1e8e1cbedfd7163b1c60.zip
finished stuff for colorized transparent textures with statics (credits to mog, who started it)
still to do: same thing with buttons and maybe everything else ;) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@363 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Menu')
-rw-r--r--Game/Code/Menu/UMenu.pas25
1 files changed, 20 insertions, 5 deletions
diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas
index 309e199a..24af3e1d 100644
--- a/Game/Code/Menu/UMenu.pas
+++ b/Game/Code/Menu/UMenu.pas
@@ -3,7 +3,7 @@ unit UMenu;
interface
uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide,
- UMenuInteract, UThemes, UMenuButtonCollection;
+ UMenuInteract, UThemes, UMenuButtonCollection, Math;
type
{ Int16 = SmallInt;}
@@ -432,13 +432,26 @@ end;
function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer;
var
StatNum: integer;
+ TempR, TempG, TempB: Cardinal;
+ TempCol: Cardinal;
begin
// adds static
StatNum := Length(Static);
SetLength(Static, StatNum + 1);
// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color));
// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin system
-Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin
+
+// colorize hack
+if Typ='Colorized' then
+begin
+ TempR:=floor(255*ColR);
+ TempG:=floor(255*ColG);
+ TempB:=floor(255*ColB);
+ // give encoded color to loadtexture
+ Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB)));
+end
+else
+ Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin
// Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ));
// configures static
@@ -447,9 +460,11 @@ Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format)
Static[StatNum].Texture.W := W;
Static[StatNum].Texture.H := H;
Static[StatNum].Texture.Z := Z;
- Static[StatNum].Texture.ColR := ColR;
- Static[StatNum].Texture.ColG := ColG;
- Static[StatNum].Texture.ColB := ColB;
+ if Typ <> 'Colorized' then begin
+ Static[StatNum].Texture.ColR := ColR;
+ Static[StatNum].Texture.ColG := ColG;
+ Static[StatNum].Texture.ColB := ColB;
+ end;
Static[StatNum].Texture.TexX1 := TexX1;
Static[StatNum].Texture.TexY1 := TexY1;
Static[StatNum].Texture.TexX2 := TexX2;