// Known-answer test for the isometric tile→screen projection (the renderer's core transform). #include "sc2k/render/iso_projection.hpp" #include "../app/snapshot_layout.hpp" #include #include #include #include "test_harness.hpp" int main() { using sc2k::render::tile_to_screen; auto eq = [](sc2k::render::ScreenPos p, int x, int y) { return p.x == x && p.y == y; }; // Snapshot framing retains the classic canvas and grows by the zoom-2 map projection span. { const auto small = sc2k::app::snapshot_layout(128); CHECK(small.width == 4200 && small.height == 2600 && small.cameraX == 2100 && small.cameraY == 420); const auto medium = sc2k::app::snapshot_layout(192); CHECK(medium.width == 6248 && medium.height == 3624 && medium.cameraX == medium.width / 2); const auto large = sc2k::app::snapshot_layout(256); CHECK(large.width == 8296 && large.height == 4648 && large.cameraX == large.width / 2); } // The iso diamond at zoom 0, origin (0,0): row+ moves down-right, col+ moves down-left. CHECK(eq(tile_to_screen(0, 0, 0, 0, 0, 0), 0, 0)); // origin tile CHECK(eq(tile_to_screen(1, 0, 0, 0, 0, 0), 4, 2)); // +row → +x, +y CHECK(eq(tile_to_screen(0, 1, 0, 0, 0, 0), -4, 2)); // +col → −x, +y CHECK(eq(tile_to_screen(1, 1, 0, 0, 0, 0), 0, 4)); // diagonal → straight down // Altitude lifts the tile up the screen (smaller y) by 3<