mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
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
This commit is contained in:
parent
07dc80ba6a
commit
d3ba05a36d
2 changed files with 29 additions and 1 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/17 14:59:37 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 "map/mapdata.h"
|
||||||
# include "draw/img_data.h"
|
# include "draw/img_data.h"
|
||||||
|
# include "sprites/sprite.h"
|
||||||
# include "player/player.h"
|
# include "player/player.h"
|
||||||
# include "utils/keypresses.h"
|
# include "utils/keypresses.h"
|
||||||
# include "consts.h"
|
# include "consts.h"
|
||||||
|
|
||||||
|
// the 4 static sprites are some of the perks and the mystery box
|
||||||
typedef struct s_cub3d_data
|
typedef struct s_cub3d_data
|
||||||
{
|
{
|
||||||
void *mlx;
|
void *mlx;
|
||||||
|
|
@ -34,6 +36,7 @@ typedef struct s_cub3d_data
|
||||||
int *screen_matrix;
|
int *screen_matrix;
|
||||||
int delta;
|
int delta;
|
||||||
int last_tick;
|
int last_tick;
|
||||||
|
t_sprite static_sprite[4];
|
||||||
} t_cub3d_data;
|
} t_cub3d_data;
|
||||||
|
|
||||||
#endif // CUB3D_DATA_H
|
#endif // CUB3D_DATA_H
|
||||||
|
|
|
||||||
25
src/sprites/sprite.h
Normal file
25
src/sprites/sprite.h
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* sprite.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue