# HG changeset patch # User sheepluva # Date 1425223934 -3600 # Node ID aa0ceb47da1dfa325678a97414d4e1886ede78da # Parent 2abe883c9c21b9ee1c91b1550e3daf54d0f13f04 make sure cursor drawing position does not get messed up by screen resize diff -r 2abe883c9c21 -r aa0ceb47da1d hedgewars/uChat.pas --- a/hedgewars/uChat.pas Sun Mar 01 15:56:00 2015 +0100 +++ b/hedgewars/uChat.pas Sun Mar 01 16:32:14 2015 +0100 @@ -118,7 +118,7 @@ // get render size of text TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); - cursorX:= 7 - cScreenWidth div 2 + coff; + cursorX:= 3 + coff; // calculate selection width on screen if selectedPos >= 0 then @@ -268,7 +268,7 @@ begin // draw cursor if ((RealTicks - LastKeyPressTick) and 512) < 256 then - DrawLineOnScreen(cursorX, top + 2, cursorX, top + ClHeight - 2, 2.0, $00, $FF, $FF, $FF); + DrawLineOnScreen(left + cursorX, top + 2, left + cursorX, top + ClHeight - 2, 2.0, $00, $FF, $FF, $FF); end else // draw selection begin @@ -276,12 +276,12 @@ selRect.h:= clHeight - 4; if selectionDx < 0 then begin - selRect.x:= cursorX + selectionDx; + selRect.x:= left + cursorX + selectionDx; selRect.w:= -selectionDx; end else begin - selRect.x:= cursorX; + selRect.x:= left + cursorX; selRect.w:= selectionDx; end; @@ -825,6 +825,7 @@ SetLine(InputStr, '', true) else SetLine(InputStr, '/team ', true) + // TODO: update InputStrL accordingly! end; procedure initModule;