diff options
| author | ilotterytea <iltsu@alright.party> | 2025-02-02 13:52:24 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-02-02 13:52:24 +0500 |
| commit | 34f081520c754cc20c2ec929be7798fe3f3806e1 (patch) | |
| tree | 03f67e2290374ac56fe7703c709cc1eee353e419 /src/editor.cpp | |
| parent | 1bb2be007fb9eb2bb9f8aada2781c9f975f9627e (diff) | |
fix: tiles were placed if editor is focused
Diffstat (limited to 'src/editor.cpp')
| -rw-r--r-- | src/editor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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); |
