Make it so the canvas for the map view is calculated based on the font size, which will allow for zooming.

This commit is contained in:
Zed A. Shaw 2024-10-21 00:12:04 -04:00
parent 9f1e9717a0
commit 02a45d890f
3 changed files with 33 additions and 18 deletions

View file

@ -25,14 +25,18 @@ void System::enemy_pathing(DinkyECS::World &world, Map &game_map, Player &player
void System::motion(DinkyECS::World &world, Map &game_map) {
world.system<Position, Motion>([&](const auto &ent, auto &position, auto &motion) {
Point move_to = {
position.location.x + motion.dx,
position.location.y + motion.dy
};
motion = {0,0}; // clear it after getting it
// don't process entities that don't move
if(motion.dx != 0 || motion.dy != 0) {
Point move_to = {
position.location.x + motion.dx,
position.location.y + motion.dy
};
motion = {0,0}; // clear it after getting it
if(game_map.inmap(move_to.x, move_to.y) && !game_map.iswall(move_to.x,move_to.y)) {
position.location = move_to;
// avoid colision, but could this be a different system?
if(game_map.inmap(move_to.x, move_to.y) && !game_map.iswall(move_to.x,move_to.y)) {
position.location = move_to;
}
}
});
}