diff --git a/include/dawn/ui/label.h b/include/dawn/ui/label.h index 198053d1..887458d1 100644 --- a/include/dawn/ui/label.h +++ b/include/dawn/ui/label.h @@ -14,6 +14,7 @@ typedef struct { font_t *font; float fontSize; + float maxWidth; fonttextinfo_t info; primitive_t primitive; } label_t; \ No newline at end of file diff --git a/src/game/sandbox/sandboxscene.c b/src/game/sandbox/sandboxscene.c index c0fd91c3..ce54c07a 100644 --- a/src/game/sandbox/sandboxscene.c +++ b/src/game/sandbox/sandboxscene.c @@ -48,7 +48,7 @@ void sandboxSceneUpdate(sandboxscene_t *game, engine_t *engine) { gridSetSize(&menu.menu.grid, engine->render.width, engine->render.height, - engine->render.width, FONT_LINE_HEIGHT * fontGetScale(16.0f) * 3, + 100.0f, FONT_LINE_HEIGHT * fontGetScale(16.0f) * 3, 0, 0 ); menu2Update(&menu.menu, engine); diff --git a/src/ui/label.c b/src/ui/label.c index faf6922d..55ee1bbf 100644 --- a/src/ui/label.c +++ b/src/ui/label.c @@ -10,6 +10,7 @@ void labelInit(label_t *label) { label->fontSize = FONT_SIZE_DEFAULT; label->font = NULL; + label->maxWidth = -1; label->primitive.verticeCount = 0; } @@ -20,7 +21,7 @@ void labelSetText(label_t *label, font_t *font, char *text) { } label->font = font; - fontTextClamp(font, &label->info, text, -1, label->fontSize); + fontTextClamp(font, &label->info, text, label->maxWidth, label->fontSize); fontTextInit(font, &label->primitive, &label->info); } diff --git a/src/ui/textmenu.c b/src/ui/textmenu.c index e8e44c46..f0f9bf68 100644 --- a/src/ui/textmenu.c +++ b/src/ui/textmenu.c @@ -28,6 +28,7 @@ void _textMenuOnResize( info->y = y; info->width = width; info->height = height; + label->maxWidth = width; labelSetText(label, textMenu->font, textMenu->texts[i]); }