MCPcopy Create free account
hub / github.com/MyGUI/mygui / getCursorPoint

Method getCursorPoint

MyGUIEngine/src/MyGUI_TextView.cpp:325–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323 }
324
325 IntPoint TextView::getCursorPoint(size_t _position) const
326 {
327 setMin(_position, mLength);
328
329 size_t position = 0;
330 int top = 0;
331 float left = 0.0f;
332 for (const auto& line : mLineInfo)
333 {
334 left = (float)line.offset;
335 if (position + line.count >= _position)
336 {
337 for (const auto& sym : line.symbols)
338 {
339 if (sym.isColour())
340 continue;
341
342 if (position == _position)
343 break;
344
345 position++;
346 left += sym.getBearingX() + sym.getAdvance();
347 }
348 break;
349 }
350 position += line.count + 1;
351 top += mFontHeight;
352 }
353
354 return {(int)left, top};
355 }
356
357 const IntSize& TextView::getViewSize() const
358 {

Callers 4

onKeyButtonPressedMethod · 0.80
frameEnteredMethod · 0.80
getCursorCoordMethod · 0.80
doRenderMethod · 0.80

Calls 4

setMinFunction · 0.85
isColourMethod · 0.80
getBearingXMethod · 0.80
getAdvanceMethod · 0.80

Tested by

no test coverage detected