diff options
| author | ilotterytea <iltsu@alright.party> | 2025-01-26 21:39:53 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-01-26 21:39:53 +0500 |
| commit | 0a5506c2c178fc9b842bc6c9026633e171d1beb3 (patch) | |
| tree | 9b38cd245cceabebf3e50ed48495a22ddd74dfbe /src/main.c | |
| parent | 8103af34f70cbb7747c232875fbbcfe3b0a8dc9f (diff) | |
upd: ignore camera interaction if mouse is doing something in toolkit
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -42,19 +42,22 @@ int main() { camera.zoom = 4.0f; while (!WindowShouldClose()) { - if (GetMouseWheelMove() != 0.0) { - camera.zoom += (int)GetMouseWheelMove(); - - if (camera.zoom > 6.0f) - camera.zoom = 6.0f; - else if (camera.zoom < 4.0f) - camera.zoom = 4.0f; - } - - if (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE)) { - Vector2 mousePos = GetMouseDelta(); - camera.target.x -= mousePos.x / 5.0f; - camera.target.y -= mousePos.y / 5.0f; + // interact with the map if the mouse is outside build tab + if (GetMousePosition().x < EDITOR_TOOLKIT_X) { + if (GetMouseWheelMove() != 0.0) { + camera.zoom += (int)GetMouseWheelMove(); + + if (camera.zoom > 6.0f) + camera.zoom = 6.0f; + else if (camera.zoom < 4.0f) + camera.zoom = 4.0f; + } + + if (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE)) { + Vector2 mousePos = GetMouseDelta(); + camera.target.x -= mousePos.x / 5.0f; + camera.target.y -= mousePos.y / 5.0f; + } } BeginDrawing(); |
