diff options
author | b1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-09-02 21:06:08 +0000 |
---|---|---|
committer | b1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-09-02 21:06:08 +0000 |
commit | 69c42b2bde3146a61d4b1e8e1cbedfd7163b1c60 (patch) | |
tree | 1409e580f08e54e5214a51de0377730b9c138edf /Game | |
parent | 3df211329573da9450b2388875ec952dcaa98eea (diff) | |
download | usdx-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')
-rw-r--r-- | Game/Code/Classes/UTexture.pas | 6 | ||||
-rw-r--r-- | Game/Code/Menu/UMenu.pas | 25 |
2 files changed, 25 insertions, 6 deletions
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 161b5512..3314f494 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -38,6 +38,10 @@ type TexY2: real;
Alpha: real;
Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins
+ // colorize hack
+ Colorized: Boolean;
+// Colors: array of Cardinal;
+// Texnums: array of Integer;
end;
TTextureEntry = record
@@ -448,7 +452,7 @@ begin //now the colorize stuff
for Position := 0 to TexOrigH-1 do begin
for Position2 := 0 to TexOrigW-1 do begin
- colorize(TextureD32[Position*TexNewW + Position2+1, 1],TextureD32[Position*TexNewW + Position2+1, 2],TextureD32[Position*TexNewW + Position2+1, 3], $fe198e); //pinkie :P
+ colorize(TextureD32[Position*TexNewW + Position2+1, 1],TextureD32[Position*TexNewW + Position2+1, 2],TextureD32[Position*TexNewW + Position2+1, 3], Col); //pinkie :P
end;
end;
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;
|