-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.c
45 lines (40 loc) · 1.02 KB
/
help.c
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
#include "header/so_long.h"
void ft_print_error(char *str)
{
write(2, "Error: ", 7);
write(2, str, ft_strlen(str));
write(2, "\n", 1);
exit(1);
}
void ft_init_struct(t_Mapinfo *map_info, t_Image *img)
{
map_info->length = 0;
map_info->width = 0;
map_info->items = 0;
map_info->collected = 0;
img->player_x = 0;
img->player_y = 0;
map_info->steps = 0;
img->enemy_x = 0;
img->enemy_y = 0;
}
void ft_win_game(t_Mainstuct *m_s)
{
printf("You win!\n");
ft_close_window(m_s);
}
void ft_textures(t_Image *img)
{
int img_width;
int img_height;
img->wall = mlx_xpm_file_to_image(img->mlx, "sprites/wall.xpm",
&img_width, &img_height);
img->collect = mlx_xpm_file_to_image(img->mlx, "sprites/crystal1.xpm",
&img_width, &img_height);
img->player = mlx_xpm_file_to_image(img->mlx, "sprites/player.xpm",
&img_width, &img_height);
img->floor = mlx_xpm_file_to_image(img->mlx, "sprites/floor.xpm",
&img_width, &img_height);
img->exit = mlx_xpm_file_to_image(img->mlx, "sprites/exit.xpm",
&img_width, &img_height);
}