mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
dev: improved sprites by creating a create_sprite function
This commit is contained in:
parent
09ff569a31
commit
00e8a73d14
4 changed files with 60 additions and 31 deletions
30
src/sprites/create_sprite.c
Normal file
30
src/sprites/create_sprite.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* create_sprite.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/12 15:43:19 by tchampio #+# #+# */
|
||||
/* Updated: 2025/08/12 15:53:05 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "sprite.h"
|
||||
#include "../../libft/includes/libft.h"
|
||||
#include "../cub3d_data.h"
|
||||
#include "../utils/inits.h"
|
||||
|
||||
t_sprite *create_sprite(t_cub3d_data *data, char *texture,
|
||||
double x, double y)
|
||||
{
|
||||
t_sprite *sprite;
|
||||
|
||||
sprite = ft_calloc(sizeof(t_sprite), 1);
|
||||
if (!sprite)
|
||||
return (NULL);
|
||||
sprite->x = x;
|
||||
sprite->y = y;
|
||||
sprite->image = load_single_texture(data, texture);
|
||||
return (sprite);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue