1
0

」 feat: Added get_ray_angle function

This commit is contained in:
2024-09-29 16:57:10 +02:00
parent d4106157df
commit e11c60b808
6 changed files with 60 additions and 31 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/11 16:38:40 by adjoly #+# #+# */
/* Updated: 2024/09/24 16:50:56 by adjoly ### ########.fr */
/* Updated: 2024/09/29 16:47:32 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,22 +19,6 @@
# include <stdbool.h>
# include <unistd.h>
typedef struct s_player
{
t_coord coords;
double direction;
} t_player;
typedef struct s_cub
{
void *mlx;
void *win;
void *sprites;
void *img;
char **map;
t_player player;
} t_cub;
# define ESCAPE_KEY 41
# define W_KEY 26
# define S_KEY 22
@ -46,6 +30,31 @@ typedef struct s_cub
# define PLAYER_ROT_SPEED (2 * M_PI) / 8
# define PLAYER_SPEED 3
# define MAP_CHUNK_SIZE 64
# define RAY_SIZE 2
# define FOV 60 * (M_PI / 180)
typedef struct s_ray_dir
{
float x;
float y;
} t_ray_dir;
typedef struct s_player
{
t_coord coords;
double direction;
t_ray_dir ray_dir[WINDOW_X / RAY_SIZE];
} t_player;
typedef struct s_cub
{
void *mlx;
void *win;
void *sprites;
void *img;
char **map;
t_player player;
} t_cub;
/**
* @brief This function is used to handle keypress