From 5f45fd926da919d8057dfcca4101dc305bd230df Mon Sep 17 00:00:00 2001
From: whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>
Date: Thu, 14 Jun 2007 13:08:54 +0000
Subject: Added Text Fading to ButtonCollection

git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@262 b956fd51-792f-4845-bead-9b4dfca2ff2c
---
 Game/Code/Menu/UMenu.pas                 |  4 ++++
 Game/Code/Menu/UMenuButtonCollection.pas | 15 ++++++++++++---
 Game/Code/Menu/UMenuText.pas             |  4 +++-
 3 files changed, 19 insertions(+), 4 deletions(-)

(limited to 'Game/Code/Menu')

diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas
index d7c919ee..309e199a 100644
--- a/Game/Code/Menu/UMenu.pas
+++ b/Game/Code/Menu/UMenu.pas
@@ -559,6 +559,10 @@ begin
     begin
       Interactions[High(Interactions)].Typ := iBCollectionChild;
       Button[Result].Visible := False;
+
+      for BT := 0 to BTLen-1 do
+        Button[Result].Text[BT].Alpha := 0;
+
       Button[Result].Parent := ThemeButton.Parent;
       if (ButtonCollection[ThemeButton.Parent-1].Fade) then
         Button[Result].Texture.Alpha := 0;
diff --git a/Game/Code/Menu/UMenuButtonCollection.pas b/Game/Code/Menu/UMenuButtonCollection.pas
index 66ac70fc..5c9045a7 100644
--- a/Game/Code/Menu/UMenuButtonCollection.pas
+++ b/Game/Code/Menu/UMenuButtonCollection.pas
@@ -36,7 +36,7 @@ begin
 end;
 
 procedure TButtonCollection.Draw;
-var I: Integer;
+var I, J: Integer;
 begin
   inherited;
   //If fading is activated, Fade Child Buttons
@@ -46,10 +46,19 @@ begin
       if (ScreenButton^[I].Parent = Parent) then
       begin
         if (FadeProgress < 0.5) then
-          ScreenButton^[I].Visible := SelectBool
+        begin
+          ScreenButton^[I].Visible := SelectBool;
+
+          For J := 0 to High(ScreenButton^[I].Text) do
+            ScreenButton^[I].Text[J].Visible := SelectBool;
+        end
         else
+        begin
           ScreenButton^[I].Texture.Alpha := (FadeProgress-0.666)*3;
-        //ScreenButton^[I].Text[0].
+          
+          For J := 0 to High(ScreenButton^[I].Text) do
+            ScreenButton^[I].Text[J].Alpha := (FadeProgress-0.666)*3;
+        end;
       end;
   end;
 end;
diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas
index 69ece02f..4713962e 100644
--- a/Game/Code/Menu/UMenuText.pas
+++ b/Game/Code/Menu/UMenuText.pas
@@ -23,6 +23,7 @@ type
       ColR:   real;
       ColG:   real;
       ColB:   real;
+      Alpha:  real;
       Int:    real;
       Style:  integer;
       Visible:  boolean;
@@ -225,7 +226,7 @@ begin
     SetFontStyle(Style);
     SetFontSize(Size);
     SetFontItalic(False);
-    glColor3f(ColR*Int, ColG*Int, ColB*Int);
+    glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha);
 
     //If Selected Set Blink...
     if SelectBool then
@@ -303,6 +304,7 @@ end;
 constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string);
 begin
   inherited Create;
+  Alpha := 1;
   X := ParX;
   Y := ParY;
   W := ParW;
-- 
cgit v1.2.3