From eb7df4c30c7e119ad56eb3ba8506ff3e3afce4a4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 30 Mar 2007 19:18:27 +0000 Subject: Added Cursor Blink to TText git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@56 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'Game/Code/Menu') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 4a5356d8..4b8ea391 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -9,6 +9,9 @@ type SelectBool: boolean; TextString: String; TextTiles: Array of String; + + STicks: Cardinal; + SelectBlink: Boolean; public X: real; Y: real; @@ -38,11 +41,15 @@ type end; implementation -uses UGraphic, StrUtils; +uses UGraphic, StrUtils, Windows; procedure TText.SetSelect(Value: Boolean); begin SelectBool := Value; + + //Set Cursor Visible + SelectBlink := True; + STicks := GettickCount div 550; end; procedure TText.SetText(Value: String); @@ -99,6 +106,10 @@ begin TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak); end; + + //Set Cursor Visible + SelectBlink := True; + STicks := GettickCount div 550; end; Procedure TText.DeleteLastL; @@ -125,9 +136,21 @@ begin SetFontSize(Size); SetFontItalic(False); glColor3f(ColR*Int, ColG*Int, ColB*Int); + + //If Selected Set Blink... + if SelectBool then + begin + I := Gettickcount div 550; + if I <> STicks then + begin //Change Visability + STicks := I; + SelectBlink := Not SelectBlink; + end; + end; + if (W <= 0) then //No Width set Draw as one Long String begin - if not SelectBool then + if not (SelectBool AND SelectBlink) then Text2 := Text else Text2 := Text + '|'; @@ -147,7 +170,7 @@ begin Y2 := Y; for I := 0 to high(TextTiles) do begin - if (not SelectBool) OR (I <> high(TextTiles)) then + if (not (SelectBool AND SelectBlink)) OR (I <> high(TextTiles)) then Text2 := TextTiles[I] else Text2 := TextTiles[I] + '|'; -- cgit v1.2.3