'help' command test

This commit is contained in:
MihailRis
2024-05-16 20:50:16 +03:00
parent abf8d4f796
commit d0b7dec225
5 changed files with 187 additions and 30 deletions
+18 -16
View File
@@ -32,22 +32,6 @@ void TextBox::draw(const DrawContext* pctx, Assets* assets) {
font = assets->getFont(label->getFontName());
if (autoresize && font) {
auto size = getSize();
int newy = glm::min(static_cast<int>(parent->getSize().y),
static_cast<int>(
label->getLinesNumber() *
label->getLineInterval() *
font->getLineHeight()) + 1
);
if (newy != static_cast<int>(size.y)) {
size.y = newy;
setSize(size);
if (positionfunc) {
pos = positionfunc();
}
}
}
if (!isFocused()) {
return;
}
@@ -141,6 +125,24 @@ void TextBox::drawBackground(const DrawContext* pctx, Assets*) {
void TextBox::refreshLabel() {
label->setColor(glm::vec4(input.empty() ? 0.5f : 1.0f));
label->setText(getText());
if (autoresize && font) {
auto size = getSize();
int newy = glm::min(static_cast<int>(parent->getSize().y),
static_cast<int>(
label->getLinesNumber() *
label->getLineInterval() *
font->getLineHeight()) + 1
);
if (newy != static_cast<int>(size.y)) {
size.y = newy;
setSize(size);
if (positionfunc) {
pos = positionfunc();
}
}
}
if (multiline && font) {
setScrollable(true);
uint height = label->getLinesNumber() * font->getLineHeight() * label->getLineInterval();