@@ -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);
|
||||
|
||||
@@ -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]); \
|
||||
}
|
||||
|
||||
|
||||
@@ -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-----------
|
||||
|
||||
Reference in New Issue
Block a user