From 0a5506c2c178fc9b842bc6c9026633e171d1beb3 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 26 Jan 2025 21:39:53 +0500 Subject: upd: ignore camera interaction if mouse is doing something in toolkit --- src/main.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index cc9c25e..271ce40 100644 --- a/src/main.c +++ b/src/main.c @@ -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(); -- cgit v1.2.3