#include "WorldScene.hpp" WorldScene::WorldScene(sf::RenderWindow &window) : Scene(window) { _tileSize = DEFAULT_TILE_SIZE_PX; } void WorldScene::render() { sf::RectangleShape rect; rect.setSize(sf::Vector2f(_tileSize, _tileSize)); rect.setFillColor(sf::Color::Green); rect.setOutlineThickness(-.5); rect.setOutlineColor(sf::Color::Black); for (const Tile &tile : map.tiles()) { rect.setPosition(tile.x * _tileSize, tile.y * _tileSize); _window.draw(rect); } } void WorldScene::resize(const sf::Event::SizeEvent &size) { auto oldView = _window.getView(); sf::View resizedView(oldView.getCenter(), sf::Vector2f(size.width, size.height)); _window.setView(resizedView); } void WorldScene::zoom(float factor) { _zoom += factor; if (_zoom < MIN_ZOOM) { _zoom = MIN_ZOOM; } if (_zoom > MAX_ZOOM) { _zoom = MAX_ZOOM; } sf::View view = _window.getView(); view.setSize( _window.getSize().x * 1 / _zoom, _window.getSize().y * 1 / _zoom ); _window.setView(view); } void WorldScene::pan(int dx, int dy) {}