diff options
| author | ilotterytea <iltsu@alright.party> | 2025-02-01 21:39:43 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-02-01 21:39:43 +0500 |
| commit | c89db32c69c2ca3db059193591ec910d45fbbcc3 (patch) | |
| tree | fc47fd9296273a8087f250af434f78387c092d5a /src/floor.cpp | |
| parent | 50e4d4c490782d878cb8777348c3c285f60cd592 (diff) | |
feat: tile creation + editor panel
Diffstat (limited to 'src/floor.cpp')
| -rw-r--r-- | src/floor.cpp | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/floor.cpp b/src/floor.cpp index f081008..9f94ad3 100644 --- a/src/floor.cpp +++ b/src/floor.cpp @@ -3,35 +3,10 @@ #include <SFML/Graphics/RectangleShape.hpp> #include <SFML/Graphics/RenderWindow.hpp> #include <SFML/System/Vector2.hpp> -#include <SFML/Window/Mouse.hpp> #include <algorithm> #include <iterator> namespace silly::editor { - void TileFloor::update(const sf::RenderWindow &window) { - if (sf::Mouse::isButtonPressed(sf::Mouse::Button::Left) || - sf::Mouse::isButtonPressed(sf::Mouse::Button::Right)) { - sf::Vector2i mousePosition = sf::Mouse::getPosition(window); - - for (int x = 0; x < this->get_width(); x++) { - for (int y = 0; y < this->get_height(); y++) { - int rx = x * 16, ry = y * 16; - - if ((rx < mousePosition.x && mousePosition.x < rx + 16) && - (ry < mousePosition.y && mousePosition.y < ry + 16)) { - sf::Vector2i pos(x, y); - - if (sf::Mouse::isButtonPressed(sf::Mouse::Button::Left)) { - this->place_tile(pos); - } else if (sf::Mouse::isButtonPressed(sf::Mouse::Button::Right)) { - this->remove_tile(pos); - } - } - } - } - } - } - void TileFloor::render(sf::RenderWindow &window) const { std::for_each( this->tiles.begin(), this->tiles.end(), [&window](const Tile &t) { |
