diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-23 21:52:24 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-23 21:52:24 +0100 |
| commit | 6f7374c2fa58c8692b51018864b802e6b876d305 (patch) | |
| tree | a7e8ead757e9f4de1920395336dcac1c8a989576 /src/tooltip.c | |
A new start
Diffstat (limited to 'src/tooltip.c')
| -rw-r--r-- | src/tooltip.c | 22 |
1 files changed, 22 insertions, 0 deletions
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;
+}
|
