diff --git a/sphaira/include/ui/nvg_util.hpp b/sphaira/include/ui/nvg_util.hpp index f15dc95..2fb6ae5 100644 --- a/sphaira/include/ui/nvg_util.hpp +++ b/sphaira/include/ui/nvg_util.hpp @@ -30,7 +30,8 @@ void drawTextArgs(NVGcontext*, float x, float y, float size, int align, const NV void drawTextBox(NVGcontext*, float x, float y, float size, float bound, const NVGcolor& c, const char* str, int align = NVG_ALIGN_LEFT | NVG_ALIGN_TOP, const char* end = nullptr); -void textBounds(NVGcontext*, float x, float y, float *bounds, const char* str, ...) __attribute__ ((format (printf, 5, 6))); +void textBounds(NVGcontext*, float x, float y, float *bounds, const char* str); +void textBoundsArgs(NVGcontext*, float x, float y, float *bounds, const char* str, ...) __attribute__ ((format (printf, 5, 6))); auto getButton(Button button) -> const char*; void drawScrollbar(NVGcontext*, const Theme*, u32 index_off, u32 count, u32 max_per_page); diff --git a/sphaira/source/ui/menus/menu_base.cpp b/sphaira/source/ui/menus/menu_base.cpp index 2c665f5..e8f4e93 100644 --- a/sphaira/source/ui/menus/menu_base.cpp +++ b/sphaira/source/ui/menus/menu_base.cpp @@ -73,7 +73,7 @@ void MenuBase::Draw(NVGcontext* vg, Theme* theme) { if (fixed) { \ start_x -= fixed; \ } else { \ - gfx::textBounds(vg, 0, 0, bounds, __VA_ARGS__); \ + gfx::textBoundsArgs(vg, 0, 0, bounds, __VA_ARGS__); \ start_x -= spacing + (bounds[2] - bounds[0]); \ } diff --git a/sphaira/source/ui/nvg_util.cpp b/sphaira/source/ui/nvg_util.cpp index 74f0ac0..7b8e5b0 100644 --- a/sphaira/source/ui/nvg_util.cpp +++ b/sphaira/source/ui/nvg_util.cpp @@ -230,13 +230,17 @@ void drawTextBox(NVGcontext* vg, float x, float y, float size, float bound, cons nvgTextBox(vg, x, y, bound, str, end); } -void textBounds(NVGcontext* vg, float x, float y, float *bounds, const char* str, ...) { +void textBounds(NVGcontext* vg, float x, float y, float *bounds, const char* str) { + nvgTextBounds(vg, x, y, str, nullptr, bounds); +} + +void textBoundsArgs(NVGcontext* vg, float x, float y, float *bounds, const char* str, ...) { char buf[0x100]; va_list v; va_start(v, str); std::vsnprintf(buf, sizeof(buf), str, v); va_end(v); - nvgTextBounds(vg, x, y, buf, nullptr, bounds); + textBounds(vg, x, y, bounds, buf); } // NEW-----------