Update portable_window.c

This commit is contained in:
Ray 2023-05-28 11:13:21 +02:00
parent 6650ad0ffa
commit 4f48e5a3c7

View File

@ -53,7 +53,7 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
mousePosition = GetMousePosition(); mousePosition = GetMousePosition();
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && !dragWindow)
{ {
if (CheckCollisionPointRec(mousePosition, (Rectangle){ 0, 0, screenWidth, 20 })) if (CheckCollisionPointRec(mousePosition, (Rectangle){ 0, 0, screenWidth, 20 }))
{ {
@ -66,10 +66,10 @@ int main()
{ {
windowPosition.x += (mousePosition.x - panOffset.x); windowPosition.x += (mousePosition.x - panOffset.x);
windowPosition.y += (mousePosition.y - panOffset.y); windowPosition.y += (mousePosition.y - panOffset.y);
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) dragWindow = false;
SetWindowPosition(windowPosition.x, windowPosition.y); SetWindowPosition(windowPosition.x, windowPosition.y);
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) dragWindow = false;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------