From 80f5e9056a59e64bd4f9e3e05810dcb9f7ab1045 Mon Sep 17 00:00:00 2001 From: Patrick Jakobsen Date: Sun, 1 Oct 2023 14:26:25 +0200 Subject: [PATCH] . --- gui/gui.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gui/gui.c b/gui/gui.c index 2686fb0..3ff0c2c 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -426,7 +426,10 @@ void gui_apply_input( int mouse_over_node = 0; while(current_node != NULL) { - mouse_over_node = point_in_rect(mouse_x, mouse_y, current_node->rect); + mouse_over_node = point_in_rect_with_offset( + mouse_x, mouse_y, + current_node->rect, + hit_layer->offset_x, hit_layer->offset_y); if(mouse_over_node) { top_node_under_cursor = current_node; @@ -1937,7 +1940,7 @@ void test_gui__subtree( static bool tooltip_toggle = false; static GUI_Node_Reference dirty_button3 = {0}; if(gui_dumb_button( - context, &dirty_button3, GUI_STRING("Hover for tooltip"), + context, &dirty_button3, GUI_STRING("Toggle tooltip"), &button_style, button_size)) { tooltip_toggle = !tooltip_toggle; @@ -1955,8 +1958,12 @@ void test_gui__subtree( {GUI_SIZERULE_PERCENTOFPARENT, 100, 100}, {GUI_SIZERULE_PERCENTOFPARENT, 100, 100}}; static GUI_Node_Reference top_layer_block = {0}; - top_layer_block = gui_dumb_block( - context, top_layer_block, &element_style, full_size); + if(gui_dumb_button( + context, &top_layer_block, GUI_STRING("Hi!"), + &element_style, full_size)) + { + printf("Top layer says hi!\n"); + } } } } gui_pop_parent(context); // middle.