diff options
Diffstat (limited to '')
-rw-r--r-- | src/menu/UMenuText.pas | 77 |
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. |