equal
deleted
inserted
replaced
60 InputStrL: TInputStrL; // for full str + 4-byte utf-8 char |
60 InputStrL: TInputStrL; // for full str + 4-byte utf-8 char |
61 ChatReady: boolean; |
61 ChatReady: boolean; |
62 showAll: boolean; |
62 showAll: boolean; |
63 liveLua: boolean; |
63 liveLua: boolean; |
64 ChatHidden: boolean; |
64 ChatHidden: boolean; |
|
65 firstDraw: boolean; |
65 InputLinePrefix: shortstring; |
66 InputLinePrefix: shortstring; |
66 // cursor |
67 // cursor |
67 cursorPos, cursorX, selectedPos, selectionDx: LongInt; |
68 cursorPos, cursorX, selectedPos, selectionDx: LongInt; |
68 LastKeyPressTick: LongWord; |
69 LastKeyPressTick: LongWord; |
69 |
70 |
116 // SetLength(str, Length(InputLinePrefix) + cursorPos); // makes pas2c unhappy |
117 // SetLength(str, Length(InputLinePrefix) + cursorPos); // makes pas2c unhappy |
117 str[0]:= char(Length(InputLinePrefix) + cursorPos); |
118 str[0]:= char(Length(InputLinePrefix) + cursorPos); |
118 // get render size of text |
119 // get render size of text |
119 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); |
120 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); |
120 |
121 |
121 cursorX:= 3 + coff; |
122 cursorX:= 2 + coff; |
122 |
123 |
123 // calculate selection width on screen |
124 // calculate selection width on screen |
124 if selectedPos >= 0 then |
125 if selectedPos >= 0 then |
125 begin |
126 begin |
126 if selectedPos > cursorPos then |
127 if selectedPos > cursorPos then |
261 top := 10 + visibleCount * ClHeight; // we start with input line (if any) |
262 top := 10 + visibleCount * ClHeight; // we start with input line (if any) |
262 |
263 |
263 // draw chat input line first and under all other lines |
264 // draw chat input line first and under all other lines |
264 if (GameState = gsChat) and (InputStr.Tex <> nil) then |
265 if (GameState = gsChat) and (InputStr.Tex <> nil) then |
265 begin |
266 begin |
|
267 if firstDraw then |
|
268 begin |
|
269 UpdateCursorCoords(); |
|
270 firstDraw:= false; |
|
271 end; |
|
272 |
266 DrawTexture(left, top, InputStr.Tex); |
273 DrawTexture(left, top, InputStr.Tex); |
267 if selectedPos < 0 then |
274 if selectedPos < 0 then |
268 begin |
275 begin |
269 // draw cursor |
276 // draw cursor |
270 if ((RealTicks - LastKeyPressTick) and 512) < 256 then |
277 if ((RealTicks - LastKeyPressTick) and 512) < 256 then |
850 showAll:= false; |
857 showAll:= false; |
851 ChatReady:= false; |
858 ChatReady:= false; |
852 missedCount:= 0; |
859 missedCount:= 0; |
853 liveLua:= false; |
860 liveLua:= false; |
854 ChatHidden:= false; |
861 ChatHidden:= false; |
|
862 firstDraw:= true; |
855 |
863 |
856 InputLinePrefix:= UserNick + '> '; |
864 InputLinePrefix:= UserNick + '> '; |
857 inputStr.s:= ''; |
865 inputStr.s:= ''; |
858 inputStr.Tex := nil; |
866 inputStr.Tex := nil; |
859 for i:= 0 to MaxStrIndex do |
867 for i:= 0 to MaxStrIndex do |