From 60583043074f01992f2c5b19ec9faf5fb0f69572 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 1 Feb 2025 15:24:04 +0500 Subject: feat: render grid --- src/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main.cpp') 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 #include +#include +#include #include #include +#include #include #include #include @@ -18,6 +21,9 @@ int main() { sf::Clock deltaClock; while (window.isOpen()) { + // zoom size + float size = 16.0f; + while (const std::optional 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(); } -- cgit v1.2.3