-
Notifications
You must be signed in to change notification settings - Fork 3
/
so_long.h
88 lines (75 loc) · 2.37 KB
/
so_long.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* so_long.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tblaase <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/06 12:42:26 by tblaase #+# #+# */
/* Updated: 2021/10/08 15:26:10 by tblaase ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SO_LONG_H
# define SO_LONG_H
# include <mlx.h>
# include <stdlib.h>
# include <stdio.h>
# include "libft/libft.h"
/* ********** defines to make work easier ********** */
# define IMG_W 32
# define IMG_H 32
# define ESC 53
# define W 13
# define A 0
# define S 1
# define D 2
# define UP -1
# define DOWN 1
# define LEFT -1
# define RIGHT 1
/* ***** struct to store the different images ***** */
typedef struct s_img
{
void *player_up;
void *player_left;
void *player_right;
void *player_down;
void *background;
} t_img;
/* ***** struct to create the map and keep track of the contents ***** */
typedef struct s_map
{
char **map;
void *object;
int x;
int y;
int diamonds;
} t_map;
/* ***** struct to hand all of my programms data between functions ***** */
typedef struct s_data
{
void *mlx;
void *win;
int size_x;
int size_y;
int p_x;
int p_y;
int counter;
int collected;
t_map *map;
t_img *img;
} t_data;
/* ********** all of my functions ********** */
void ft_window_size(t_data *data, char **argv);
int ft_key_hook(int keycode, t_data *data);
void ft_create_map(t_data *data);
void ft_put_object(t_data *data, char *relative_path);
void ft_put_player(t_data *data);
void ft_parse_input(t_data *data, char **argv, int argc);
void ft_put_background(t_data *data);
void ft_win(t_data *data);
int ft_mouse_hook(int mousecode, t_data *data);
void ft_move(t_data *data, char position, int direction);
int ft_exit(t_data *data);
void ft_init(t_data *data, t_map *map);
#endif