diff options
| author | Dominik Kaiser | 2024-05-09 17:49:54 +0200 |
|---|---|---|
| committer | Dominik Kaiser | 2024-05-09 17:49:54 +0200 |
| commit | 14ffe0479dc33cb5ed96f85535f84fa91d56c48b (patch) | |
| tree | 1b052671c87cdd54bef9d6b9e9e8fab39039fc45 /include | |
| parent | 8cec16bdb6f980565b29d5b55379e481018753f6 (diff) | |
| download | so_long-14ffe0479dc33cb5ed96f85535f84fa91d56c48b.tar.gz so_long-14ffe0479dc33cb5ed96f85535f84fa91d56c48b.zip | |
Add input to direction handling
Diffstat (limited to 'include')
| -rw-r--r-- | include/so_long.h | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/include/so_long.h b/include/so_long.h index 98b4711..11d9084 100644 --- a/include/so_long.h +++ b/include/so_long.h @@ -6,7 +6,7 @@ /* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/08 14:14:02 by dkaiser #+# #+# */ -/* Updated: 2024/05/09 16:13:43 by dkaiser ### ########.fr */ +/* Updated: 2024/05/09 17:38:18 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,15 +16,39 @@ # include "libft.h" # include "mlx.h" +enum e_direction +{ + ZERO = 0, + UP = 1, + DOWN = 2, + LEFT = 4, + RIGHT = 8 +}; + +typedef struct s_vector +{ + int x; + int y; +} t_vector; + +typedef struct s_player +{ + t_vector position; + t_vector direction; + t_vector velocity; +} t_player; + typedef struct s_game { - void *mlx; - void *window; -} t_game; - -int init(t_game *game); -int loop(t_game *game); -int on_key_down(int key, t_game *game); -int on_key_up(int keycode, t_game *game); + void *mlx; + void *window; + t_player player; + int input_direction; +} t_game; + +int init(t_game *game); +int loop(t_game *game); +int on_key_down(int key, t_game *game); +int on_key_up(int keycode, t_game *game); #endif // SO_LONG_H |
