From 48923d6ae620939b8d5aae71175c424c5ac57613 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Fri, 31 Jan 2025 02:54:55 +0500 Subject: upd: ignore clicks behind editor and when user is creating block --- src/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 6c0e533..88a8b18 100644 --- a/src/main.c +++ b/src/main.c @@ -30,10 +30,16 @@ int main() { while (!WindowShouldClose()) { SE_UpdateEditor(&editor); - SE_UpdateTileFloor(&editor.state, floor, &camera); - // interact with the map if the mouse is outside build tab - if (GetMousePosition().x < EDITOR_TOOLKIT_X) { + bool isEditorFocused = + CheckCollisionPointRec( + GetMousePosition(), + (Rectangle){0.0f, 0.0f, EDITOR_TOOLKIT_X, GetScreenHeight()}) && + editor.state.createBlockState == NULL; + + if (isEditorFocused) { + SE_UpdateTileFloor(&editor.state, floor, &camera); + if (GetMouseWheelMove() != 0.0) { camera.zoom += (int)GetMouseWheelMove(); -- cgit v1.2.3