From 34f081520c754cc20c2ec929be7798fe3f3806e1 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 2 Feb 2025 13:52:24 +0500 Subject: fix: tiles were placed if editor is focused --- src/editor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/editor.cpp b/src/editor.cpp index d59cd64..74326bf 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -76,8 +76,8 @@ namespace silly::editor { sf::Mouse::isButtonPressed(sf::Mouse::Button::Right)) && !this->package.get_levels().empty() && !this->package.get_current_level().get_floors().empty()) { - sf::Vector2f mousePosition = - window.mapPixelToCoords(sf::Mouse::getPosition(window)); + sf::Vector2i pos = sf::Mouse::getPosition(window); + sf::Vector2f mousePosition = window.mapPixelToCoords(pos); TileLevel &level = this->package.get_current_level(); TileFloor &floor = level.get_current_floor(); @@ -89,7 +89,7 @@ namespace silly::editor { if ((rx < mousePosition.x && mousePosition.x < rx + TILE_WIDTH) && (ry < mousePosition.y && mousePosition.y < ry + TILE_HEIGHT) && // editor related - mousePosition.x < window.getSize().x - 400.0f && + pos.x < window.getSize().x - 400.0f && !this->newTileState.has_value()) { sf::Vector2i pos(x, y); -- cgit v1.2.3