From e6917faa19aebfa6d089b24c65e4c7fe4bd6b503 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 13 Apr 2007 11:25:13 +0000 Subject: Added Reflection to ThemeStatic Added Attribut ReflectionSpacing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@83 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 15 +++++++++++++- Game/Code/Menu/UMenu.pas | 24 +++++++++++++-------- Game/Code/Menu/UMenuButton.pas | 9 ++++---- Game/Code/Menu/UMenuStatic.pas | 47 ++++++++++++++++++++++++++++++++++++++++++ Game/Code/UltraStar.dpr | 2 +- 5 files changed, 82 insertions(+), 15 deletions(-) diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index d7adb61a..51b454ca 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -91,6 +91,9 @@ type TexY1: real; TexX2: real; TexY2: real; + //Reflection Mod + Reflection: boolean; + Reflectionspacing: Real; end; AThemeStatic = array of TThemeStatic; @@ -129,7 +132,8 @@ type Tex: string; Typ: string; //Reflection Mod - Reflection: Boolean; + Reflection: boolean; + Reflectionspacing: Real; end; TThemeSelect = record @@ -181,6 +185,8 @@ type end; TThemeLoading = class(TThemeBasic) + StaticAnimation: TThemeStatic; + TextLoading: TThemeText; end; TThemeMain = class(TThemeBasic) @@ -749,6 +755,8 @@ begin // Loading ThemeLoadBasic(Loading, 'Loading'); + ThemeLoadText(Loading.TextLoading, 'LoadingTextLoading'); + ThemeLoadStatic(Loading.StaticAnimation, 'LoadingStaticAnimation'); // Main ThemeLoadBasic(Main, 'Main'); @@ -1284,6 +1292,10 @@ begin ThemeStatic.TexX2 := ThemeIni.ReadFloat(Name, 'TexX2', 1); ThemeStatic.TexY2 := ThemeIni.ReadFloat(Name, 'TexY2', 1); + //Reflection Mod + ThemeStatic.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + ThemeStatic.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); + DecimalSeparator := ','; end; @@ -1317,6 +1329,7 @@ begin //Reflection Mod ThemeButton.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + ThemeButton.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 45a25cb7..7908d980 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -13,7 +13,6 @@ type protected Interactions: array of TInteract; SelInteraction: integer; - Static: array of TStatic; Button: array of TButton; Selects: array of TSelect; SelectsS: array of TSelectSlide; @@ -22,6 +21,7 @@ type BackH: integer; public Text: array of TText; + Static: array of TStatic; mX: integer; // mouse X mY: integer; // mouse Y @@ -50,7 +50,7 @@ type function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer): integer; overload; + function 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; overload; // text function AddText(ThemeText: TThemeText): integer; overload; @@ -62,7 +62,7 @@ type function AddButton(ThemeButton: TThemeButton): integer; overload; function AddButton(X, Y, W, H: real; Name: String): integer; overload; function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; - function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; + function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; procedure ClearButtons; procedure AddButtonText(AddX, AddY: real; AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; @@ -232,7 +232,7 @@ begin ThemeStatic.ColR, ThemeStatic.ColG, ThemeStatic.ColB, ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2, {<0.5.1: Skin.SkinPath + ThemeStatic.Tex, 0.5.1:} Skin.GetTextureFileName(ThemeStatic.Tex), - 'JPG', ThemeStatic.Typ, $FFFFFF); + 'JPG', ThemeStatic.Typ, $FFFFFF, ThemeStatic.Reflection, ThemeStatic.Reflectionspacing); //'Font Black'); end; @@ -284,11 +284,11 @@ end; function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; begin - Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color); + Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color, False, 0); // 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): integer; +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; begin @@ -315,6 +315,11 @@ Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format) Static[StatNum].Texture.TexY2 := TexY2; Static[StatNum].Texture.Alpha := 1; Static[StatNum].Visible := true; + + //ReflectionMod + Static[StatNum].Reflection := Reflection; + Static[StatNum].ReflectionSpacing := ReflectionSpacing; + Result := StatNum; end; @@ -367,7 +372,7 @@ begin Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, - Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection); + Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection, ThemeButton.Reflectionspacing); Button[Result].Z := ThemeButton.Z; @@ -388,10 +393,10 @@ end; function TMenu.AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; begin - Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection); + Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection, 15); end; -function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean): integer; +function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing: Real): integer; begin // adds button Result := Length(Button); @@ -425,6 +430,7 @@ begin Button[Result].SetSelect(false); Button[Result].Reflection := Reflection; + Button[Result].Reflectionspacing := ReflectionSpacing; // adds interaction AddInteraction(iButton, Result); diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index e42a5488..f4f8e1a8 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -19,6 +19,7 @@ type Visible: boolean; //Reflection Mod Reflection: boolean; + Reflectionspacing: Real; Selectable: boolean; @@ -190,23 +191,23 @@ begin glBegin(GL_QUADS);//Top Left glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX1*TexW, TexY2*TexH); - glVertex3f(x, y+h*scaleH+ 15, z); + glVertex3f(x, y+h*scaleH+ Reflectionspacing, z); //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); - glVertex3f(x, y+h*scaleH + h*scaleH/2 + 15, z); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); - glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + 15, z); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Top Right glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX2*TexW, TexY2*TexH); - glVertex3f(x+w*scaleW, y+h*scaleH + 15, z); + glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); glEnd; end; end; diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index 4b10e54c..c19e6abc 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -8,6 +8,11 @@ type public Texture: TTexture; // Button Screen position and size Visible: boolean; + + //Reflection Mod + Reflection: boolean; + Reflectionspacing: Real; + procedure Draw; constructor Create(Textura: TTexture); overload; end; @@ -21,6 +26,48 @@ var begin if Visible then DrawTexture(Texture); + + //Reflection Mod + if (Reflection) then // Draw Reflections + begin + with Texture do + begin + //Bind Tex and GL Attributes + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); + //glDepthFunc(GL_GEQUAL); + glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc(GL_SRC_COLOR, GL_ZERO); + glBindTexture(GL_TEXTURE_2D, TexNum); + + //Draw + glBegin(GL_QUADS);//Top Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX1*TexW, TexY2*TexH); + glVertex3f(x, y+h*scaleH+ Reflectionspacing, z); + + //Bottom Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); + + + //Bottom Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); + + //Top Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX2*TexW, TexY2*TexH); + glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); + glEnd; + end; + end; + end; constructor TStatic.Create(Textura: TTexture); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index f36f9a26..fc1fa8a2 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -103,7 +103,7 @@ uses const - Version = 'UltraStar Deluxe V 0.90 Beta'; + Version = 'UltraStar Deluxe V 0.95 Beta'; var WndTitle: string; -- cgit v1.2.3