-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathso_long.h
More file actions
102 lines (90 loc) · 1.79 KB
/
so_long.h
File metadata and controls
102 lines (90 loc) · 1.79 KB
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
98
99
100
101
102
#ifndef SO_LONG_H
# define SO_LONG_H
# include <stdio.h>
# include <unistd.h>
# include "mms/mlx.h"
# include <fcntl.h>
# include "./get_next_line/get_next_line.h"
# include <stdlib.h>
# define SUCCESS 0
# define FAILURE 1
# define KEY_W 13
# define KEY_A 0
# define KEY_S 1
# define KEY_D 2
# define KEY_ESC 53
# define X_EVENT_KEY_PRESS 2
# define X_EVENT_KEY_EXIT 17
# define TILE_SIZE 64
typedef struct s_check{
char **map;
int width;
int height;
int num_c;
int num_p;
int num_e;
} t_check;
typedef struct s_image
{
void *image_pointer;
int height;
int width;
} t_image;
typedef struct s_tiles
{
t_image wall;
t_image space;
t_image player;
t_image collectible;
t_image exit;
} t_tiles;
typedef struct s_player
{
int current_x;
int current_y;
int moves;
int did_collect;
} t_player;
typedef struct s_exit
{
int x;
int y;
int is_opened;
} t_exit;
typedef struct s_collectible
{
int x;
int y;
int is_collected;
} t_collectible;
typedef struct s_game
{
void *mlx_ptr;
void *win_ptr;
char **map;
int map_height;
int map_width;
int number_of_collectibles;
t_tiles tiles;
t_player player;
t_exit exit;
t_collectible *collectibles;
} t_game;
void print_error(char *str);
int first_check(char *line, t_check *check);
int mid_check(char *line, t_check *check);
int final_check(char *line, t_check *check);
int object_check(t_check *check);
//mapcheck
void check_and_save_map(char *file, t_check *check);
void print_map(t_game *game, t_check *check);
//map save
void init_features(t_game *game);
void check_init(t_check *check);
void image_init(t_game *game);
//init game
void ptr_init(t_game *game);
int key_press(int key, t_game *game);
void draw_map(t_game *game, t_check *check);
//print game
#endif