-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathput_imgs.c
More file actions
54 lines (48 loc) · 1.74 KB
/
put_imgs.c
File metadata and controls
54 lines (48 loc) · 1.74 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* put_imgs.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bschwitz <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/08 12:26:16 by bschwitz #+# #+# */
/* Updated: 2022/02/09 13:51:15 by bschwitz ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void ft_put_background(t_data *data)
/* background partout */
{
int y;
int x;
y = 0;
while (y < data->size_y)
{
x = 0;
while (x < data->size_x)
{
mlx_put_image_to_window(data->mlx, data->win,
data->img->background, x, y);
x += IMG_W;
}
y += IMG_H;
}
}
void ft_put_object(t_data *data, char *relative_path)
/* met obj a leur place dans la map */
{
int img_width;
int img_height;
data->map->object = mlx_xpm_file_to_image(data->mlx, relative_path,
&img_width, &img_height);
mlx_put_image_to_window(data->mlx, data->win, data->map->object,
(data->map->x * IMG_W), (data->map->y * IMG_H));
}
void ft_put_player(t_data *data)
/* mets le player a sa place */
{
data->p_x = data->map->x;
data->p_y = data->map->y;
mlx_put_image_to_window(data->mlx, data->win, data->img->player_right,
(data->p_x * IMG_W), (data->p_y * IMG_H));
}