diff --git a/examples/core/core_2d_camera_mouse_zoom.c b/examples/core/core_2d_camera_mouse_zoom.c index 8af94440..a9864b16 100644 --- a/examples/core/core_2d_camera_mouse_zoom.c +++ b/examples/core/core_2d_camera_mouse_zoom.c @@ -45,7 +45,7 @@ int main () else if (IsKeyPressed(KEY_TWO)) zoomMode = 1; // Translate based on mouse right click - if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) + if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) { Vector2 delta = GetMouseDelta(); delta = Vector2Scale(delta, -1.0f/camera.zoom); @@ -76,8 +76,8 @@ int main () } else { - // Zoom based on mouse left click - if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) + // Zoom based on mouse right click + if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) { // Get the world point that is under the mouse Vector2 mouseWorldPos = GetScreenToWorld2D(GetMousePosition(), camera); @@ -89,7 +89,7 @@ int main () // under the cursor to the screen space point under the cursor at any zoom camera.target = mouseWorldPos; } - if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) + if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) { // Zoom increment float deltaX = GetMouseDelta().x; @@ -119,10 +119,16 @@ int main () DrawCircle(GetScreenWidth()/2, GetScreenHeight()/2, 50, MAROON); EndMode2D(); + + // Draw mouse reference + //Vector2 mousePos = GetWorldToScreen2D(GetMousePosition(), camera) + DrawCircleV(GetMousePosition(), 4, DARKGRAY); + DrawTextEx(GetFontDefault(), TextFormat("[%i, %i]", GetMouseX(), GetMouseY()), + Vector2Add(GetMousePosition(), (Vector2){ -44, -24 }), 20, 2, BLACK); DrawText("[1][2] Select mouse zoom mode (Wheel or Move)", 20, 20, 20, DARKGRAY); - if (zoomMode == 0) DrawText("Mouse right button drag to move, mouse wheel to zoom", 20, 50, 20, DARKGRAY); - else DrawText("Mouse right button drag to move, mouse press and move to zoom", 20, 50, 20, DARKGRAY); + if (zoomMode == 0) DrawText("Mouse left button drag to move, mouse wheel to zoom", 20, 50, 20, DARKGRAY); + else DrawText("Mouse left button drag to move, mouse press and move to zoom", 20, 50, 20, DARKGRAY); EndDrawing(); //----------------------------------------------------------------------------------