-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathso_long.h
97 lines (84 loc) · 2.68 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
92
93
94
95
96
97
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* so_long.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vsimeono <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/01 13:25:08 by vsimeono #+# #+# */
/* Updated: 2022/03/21 19:32:11 by vsimeono ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SO_LONG_H
# define SO_LONG_H
# include "mlx/mlx.h"
# include "libft/libft.h"
# include <unistd.h>
# include <stdlib.h>
# include <fcntl.h>
# include <stdio.h>
# define UP 13
# define DOWN 1
# define LEFT 0
# define RIGHT 2
# define ESC 53
enum {
ON_DESTROY = 17
};
typedef struct s_data
{
void *img;
int size_y;
int size_x;
int point_x;
int point_y;
} t_data;
typedef struct s_long
{
void *mlx;
void *mlx_win;
int moves;
int collect;
int collected;
int player;
int exit;
int pos_x;
t_list *lines;
t_data img;
} t_long;
/* Input Checkers */
int is_map(char *argv);
int check_map(t_list **lines);
/* Map Checkers */
int ft_strchr_first_line(const char *s, char c);
int ft_strchr_second_line(const char *s, char c);
int is_first_last_char(t_list **lines);
int is_p_c_e_1_0(t_list **lines);
int check_p_e_c_in_map(t_long *arch, t_list **lines);
int is_length(t_list **lines);
int is_first_last_line(t_list **lines);
/* Utils */
int ft_strlen_line(t_list **lines);
int ft_strlen_line_1(char *s);
int ft_atoi(const char *str);
char *ft_itoa(int n);
char *ft_strdup(const char *s1);
/* Linked Lists Utils */
void ft_lstadd_back(t_list **lst, t_list *new);
t_list *create_element(char *character);
t_list *list_init(int fd_map);
int list_element_count(t_list **lines);
void free_list(t_list **lines);
/* Creating the Visual Map */
void load_assests(t_long *arch, char c, int x, int y);
void create_visual_map(t_long *arch);
/* Keyboard Hooks and Rules of the Game */
int key_hook(int keycode, t_long *arch);
t_list *player_position(t_long *arch, t_list *lines);
char *player_next_move(t_list *temp, t_long *arch, int keycode);
void p_position_and_counting_objects(t_long *arch, int keycode);
int finish(t_long *arch);
int error(t_long *arch);
int error_arg();
int loop(t_long *arch);
#endif