v0.1.0: software map renderer + SDL3 window viewer
This commit is contained in:
@@ -107,6 +107,27 @@ auto main() -> int {
|
||||
std::error_code ignored;
|
||||
std::filesystem::remove(archive_path, ignored);
|
||||
|
||||
// TGA: a 2x2 top-origin truecolor image decodes with correct pixels.
|
||||
std::vector<core::uint8> tga{0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 24, 0x20};
|
||||
const core::uint8 tga_pixels[] = {0, 0, 255, 0, 255, 0, 255, 0, 0, 255, 255, 255};
|
||||
tga.insert(tga.end(), tga_pixels, tga_pixels + 12);
|
||||
const auto decoded_tga = render::decode_tga(tga);
|
||||
check(decoded_tga.width() == 2U && decoded_tga.height() == 2U, "TGA dimensions");
|
||||
check(decoded_tga.data()[0] == render::argb(255, 0, 0), "TGA top-left is red");
|
||||
check(decoded_tga.data()[3] == render::argb(255, 255, 255), "TGA bottom-right is white");
|
||||
|
||||
const auto bmp = render::encode_bmp(decoded_tga);
|
||||
check(bmp.size() > 54U && bmp[0] == 'B' && bmp[1] == 'M', "BMP header");
|
||||
check(bmp[18] == 2U && bmp[19] == 0U && bmp[22] == 2U, "BMP dimensions");
|
||||
|
||||
// Compositing keeps the source size and accepts markers.
|
||||
render::scene_options scene;
|
||||
scene.world_width = 100.0;
|
||||
scene.world_height = 100.0;
|
||||
const std::vector<render::marker> markers{{10.0, 20.0, render::red, 3}};
|
||||
const auto composed = render::compose(decoded_tga, markers, scene);
|
||||
check(composed.width() == 2U && composed.height() == 2U, "compose preserves size");
|
||||
|
||||
// Skirmish: deterministic, resolves within the frame cap.
|
||||
skirmish::match_config config;
|
||||
config.seed = 42U;
|
||||
|
||||
Reference in New Issue
Block a user