aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-03 20:25:10 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-03 20:25:10 +0000
commit8345e50a415417f377482d7f7d13d734beeaafd2 (patch)
treeed7a89839c063e3f05ed85cd66b0df35e03356d0 /src
parent769e3fc3de23b38adeece09b6ab7edb3f0d096b0 (diff)
downloadusdx-8345e50a415417f377482d7f7d13d734beeaafd2.tar.gz
usdx-8345e50a415417f377482d7f7d13d734beeaafd2.tar.xz
usdx-8345e50a415417f377482d7f7d13d734beeaafd2.zip
prepare adjustments.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3182 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/menu/UMenuText.pas77
1 files changed, 69 insertions, 8 deletions
diff --git a/src/menu/UMenuText.pas b/src/menu/UMenuText.pas
index ab180b77..ca480adc 100644
--- a/src/menu/UMenuText.pas
+++ b/src/menu/UMenuText.pas
@@ -72,6 +72,8 @@ type
Reflection: boolean;
ReflectionSpacing: real;
+// for adding later Writable: boolean;
+
procedure SetSelect(Value: boolean);
property Selected: boolean read SelectBool write SetSelect;
@@ -84,6 +86,11 @@ type
constructor Create; overload;
constructor Create(X, Y: real; const Text: UTF8String); overload;
constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; const ParText: UTF8String; ParReflection: boolean; ParReflectionSpacing: real; ParZ: real); overload;
+{ when adding writable
+ constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; const ParText: UTF8String; ParReflection: boolean; ParReflectionSpacing: real; ParZ: real; Writable: boolean); overload;
+
+ function GetMouseOverArea: TMouseOverRect;
+}
end;
implementation
@@ -96,7 +103,7 @@ uses
procedure TText.SetSelect(Value: boolean);
begin
SelectBool := Value;
-
+
// set cursor visible
SelectBlink := true;
STicks := SDL_GetTicks() div 550;
@@ -163,6 +170,7 @@ var
end;
begin
+ isBreak:=false;
// set TextString
TextString := Value;
@@ -248,12 +256,14 @@ end;
procedure TText.DeleteLastLetter;
begin
SetText(UTF8Copy(TextString, 1, LengthUTF8(TextString)-1));
+// this exchange needs chekcing
+// SetText(UTF8Copy(TextString, 1, UTF8Length(TextString)-1));
end;
procedure TText.Draw;
var
X2, Y2: real;
- Text2: UTF8String;
+ tmpText2, Text2: UTF8String;
I: integer;
Ticks: cardinal;
begin
@@ -306,14 +316,22 @@ begin
Y2 := Y + MoveY;
for I := 0 to High(TextTiles) do
begin
+ tmpText2 := TextTiles[I];
+
if (not (SelectBool and SelectBlink)) or (I <> High(TextTiles)) then
Text2 := TextTiles[I]
else
- Text2 := TextTiles[I] + '|';
-
+// begin
+// if (Writable) then
+ Text2 := TextTiles[I] + '|';
+{
+ else
+ Text2 := TextTiles[I];
+ end;
+}
case Align of
- 1: X2 := X + MoveX - glTextWidth(Text2)/2; { centered }
- 2: X2 := X + MoveX - glTextWidth(Text2); { right aligned }
+ 1: X2 := X + MoveX - glTextWidth(tmpText2)/2; { centered }
+ 2: X2 := X + MoveX - glTextWidth(tmpText2); { right aligned }
else X2 := X + MoveX; { left aligned (default) }
end;
@@ -344,7 +362,7 @@ end;
constructor TText.Create(X, Y: real; const Text: UTF8String);
begin
- Create(X, Y, 0, ftNormal, 30, 0, 0, 0, 0, Text, false, 0, 0);
+ Create(X, Y, 0, ftNormal, 30, 0, 0, 0, 0, Text, false, 0, 0{, false});
end;
constructor TText.Create(ParX, ParY, ParW: real;
@@ -354,7 +372,8 @@ constructor TText.Create(ParX, ParY, ParW: real;
const ParText: UTF8String;
ParReflection: boolean;
ParReflectionSpacing: real;
- ParZ: real);
+ ParZ: real{;
+ Writable: boolean});
begin
inherited Create;
Alpha := 1;
@@ -374,6 +393,48 @@ begin
Visible := true;
Reflection := ParReflection;
ReflectionSpacing := ParReflectionSpacing;
+// Writable := Writable;
end;
+{ add later
+function TText.GetMouseOverArea: TMouseOverRect;
+var
+ W1: real;
+begin
+ if not(Display.Cursor_HiddenByScreen) then
+ begin
+ if (Align = 0) then
+ begin
+ Result.X := X;
+ Result.Y := Y;
+ Result.W := glTextWidth(Text);
+ Result.H := Size;
+ end;
+ if (Align = 1) then
+ begin
+ Result.X := X -glTextWidth(Text)/2;
+ Result.Y := Y;
+ Result.W := glTextWidth(Text);
+ Result.H := Size;
+ end;
+
+ if (Align = 2) then
+ begin
+ if (W <> 0) then
+ Result.X := X - W
+ else
+ Result.X := X - glTextWidth(Text);
+
+ Result.Y := Y;
+
+ if (W <> 0) then
+ Result.W := W
+ else
+ Result.W := glTextWidth(Text);
+
+ Result.H := Size;
+ end;
+ end;
+end;
+}
end.