summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-01-26 21:39:53 +0500
committerilotterytea <iltsu@alright.party>2025-01-26 21:39:53 +0500
commit0a5506c2c178fc9b842bc6c9026633e171d1beb3 (patch)
tree9b38cd245cceabebf3e50ed48495a22ddd74dfbe /src/main.c
parent8103af34f70cbb7747c232875fbbcfe3b0a8dc9f (diff)
upd: ignore camera interaction if mouse is doing something in toolkit
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c29
1 files changed, 16 insertions, 13 deletions
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();