# HG changeset patch # User sheepluva # Date 1425226322 -3600 # Node ID a039464cbb4abdb5546280202a96fc85119238c4 # Parent 6b0a839f399eca19e5684cc51d6303811a3894db since fonts can be loaded in late, update cursor position before first chat display diff -r 6b0a839f399e -r a039464cbb4a hedgewars/uChat.pas --- a/hedgewars/uChat.pas Sun Mar 01 16:45:24 2015 +0100 +++ b/hedgewars/uChat.pas Sun Mar 01 17:12:02 2015 +0100 @@ -62,6 +62,7 @@ showAll: boolean; liveLua: boolean; ChatHidden: boolean; + firstDraw: boolean; InputLinePrefix: shortstring; // cursor cursorPos, cursorX, selectedPos, selectionDx: LongInt; @@ -118,7 +119,7 @@ // get render size of text TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); - cursorX:= 3 + coff; + cursorX:= 2 + coff; // calculate selection width on screen if selectedPos >= 0 then @@ -263,6 +264,12 @@ // draw chat input line first and under all other lines if (GameState = gsChat) and (InputStr.Tex <> nil) then begin + if firstDraw then + begin + UpdateCursorCoords(); + firstDraw:= false; + end; + DrawTexture(left, top, InputStr.Tex); if selectedPos < 0 then begin @@ -852,6 +859,7 @@ missedCount:= 0; liveLua:= false; ChatHidden:= false; + firstDraw:= true; InputLinePrefix:= UserNick + '> '; inputStr.s:= '';