aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-31 14:34:02 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-31 14:34:02 +0000
commitc966985d9af377f4c146d5ab0f241f31d5984676 (patch)
tree5391fdea45a653e6565b63675806636f55051ddf /src
parent257854c587f0876a912cfbeb4fe0a30970d25a9b (diff)
downloadusdx-c966985d9af377f4c146d5ab0f241f31d5984676.tar.gz
usdx-c966985d9af377f4c146d5ab0f241f31d5984676.tar.xz
usdx-c966985d9af377f4c146d5ab0f241f31d5984676.zip
fixed a bug in UMenuText that causes (some of) the crashs in USongJumpTo
some bad coding style by myself also fixed thx to AlexanderS git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1790 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src')
-rw-r--r--src/menu/UMenuText.pas19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/menu/UMenuText.pas b/src/menu/UMenuText.pas
index 0f9c753f..b000cc73 100644
--- a/src/menu/UMenuText.pas
+++ b/src/menu/UMenuText.pas
@@ -260,7 +260,8 @@ procedure TText.Draw;
var
X2, Y2: real;
Text2: string;
- I: cardinal;
+ I: Integer;
+ Ticks: Cardinal;
begin
if Visible then
begin
@@ -279,10 +280,10 @@ begin
//if selected set blink...
if SelectBool then
begin
- I := SDL_GetTicks() div 550;
- if I <> STicks then
+ Ticks := SDL_GetTicks() div 550;
+ if Ticks <> STicks then
begin //Change Visability
- STicks := I;
+ STicks := Ticks;
SelectBlink := Not SelectBlink;
end;
end;
@@ -309,17 +310,17 @@ begin
//now use allways:
//draw text as many strings
Y2 := Y + MoveY;
- for I := 0 to high(TextTiles) do
+ for I := 0 to High(TextTiles) do
begin
- if (not (SelectBool and SelectBlink)) or (I <> cardinal(high(TextTiles))) then
+ if (not (SelectBool and SelectBlink)) or (I <> High(TextTiles)) then
Text2 := TextTiles[I]
else
Text2 := TextTiles[I] + '|';
case Align of
- 0: X2 := X + MoveX;
- 1: X2 := X + MoveX - glTextWidth(Text2)/2;
- 2: X2 := X + MoveX - glTextWidth(Text2);
+ 1: X2 := X + MoveX - glTextWidth(Text2)/2; { centered }
+ 2: X2 := X + MoveX - glTextWidth(Text2); { right aligned }
+ else X2 := X + MoveX; { left aligned (default) }
end;
SetFontPos(X2, Y2);