blob: aea3bb8341895d0e30dcd79910684089ec78b853 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* so_long.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/08 14:14:02 by dkaiser #+# #+# */
/* Updated: 2024/05/10 10:55:30 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SO_LONG_H
# define SO_LONG_H
# define PLAYER_MOVE_SPEED 3
# include "libft.h"
# include "../MLX42/include/MLX42/MLX42.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;
void *img;
} t_player;
typedef struct s_game
{
void *mlx;
void *window;
t_player player;
int input_direction;
} t_game;
int init(t_game *game);
int loop(t_game *game);
int draw(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
|