dev: Added sprite types and gave 'base' sprites their types

This commit is contained in:
Theo Champion 2025-08-13 14:57:06 +02:00
parent 0d6cc4063a
commit ee329812fd
3 changed files with 33 additions and 19 deletions

View file

@ -6,7 +6,11 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */ /* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/12 15:43:19 by tchampio #+# #+# */ /* Created: 2025/08/12 15:43:19 by tchampio #+# #+# */
<<<<<<< HEAD
/* Updated: 2025/08/14 21:24:03 by tchampio ### ########.fr */ /* Updated: 2025/08/14 21:24:03 by tchampio ### ########.fr */
=======
/* Updated: 2025/08/13 14:53:38 by tchampio ### ########.fr */
>>>>>>> f9c846b (dev: Added sprite types and gave 'base' sprites their types)
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -25,6 +29,7 @@ t_sprite *create_sprite(t_cub3d_data *data, char *texture,
return (NULL); return (NULL);
sprite->x = x; sprite->x = x;
sprite->y = y; sprite->y = y;
sprite->sprite_type = OTHER;
sprite->image = load_single_texture(data, texture); sprite->image = load_single_texture(data, texture);
return (sprite); return (sprite);
} }

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */ /* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/05 12:59:44 by tchampio #+# #+# */ /* Created: 2025/08/05 12:59:44 by tchampio #+# #+# */
/* Updated: 2025/08/12 16:12:37 by tchampio ### ########.fr */ /* Updated: 2025/08/13 14:44:02 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,6 +15,14 @@
# include "../draw/img_data.h" # include "../draw/img_data.h"
typedef enum e_sprite_type
{
ZOMBIE,
PERK,
BOX,
OTHER
} t_sprite_type;
/* /*
* x - real position for the sprite * x - real position for the sprite
* y - real position for the sprite * y - real position for the sprite
@ -53,6 +61,7 @@ typedef struct s_sprite
int sprite_width; int sprite_width;
int sprite_draw_start_x; int sprite_draw_start_x;
int sprite_draw_end_x; int sprite_draw_end_x;
t_sprite_type sprite_type;
} t_sprite; } t_sprite;
#endif // SPRITE_H #endif // SPRITE_H

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */ /* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */
/* Updated: 2025/08/14 21:37:58 by tchampio ### ########.fr */ /* Updated: 2025/08/14 21:41:23 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */