Make a few comments to keep this straight.

main
Zed A. Shaw 2 months ago
parent e57a13846f
commit 6f2fba4f7f
  1. 6
      systems.cpp

@ -47,7 +47,9 @@ void System::combat(DinkyECS::World &world, Player &player) {
world.system<Position, Combat>([&](const auto &ent, auto &pos, auto &combat) {
if(ent != player.entity && pos.location.x == player_position.location.x &&
pos.location.y == player_position.location.y) {
pos.location.y == player_position.location.y)
{
// need to sort out combat here
}
});
};
@ -57,6 +59,7 @@ void System::draw_entities(DinkyECS::World &world, Map &game_map, ftxui::Canvas
if(pos.location.x >= cam_orig.x && pos.location.x <= cam_orig.x + view_x
&& pos.location.y >= cam_orig.y && pos.location.y <= cam_orig.y + view_y) {
Point loc = game_map.map_to_camera(pos.location, cam_orig);
// the 2 and 4 are from ftxui::Canvas since it does a kind of "subpixel" drawing
canvas.DrawText(loc.x*2, loc.y*4, tile.chr);
}
});
@ -74,6 +77,7 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, ftxui::Canvas &canv
for(size_t x = 0; x < end_x; ++x) {
for(size_t y = 0; y < end_y; ++y) {
string tile = walls[start.y+y][start.x+x] == 1 ? WALL_TILE : FLOOR_TILE;
// the 2 and 4 are from ftxui::Canvas since it does a kind of "subpixel" drawing
canvas.DrawText(x * 2, y * 4, tile);
}
}

Loading…
Cancel
Save