-
Notifications
You must be signed in to change notification settings - Fork 0
/
player_rendering.c
30 lines (27 loc) · 1.37 KB
/
player_rendering.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
/* ************************************************************************** */
/* */
/* :::::::: */
/* player_rendering.c :+: :+: */
/* +:+ */
/* By: cschuijt <[email protected]> +#+ */
/* +#+ */
/* Created: 2022/12/03 17:49:00 by cschuijt #+# #+# */
/* Updated: 2022/12/03 17:49:00 by cschuijt ######## odam.nl */
/* */
/* ************************************************************************** */
#include "so_long.h"
#include <stdlib.h>
void render_player(t_map *map)
{
int xy[2];
if (!map->player->image)
{
map->player->image = mlx_new_image(map->mlx, 48, 48);
free(map->player->image->pixels);
map->player->image->pixels = map->player_sprites[4];
}
xy[0] = render_x_pos(map, map->player->pos) - 8;
xy[1] = render_y_pos(map, map->player->pos) - 24;
mlx_image_to_window(map->mlx, map->player->image, xy[0], xy[1]);
mlx_set_instance_depth(&map->player->image->instances[0], layer_player);
}