mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
dev: Added sprite types and gave 'base' sprites their types
This commit is contained in:
parent
0d6cc4063a
commit
ee329812fd
3 changed files with 33 additions and 19 deletions
|
|
@ -6,7 +6,11 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/12 15:43:19 by tchampio #+# #+# */
|
||||
<<<<<<< HEAD
|
||||
/* 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);
|
||||
sprite->x = x;
|
||||
sprite->y = y;
|
||||
sprite->sprite_type = OTHER;
|
||||
sprite->image = load_single_texture(data, texture);
|
||||
return (sprite);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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"
|
||||
|
||||
typedef enum e_sprite_type
|
||||
{
|
||||
ZOMBIE,
|
||||
PERK,
|
||||
BOX,
|
||||
OTHER
|
||||
} t_sprite_type;
|
||||
|
||||
/*
|
||||
* x - real position for the sprite
|
||||
* y - real position for the sprite
|
||||
|
|
@ -36,23 +44,24 @@
|
|||
*/
|
||||
typedef struct s_sprite
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
t_img_data *image;
|
||||
int img_width;
|
||||
int img_height;
|
||||
double sprite_pos_x;
|
||||
double sprite_pos_y;
|
||||
double inv_det;
|
||||
double transform_x;
|
||||
double transform_y;
|
||||
int sprite_screen_x;
|
||||
int sprite_height;
|
||||
int sprite_draw_start_y;
|
||||
int sprite_draw_end_y;
|
||||
int sprite_width;
|
||||
int sprite_draw_start_x;
|
||||
int sprite_draw_end_x;
|
||||
double x;
|
||||
double y;
|
||||
t_img_data *image;
|
||||
int img_width;
|
||||
int img_height;
|
||||
double sprite_pos_x;
|
||||
double sprite_pos_y;
|
||||
double inv_det;
|
||||
double transform_x;
|
||||
double transform_y;
|
||||
int sprite_screen_x;
|
||||
int sprite_height;
|
||||
int sprite_draw_start_y;
|
||||
int sprite_draw_end_y;
|
||||
int sprite_width;
|
||||
int sprite_draw_start_x;
|
||||
int sprite_draw_end_x;
|
||||
t_sprite_type sprite_type;
|
||||
} t_sprite;
|
||||
|
||||
#endif // SPRITE_H
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue