Add a `getTextHeight` to the GuiText class
This commit is contained in:
parent
85abf9a572
commit
545046971a
|
@ -104,6 +104,7 @@ public:
|
|||
return maxWidth;
|
||||
}
|
||||
|
||||
float getTextHeight();
|
||||
|
||||
void setSSAA(int32_t ssaa) {
|
||||
this->internalSSAA = ssaa;
|
||||
|
|
|
@ -292,6 +292,18 @@ int32_t GuiText::getTextWidth() {
|
|||
res = res > maxWidth && maxWidth > 0 ? maxWidth : res;
|
||||
textMutex.unlock();
|
||||
return res;
|
||||
}
|
||||
|
||||
float GuiText::getTextHeight() {
|
||||
textMutex.lock();
|
||||
if (wrapMode == GuiText::WRAP && textDyn.empty()) {
|
||||
if (maxWidth > 0 && font->getWidth(text, currentSize)) {
|
||||
wrapText();
|
||||
}
|
||||
}
|
||||
|
||||
auto res = textDyn.empty() ? getLineHeight() : getLineHeight() * textDyn.size();
|
||||
textMutex.unlock();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue