-
Notifications
You must be signed in to change notification settings - Fork 0
/
so_long.h
91 lines (82 loc) · 2.69 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
89
90
91
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* so_long.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: melkholy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/06 23:51:37 by melkholy #+# #+# */
/* Updated: 2022/11/05 18:17:55 by melkholy ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SO_LONG_H
# define SO_LONG_H
# include <fcntl.h>
# include <sys/fcntl.h>
# include <unistd.h>
# include <stdbool.h>
# include "./ft_printf/ft_printf_bonus.h"
# include "./ft_printf/libft/libft.h"
# include "minilibx-linux/mlx.h"
# if defined (__linux__)
# define IMG_SIZE 100
# define ESC_KEY 65307
# define W_KEY 119
# define S_KEY 115
# define D_KEY 100
# define A_KEY 97
# elif defined (__APPLE__)
# define IMG_SIZE 100
# define ESC_KEY 53
# define W_KEY 13
# define S_KEY 1
# define D_KEY 2
# define A_KEY 0
# endif
typedef struct s_graph
{
char **map;
void *mlx;
void *win;
void *wall;
void *space;
void *ply_img;
char last_pos;
void *cat_img[2];
void *door[2];
int player[2];
int img_wh;
int steps;
int row;
int col;
int cats;
int gate;
int awake;
} t_graph;
/* main.c */
bool ft_get_map(char *file, t_graph *graph);
bool ft_maplen(char *file, t_graph *graph);
bool ft_validate_map(t_graph *graph);
t_graph *ft_check_map(char *file);
/* check_path.c */
void ft_mark_path(t_graph *graph, int row, int col, int **visited);
bool ft_find_path(t_graph *graph, int **visited);
int ft_check_p_c_e(t_graph *graph);
void ft_free_graph(t_graph *graph);
bool ft_ispath(t_graph *graph);
/* bulid_graphics.c */
void ft_load_wall_door(t_graph *graph);
void ft_load_ply_cat(t_graph *graph);
void ft_load_imgs(t_graph *graph);
void ft_start_graphics(t_graph *graph);
/* launch_map.c */
void ft_put_image(t_graph *graph, void *img, int row, int col);
void ft_walk_through(t_graph *graph, int row, int col);
void ft_load_map(t_graph *graph);
/* linux_movements.c and movements.c */
void ft_change_position(t_graph *graph, int row, int col);
void ft_move_ply(t_graph *graph, int row, int col);
int ft_key_hook(int keycode, t_graph *graph);
int ft_free_destroy(t_graph *graph);
void ft_check_door(t_graph *graph);
#endif