aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-03 19:41:52 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-03 19:41:52 +0000
commit21438b7ca8862ef5b9f789e138efdbab15939a40 (patch)
tree96b77cea5a4a8322d7ee117b881f1f08f574966a
parenta5ad8dfa9ad48f9945a11e3e00eee49730962321 (diff)
downloadusdx-21438b7ca8862ef5b9f789e138efdbab15939a40.tar.gz
usdx-21438b7ca8862ef5b9f789e138efdbab15939a40.tar.xz
usdx-21438b7ca8862ef5b9f789e138efdbab15939a40.zip
fix compilation
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3177 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/base/UTexture.pas9
-rw-r--r--src/base/UUnicodeUtils.pas12
-rw-r--r--src/menu/UMenu.pas106
3 files changed, 118 insertions, 9 deletions
diff --git a/src/base/UTexture.pas b/src/base/UTexture.pas
index 6edcc46f..2da7625c 100644
--- a/src/base/UTexture.pas
+++ b/src/base/UTexture.pas
@@ -56,6 +56,8 @@ type
ScaleW: real; // for dynamic scalling while leaving width constant
ScaleH: real; // for dynamic scalling while leaving height constant
Rot: real; // 0 - 2*pi
+ RightScale: real; //
+ LeftScale: real; //
Int: real; // intensity
ColR: real;
ColG: real;
@@ -311,6 +313,7 @@ begin
glBindTexture(GL_TEXTURE_2D, ActTex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
@@ -360,6 +363,9 @@ begin
TexX2 := 1;
TexY2 := 1;
+ RightScale := 1;
+ LeftScale := 1;
+
Name := Identifier;
end;
@@ -466,6 +472,9 @@ begin
Result.TexX2 := 1;
Result.TexY2 := 1;
+ Result.RightScale := 1;
+ Result.LeftScale := 1;
+
Result.Name := Name;
end;
diff --git a/src/base/UUnicodeUtils.pas b/src/base/UUnicodeUtils.pas
index 52e40847..2fb87467 100644
--- a/src/base/UUnicodeUtils.pas
+++ b/src/base/UUnicodeUtils.pas
@@ -667,25 +667,33 @@ begin
end;
end;
-function AnsiToAscii(const s:AnsiString):AnsiString;
+function AnsiToAscii(const s :AnsiString): AnsiString;
begin
Result := s;
if Result <> '' then
begin
UniqueString(Result);
+{$IFDEF Windows}
CharToOem(Pchar(Result), Pchar(Result));
+{$ELSE}
+// todo
+{$ENDIF}
end;
end;
-function AsciiToAnsi(const s:AnsiString):AnsiString;
+function AsciiToAnsi(const s: AnsiString): AnsiString;
begin
Result := s;
if Result <> '' then
begin
UniqueString(Result);
+{$IFDEF Windows}
OemToChar(Pchar(Result), Pchar(Result));
+{$ELSE}
+// todo
+{$ENDIF}
end;
end;
diff --git a/src/menu/UMenu.pas b/src/menu/UMenu.pas
index 756ef237..a290ee51 100644
--- a/src/menu/UMenu.pas
+++ b/src/menu/UMenu.pas
@@ -69,6 +69,7 @@ type
public
Text: array of TText;
Statics: array of TStatic;
+ StaticsList: array of TStatic;
mX: integer; // mouse X
mY: integer; // mouse Y
@@ -104,12 +105,21 @@ type
function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const TexName: IPath; Typ: TTextureType; Color: integer): integer; overload;
function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const TexName: IPath; Typ: TTextureType; Color: integer): integer; overload;
function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const TexName: IPath; Typ: TTextureType; Color: integer; Reflection: boolean; ReflectionSpacing: real): integer; overload;
+{ for later additions
+ function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Alpha: real; const TexName: IPath; Typ: TTextureType; Color: integer; Reflection: boolean; ReflectionSpacing: real): integer; overload;
+
+ // list
+ function AddListItem(X, Y, W, H, Z: real; ColR, ColG, ColB: real; DColR, DColG, DColB: real; const TexName: IPath; const DTexName: IPath; Typ: TTextureType; Reflection: boolean; ReflectionSpacing: real): integer;
+}
// text
function AddText(ThemeText: TThemeText): integer; overload;
function AddText(X, Y: real; const Text_: UTF8String): integer; overload;
function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: UTF8String): integer; overload;
function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: UTF8String; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; overload;
+{ for later additions
+ function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: UTF8String; Reflection_: boolean; ReflectionSpacing_: real; Z : real; Writable: boolean): integer; overload;
+}
// button
procedure SetButtonLength(Length: cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button
@@ -148,6 +158,8 @@ type
function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown : boolean): boolean; virtual;
function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; virtual;
function InRegion(X, Y: real; A: TMouseOverRect): boolean;
+ function InRegionX(X: real; A: TMouseOverRect): boolean;
+ function InRegionY(Y: real; A: TMouseOverRect): boolean;
function InteractAt(X, Y: real): integer;
function CollectionAt(X, Y: real): integer;
procedure OnShow; virtual;
@@ -157,7 +169,7 @@ type
procedure SetAnimationProgress(Progress: real); virtual;
function IsSelectable(Int: cardinal): boolean;
-
+
procedure InteractNext; virtual;
procedure InteractCustom(CustomSwitch: integer); virtual;
procedure InteractPrev; virtual;
@@ -603,6 +615,8 @@ begin
Result := AddStatic(ThemeStatic.X, ThemeStatic.Y, ThemeStatic.W, ThemeStatic.H, ThemeStatic.Z,
ThemeStatic.ColR, ThemeStatic.ColG, ThemeStatic.ColB,
ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2,
+// add when using alpha
+// ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2, ThemeStatic.Alpha,
Skin.GetTextureFileName(ThemeStatic.Tex),
ThemeStatic.Typ, $FFFFFF, ThemeStatic.Reflection, ThemeStatic.Reflectionspacing);
end;
@@ -664,11 +678,13 @@ function TMenu.AddStatic(X, Y, W, H, Z: real;
Color: integer): integer;
begin
Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, TexName, Typ, Color, false, 0);
+// Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, 1, TexName, Typ, Color, false, 0);
end;
function TMenu.AddStatic(X, Y, W, H, Z: real;
ColR, ColG, ColB: real;
TexX1, TexY1, TexX2, TexY2: real;
+// TexX1, TexY1, TexX2, TexY2: real; Alpha: real;
const TexName: IPath;
Typ: TTextureType;
Color: integer;
@@ -691,7 +707,7 @@ begin
begin
Statics[StatNum] := TStatic.Create(Texture.GetTexture(TexName, Typ, Color)); // new skin
end;
-
+
// configures static
Statics[StatNum].Texture.X := X;
Statics[StatNum].Texture.Y := Y;
@@ -719,6 +735,8 @@ begin
Statics[StatNum].Texture.TexX2 := TexX2;
Statics[StatNum].Texture.TexY2 := TexY2;
Statics[StatNum].Texture.Alpha := 1;
+// add with alpha
+// Statics[StatNum].Texture.Alpha := Alpha;
Statics[StatNum].Visible := true;
//ReflectionMod
@@ -727,11 +745,66 @@ begin
Result := StatNum;
end;
+{ for later addition
+function TMenu.AddListItem(X, Y, W, H, Z: real;
+ ColR, ColG, ColB: real;
+ DColR, DColG, DColB: real;
+ const TexName: IPath;
+ const DTexName: IPath;
+ Typ: TTextureType;
+ Reflection: boolean;
+ ReflectionSpacing: real): integer;
+var
+ StatNum: integer;
+begin
+ // adds static
+ StatNum := Length(StaticsList);
+ SetLength(StaticsList, StatNum + 1);
+
+ StaticsList[StatNum] := TStatic.Create(Texture.GetTexture(TexName, Typ, RGBFloatToInt(ColR, ColG, ColB)));
+ StaticsList[StatNum].TextureSelect := Texture.GetTexture(TexName, Typ, RGBFloatToInt(ColR, ColG, ColB));
+ StaticsList[StatNum].TextureDeselect := Texture.GetTexture(DTexName, Typ, RGBFloatToInt(DColR, DColG, DColB));
+
+ // configures static
+ StaticsList[StatNum].Texture.X := X;
+ StaticsList[StatNum].Texture.Y := Y;
+
+ //Set height and width via sprite size if omitted
+ if(H = 0) then
+ StaticsList[StatNum].Texture.H := StaticsList[StatNum].Texture.H
+ else
+ StaticsList[StatNum].Texture.H := H;
+
+ if(W = 0) then
+ StaticsList[StatNum].Texture.W := StaticsList[StatNum].Texture.W
+ else
+ StaticsList[StatNum].Texture.W := W;
+
+ StaticsList[StatNum].Texture.Z := Z;
+ if (Typ <> TEXTURE_TYPE_COLORIZED) then
+ begin
+ StaticsList[StatNum].Texture.ColR := ColR;
+ StaticsList[StatNum].Texture.ColG := ColG;
+ StaticsList[StatNum].Texture.ColB := ColB;
+ end;
+
+ StaticsList[StatNum].Texture.Alpha := 1;
+ StaticsList[StatNum].Visible := true;
+
+ //ReflectionMod
+ StaticsList[StatNum].Reflection := Reflection;
+ StaticsList[StatNum].ReflectionSpacing := ReflectionSpacing;
+
+ Result := StatNum;
+end;
+}
function TMenu.AddText(ThemeText: TThemeText): integer;
begin
Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.W, ThemeText.Font, ThemeText.Size,
ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text, ThemeText.Reflection, ThemeText.ReflectionSpacing, ThemeText.Z);
+// add later when writable is available
+// ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text, ThemeText.Reflection, ThemeText.ReflectionSpacing, ThemeText.Z, ThemeText.Writable);
end;
function TMenu.AddText(X, Y: real; const Text_: UTF8String): integer;
@@ -751,6 +824,8 @@ function TMenu.AddText(X, Y: real;
const Text: UTF8String): integer;
begin
Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Text, false, 0, 0);
+// add with writable
+// Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Text, false, 0, 0, false);
end;
function TMenu.AddText(X, Y, W: real;
@@ -760,7 +835,8 @@ function TMenu.AddText(X, Y, W: real;
const Text_: UTF8String;
Reflection_: boolean;
ReflectionSpacing_: real;
- Z : real): integer;
+ Z : real{; add writable
+ Writable: boolean}): integer;
var
TextNum: integer;
begin
@@ -768,6 +844,9 @@ begin
TextNum := Length(Text);
SetLength(Text, TextNum + 1);
Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Text_, Reflection_, ReflectionSpacing_, Z);
+{ add with writable
+ Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Text_, Reflection_, ReflectionSpacing_, Z, Writable);
+}
Result := TextNum;
end;
@@ -1048,7 +1127,7 @@ begin
// usually start a second row when there are more than 4 buttons
Int := Interaction;
- Int := Int - ceil(Length(Interactions) / 2);
+ Int := Int - 4;//ceil(Length(Interactions) / 2);
//Set Interaction
if ((Int < 0) or (Int > Length(Interactions) - 1)) then
@@ -1063,7 +1142,7 @@ var
begin
Int := Interaction;
- Int := Int + ceil(Length(Interactions) / 2);
+ Int := Int + 4; //ceil(Length(Interactions) / 2);
//Set Interaction
if ((Int < 0) or (Int > Length(Interactions) - 1)) then
@@ -1292,7 +1371,8 @@ begin
AddSelectSlideOption(Values[SO]);
SelectsS[High(SelectsS)].Text.Size := ThemeSelectS.TextSize;
-
+ SelectsS[High(SelectsS)].Text.Y := ThemeSelectS.Y + (ThemeSelectS.H /2 ) - (ThemeSelectS.TextSize / 2);
+
SelectsS[High(SelectsS)].Texture.Z := ThemeSelectS.Z;
SelectsS[High(SelectsS)].TextureSBG.Z := ThemeSelectS.Z;
SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.Z := ThemeSelectS.Z;
@@ -1745,6 +1825,18 @@ begin
Result := (X >= A.X) and (X <= A.X + A.W) and (Y >= A.Y) and (Y <= A.Y + A.H);
end;
+function TMenu.InRegionX(X: real; A: TMouseOverRect): boolean;
+begin
+ // check whether A contains X
+ Result := (X >= A.X) and (X <= A.X + A.W);
+end;
+
+function TMenu.InRegionY(Y: real; A: TMouseOverRect): boolean;
+begin
+ // check whether A contains Y
+ Result := (Y >= A.Y) and (Y <= A.Y + A.H);
+end;
+
//takes x,y coordinates and returns the interaction number
//of the control at this position
function TMenu.InteractAt(X, Y: real): integer;
@@ -1757,7 +1849,7 @@ begin
case Interactions[i].Typ of
iButton:
if InRegion(X, Y, Button[Interactions[i].Num].GetMouseOverArea) and
- Button[Interactions[i].Num].Visible then
+ Button[Interactions[i].Num].Visible and Button[Interactions[i].Num].Selectable then
begin
Result:=i;
exit;