#include "Grid.h" #include #include #include namespace kurator { constexpr Color GRID {0x11, 0x11, 0x11, 0xff}; constexpr Color CENTER {0x31, 0x31, 0x31, 0xff}; void Grid::draw(const engine::Camera& camera) const { constexpr double step = 1000.0; auto start = camera.top_left(); start.x = std::round(start.x / step) * step; start.y = std::round(start.y / step) * step; const auto end = camera.bottom_right(); auto point = start; while (point.x < end.x || point.y < end.y) { const auto projected = camera.to_screen(point); DrawLine(projected.x, 0, projected.x, GetScreenHeight(), GRID); DrawLine(0, projected.y, GetScreenWidth(), projected.y, GRID); point.x += step; point.y += step; } const auto center = camera.to_screen({0.0, 0.0}); DrawLine(center.x, 0, center.x, GetScreenHeight(), CENTER); DrawLine(0, center.y, GetScreenWidth(), center.y, CENTER); } } // namespace kurator