-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.c
33 lines (29 loc) · 1.41 KB
/
image.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* image.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rmitache <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/11 17:08:14 by rmitache #+# #+# */
/* Updated: 2023/08/05 15:45:59 by rmitache ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void *put_image(t_image image, int x, int y)
{
image.img = mlx_xpm_file_to_image(image.wlx.mlx, image.path,
&image.img_width, &image.img_height);
mlx_put_image_to_window(image.wlx.mlx, image.wlx.mlx_window,
image.img, x, y);
mlx_destroy_image(image.wlx.mlx, image.img);
return (image.img);
}
void update(t_game *game, int x, int y)
{
t_image empty_image;
empty_image.path = "texture/tiles/floor.xpm";
empty_image.wlx = *game;
put_image(empty_image, game->player.x, game->player.y);
put_image(empty_image, x, y);
}