116 // SetLength(str, Length(InputLinePrefix) + cursorPos); // makes pas2c unhappy |
116 // SetLength(str, Length(InputLinePrefix) + cursorPos); // makes pas2c unhappy |
117 str[0]:= char(Length(InputLinePrefix) + cursorPos); |
117 str[0]:= char(Length(InputLinePrefix) + cursorPos); |
118 // get render size of text |
118 // get render size of text |
119 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); |
119 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); |
120 |
120 |
121 cursorX:= 7 - cScreenWidth div 2 + coff; |
121 cursorX:= 3 + coff; |
122 |
122 |
123 // calculate selection width on screen |
123 // calculate selection width on screen |
124 if selectedPos >= 0 then |
124 if selectedPos >= 0 then |
125 begin |
125 begin |
126 if selectedPos > cursorPos then |
126 if selectedPos > cursorPos then |
266 DrawTexture(left, top, InputStr.Tex); |
266 DrawTexture(left, top, InputStr.Tex); |
267 if selectedPos < 0 then |
267 if selectedPos < 0 then |
268 begin |
268 begin |
269 // draw cursor |
269 // draw cursor |
270 if ((RealTicks - LastKeyPressTick) and 512) < 256 then |
270 if ((RealTicks - LastKeyPressTick) and 512) < 256 then |
271 DrawLineOnScreen(cursorX, top + 2, cursorX, top + ClHeight - 2, 2.0, $00, $FF, $FF, $FF); |
271 DrawLineOnScreen(left + cursorX, top + 2, left + cursorX, top + ClHeight - 2, 2.0, $00, $FF, $FF, $FF); |
272 end |
272 end |
273 else // draw selection |
273 else // draw selection |
274 begin |
274 begin |
275 selRect.y:= top + 2; |
275 selRect.y:= top + 2; |
276 selRect.h:= clHeight - 4; |
276 selRect.h:= clHeight - 4; |
277 if selectionDx < 0 then |
277 if selectionDx < 0 then |
278 begin |
278 begin |
279 selRect.x:= cursorX + selectionDx; |
279 selRect.x:= left + cursorX + selectionDx; |
280 selRect.w:= -selectionDx; |
280 selRect.w:= -selectionDx; |
281 end |
281 end |
282 else |
282 else |
283 begin |
283 begin |
284 selRect.x:= cursorX; |
284 selRect.x:= left + cursorX; |
285 selRect.w:= selectionDx; |
285 selRect.w:= selectionDx; |
286 end; |
286 end; |
287 |
287 |
288 DrawRect(selRect, $FF, $FF, $FF, $40, true); |
288 DrawRect(selRect, $FF, $FF, $FF, $40, true); |
289 end; |
289 end; |
823 {$ENDIF} |
823 {$ENDIF} |
824 if length(s) = 0 then |
824 if length(s) = 0 then |
825 SetLine(InputStr, '', true) |
825 SetLine(InputStr, '', true) |
826 else |
826 else |
827 SetLine(InputStr, '/team ', true) |
827 SetLine(InputStr, '/team ', true) |
|
828 // TODO: update InputStrL accordingly! |
828 end; |
829 end; |
829 |
830 |
830 procedure initModule; |
831 procedure initModule; |
831 var i: ShortInt; |
832 var i: ShortInt; |
832 begin |
833 begin |