From 6f7374c2fa58c8692b51018864b802e6b876d305 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 23 Nov 2024 21:52:24 +0100 Subject: A new start --- src/tooltip.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/tooltip.c (limited to 'src/tooltip.c') diff --git a/src/tooltip.c b/src/tooltip.c new file mode 100644 index 0000000..5098ba7 --- /dev/null +++ b/src/tooltip.c @@ -0,0 +1,22 @@ +#define TOOLTIP_PAD (scale*14) + +void show_tooltip(s32 x, s32 y, char* buf) { + tooltop_visible = true; + string_copyn(tooltip_buffer, buf, 100); + tooltip_x = x+(20*scale); + tooltip_y = y-(fnt_rd16->px_h + (TOOLTIP_PAD))/2; +} + +void update_render_tooltip() { + if (!tooltop_visible) return; + s32 current_render_depth = gl_render_depth; + renderer->set_render_depth(10); + + s32 info_w = renderer->calculate_text_width(fnt_rd16, tooltip_buffer) + (TOOLTIP_PAD); + s32 info_h = fnt_rd16->px_h + (TOOLTIP_PAD); + button_draw_background(scale, tooltip_x, tooltip_y, info_w, info_h, COLOR_WHITE, COLOR_BUTTON); + renderer->render_text(fnt_rd16, tooltip_x+(TOOLTIP_PAD/2), tooltip_y+(TOOLTIP_PAD/2), tooltip_buffer, COLOR_TEXT); + + renderer->set_render_depth(current_render_depth); + tooltop_visible = false; +} -- cgit v1.2.3-70-g09d2