This commit is contained in:
Patrick Jakobsen committed 2023-10-01 14:26:25 +02:00
1 parent 4cdc17489e
commit 80f5e9056a
1 file changed
+11 -4
+11 -4
View File
@@ -426,7 +426,10 @@ void gui_apply_input(
int mouse_over_node = 0; int mouse_over_node = 0;
while(current_node != NULL) 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) if(mouse_over_node)
{ {
top_node_under_cursor = current_node; top_node_under_cursor = current_node;
@@ -1937,7 +1940,7 @@ void test_gui__subtree(
static bool tooltip_toggle = false; static bool tooltip_toggle = false;
static GUI_Node_Reference dirty_button3 = {0}; static GUI_Node_Reference dirty_button3 = {0};
if(gui_dumb_button( if(gui_dumb_button(
context, &dirty_button3, GUI_STRING("Hover for tooltip"), context, &dirty_button3, GUI_STRING("Toggle tooltip"),
&button_style, button_size)) &button_style, button_size))
{ {
tooltip_toggle = !tooltip_toggle; tooltip_toggle = !tooltip_toggle;
@@ -1955,8 +1958,12 @@ void test_gui__subtree(
{GUI_SIZERULE_PERCENTOFPARENT, 100, 100}, {GUI_SIZERULE_PERCENTOFPARENT, 100, 100},
{GUI_SIZERULE_PERCENTOFPARENT, 100, 100}}; {GUI_SIZERULE_PERCENTOFPARENT, 100, 100}};
static GUI_Node_Reference top_layer_block = {0}; static GUI_Node_Reference top_layer_block = {0};
top_layer_block = gui_dumb_block( if(gui_dumb_button(
context, top_layer_block, &element_style, full_size); context, &top_layer_block, GUI_STRING("Hi!"),
&element_style, full_size))
{
printf("Top layer says hi!\n");
}
} }
} }
} gui_pop_parent(context); // middle. } gui_pop_parent(context); // middle.