diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index e58fc06..0ac1b21 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,11 @@ #include <imgui-SFML.h> #include <imgui.h> +#include <SFML/Graphics/Color.hpp> +#include <SFML/Graphics/RectangleShape.hpp> #include <SFML/Graphics/RenderWindow.hpp> #include <SFML/System/Clock.hpp> +#include <SFML/System/Vector2.hpp> #include <SFML/Window/Event.hpp> #include <SFML/Window/VideoMode.hpp> #include <optional> @@ -18,6 +21,9 @@ int main() { sf::Clock deltaClock; while (window.isOpen()) { + // zoom size + float size = 16.0f; + while (const std::optional<sf::Event> event = window.pollEvent()) { if (event.has_value()) { sf::Event e = event.value(); @@ -33,6 +39,18 @@ int main() { window.clear(); + // rendering grid + for (int x = 0; x < floor.get_width(); x++) { + for (int y = 0; y < floor.get_height(); y++) { + sf::RectangleShape shape({size, size}); + shape.setFillColor(sf::Color::Transparent); + shape.setOutlineColor(sf::Color(80, 80, 80)); + shape.setOutlineThickness(1.0f); + shape.setPosition({x * size, y * size}); + window.draw(shape); + } + } + ImGui::SFML::Render(window); window.display(); } |
