From d3ba05a36dd25c4d3047aeed29ee22f66cac34a0 Mon Sep 17 00:00:00 2001 From: Theo Champion Date: Tue, 5 Aug 2025 13:22:06 +0200 Subject: [PATCH] feat: Made a sprite structure and added a static sprite field in data A static sprite is a sprite that is not supposed to move, it'll be placed at the parsing part. The sprite struct is prone to change as I am testing it --- src/cub3d_data.h | 5 ++++- src/sprites/sprite.h | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/sprites/sprite.h diff --git a/src/cub3d_data.h b/src/cub3d_data.h index 97ffd66..e6ba1e2 100644 --- a/src/cub3d_data.h +++ b/src/cub3d_data.h @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */ -/* Updated: 2025/08/05 13:09:22 by kcolin ### ########.fr */ +/* Updated: 2025/08/05 13:37:57 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,10 +15,12 @@ # include "map/mapdata.h" # include "draw/img_data.h" +# include "sprites/sprite.h" # include "player/player.h" # include "utils/keypresses.h" # include "consts.h" +// the 4 static sprites are some of the perks and the mystery box typedef struct s_cub3d_data { void *mlx; @@ -34,6 +36,7 @@ typedef struct s_cub3d_data int *screen_matrix; int delta; int last_tick; + t_sprite static_sprite[4]; } t_cub3d_data; #endif // CUB3D_DATA_H diff --git a/src/sprites/sprite.h b/src/sprites/sprite.h new file mode 100644 index 0000000..a11a686 --- /dev/null +++ b/src/sprites/sprite.h @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* sprite.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tchampio +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/08/05 12:59:44 by tchampio #+# #+# */ +/* Updated: 2025/08/05 13:19:30 by tchampio ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef SPRITE_H +# define SPRITE_H + +typedef struct s_sprite +{ + double x; + double y; + void *texture; + int texture_width; + int texture_height; +} t_sprite; + +#endif // SPRITE_H