diff --git a/examples/Makefile b/examples/Makefile index 5fd1e97..664f0b0 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -356,7 +356,8 @@ EXAMPLES = \ scroll_panel/scroll_panel \ style_selector/style_selector \ custom_sliders/custom_sliders \ - animation_curve/animation_curve + animation_curve/animation_curve \ + floating_window/floating_window \ CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST)) diff --git a/examples/floating_window/floating_window.c b/examples/floating_window/floating_window.c index b6b7058..df6bc31 100644 --- a/examples/floating_window/floating_window.c +++ b/examples/floating_window/floating_window.c @@ -1,7 +1,7 @@ #include "raylib.h" #define RAYGUI_IMPLEMENTATION -#include "../../raygui.h" +#include "../../src/raygui.h" #include "../../styles/dark/style_dark.h" @@ -61,9 +61,11 @@ void GuiWindowFloating(Vector2 *position, Vector2 *size, bool *minimized, bool * } } else if(*resizing) { - Vector2 mouse_delta = GetMouseDelta(); - size->x += mouse_delta.x; - size->y += mouse_delta.y; + Vector2 mouse = GetMousePosition(); + if (mouse.x > position->x) + size->x = mouse.x - position->x; + if (mouse.y > position->y) + size->y = mouse.y - position->y; // clamp window size to an arbitrary minimum value and the window size as the maximum if(size->x < 100) size->x = 100; @@ -143,4 +145,4 @@ int main(void) { CloseWindow(); return 0; -} \ No newline at end of file +}