I can now draw a map and then render it with the sprites pretty easily. Problem currently is the entities replace their floor tiles so need to fix that.

master
Zed A. Shaw 1 day ago
parent a3f82139e9
commit 72ecca8c82
  1. 17
      tests/map.cpp

@ -112,14 +112,23 @@ TEST_CASE("map image test", "[map-sprite]") {
LevelManager levels;
GameLevel level = levels.current();
Matrix map_tiles = matrix::make(7,7);
System::draw_map(level, map_tiles, 2);
// on level start make one render texture with the base map
auto render = std::make_shared<sf::RenderTexture>();
auto map_sprite = render_map(map_tiles, *render);
auto player = level.world->get_the<components::Player>();
auto& player_pos = level.world->get<components::Position>(player.entity);
for(matrix::each_row it{level.map->walls()}; it.next();) {
player_pos.location.x = it.x;
player_pos.location.y = it.y;
System::draw_map(level, map_tiles, 2);
// on level start make one render texture with the base map
auto map_sprite = render_map(map_tiles, *render);
}
/*
// confirm we get two different maps
auto out_img = render->getTexture().copyToImage();
bool worked = out_img.saveToFile("map_render.png");
REQUIRE(worked);
*/
}

Loading…
Cancel
Save