blob: 69c0712125db7cc8af4249d40f4d88a5871c0e09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* loop.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/09 15:09:24 by dkaiser #+# #+# */
/* Updated: 2024/05/10 10:53:59 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "so_long.h"
int loop(t_game *game)
{
game->player.direction.x = ((game->input_direction & RIGHT) != 0)
- ((game->input_direction & LEFT) != 0);
game->player.direction.y = ((game->input_direction & DOWN) != 0)
- ((game->input_direction & UP) != 0);
game->player.position.x += game->player.direction.x * PLAYER_MOVE_SPEED;
game->player.position.y += game->player.direction.y * PLAYER_MOVE_SPEED;
draw(game);
return (0);
}
|