diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_key_events.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c index 199f254..d400684 100644 --- a/src/ft_key_events.c +++ b/src/ft_key_events.c @@ -64,13 +64,25 @@ static int pl = clist->plist; if (pl->view_side == 1) - pl->pos_y += 0.3; + { + if ((pl->pos_y += 0.3) > clist->map_h - 0.4) + pl->pos_y = clist->map_h - 0.4; + } else if (pl->view_side == 2) - pl->pos_x -= 0.3; + { + if ((pl->pos_x -= 0.3) < 0.4) + pl->pos_x = 0.4; + } else if (pl->view_side == 3) - pl->pos_y -= 0.3; + { + if ((pl->pos_y -= 0.3) < 0.4) + pl->pos_y = 0.4; + } else if (pl->view_side == 4) - pl->pos_x += 0.3; + { + if ((pl->pos_x += 0.3) > clist->map_w - 0.4) + pl->pos_x = clist->map_w - 0.4; + } ft_drawmap(clist); return (0); } |