-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay_tiles.c
76 lines (65 loc) · 2.38 KB
/
display_tiles.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
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* display_tiles.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hbutt <hbutt@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/22 14:34:41 by hbutt #+# #+# */
/* Updated: 2024/07/08 15:33:45 by hbutt ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void display_wall(void *mlx, void *window, int j, int i)
{
int img_height;
void *img_wall;
img_height = TILE_SIZE;
img_wall = mlx_xpm_file_to_image(mlx, "images/wall_2.xpm", &img_height,
&img_height);
mlx_put_image_to_window(mlx, window, img_wall, j * TILE_SIZE, i
* TILE_SIZE);
}
void display_floor(void *mlx, void *window, int j, int i)
{
int img_height;
void *img_floor;
img_height = TILE_SIZE;
img_floor = mlx_xpm_file_to_image(mlx, "images/floor_2.xpm", &img_height,
&img_height);
mlx_put_image_to_window(mlx, window, img_floor, j * TILE_SIZE, i
* TILE_SIZE);
}
void display_collec(void *mlx, void *window, int j, int i)
{
int img_height;
void *img_collec;
img_height = TILE_SIZE;
img_height /= 7;
img_collec = mlx_xpm_file_to_image(mlx, "images/apple.xpm", &img_height,
&img_height);
mlx_put_image_to_window(mlx, window, img_collec, j * TILE_SIZE, i
* TILE_SIZE);
}
void display_player(t_map *map, int j, int i)
{
int img_height;
img_height = TILE_SIZE;
if (!map->img_player)
{
map->img_player = mlx_xpm_file_to_image(map->mlx, "images/player.xpm",
&img_height, &img_height);
}
mlx_put_image_to_window(map->mlx, map->window, map->img_player, j
* TILE_SIZE, i * TILE_SIZE);
}
void display_exit(void *mlx, void *window, int j, int i)
{
int img_height;
void *img_exit;
img_height = TILE_SIZE;
img_exit = mlx_xpm_file_to_image(mlx, "images/exit.xpm", &img_height,
&img_height);
mlx_put_image_to_window(mlx, window, img_exit, j * TILE_SIZE, i
* TILE_SIZE);
}