42_cube3D/game/game.h

75 lines
1.7 KiB
C
Raw Normal View History

2023-04-26 09:45:21 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* game.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/26 15:29:34 by erey-bet #+# #+# */
2023-05-02 10:58:55 -04:00
/* Updated: 2023/05/02 15:56:17 by erey-bet ### ########.fr */
2023-04-26 09:45:21 -04:00
/* */
/* ************************************************************************** */
#ifndef GAME_H
# define GAME_H
# include "../cube3D.h"
2023-05-02 09:39:16 -04:00
# include <math.h>
# define WIDTH 1920
# define HEIGHT 1080
2023-04-26 09:45:21 -04:00
typedef struct s_player
{
double pos_x;
double pos_y;
2023-05-02 09:39:16 -04:00
double dir_x;
double dir_y;
double pla_x;
double pla_y;
2023-04-26 09:45:21 -04:00
} t_ply;
2023-05-02 09:39:16 -04:00
typedef struct s_raycast
{
2023-05-02 10:58:55 -04:00
double dir_x;
double dir_y;
2023-05-02 09:39:16 -04:00
} t_ray;
2023-05-02 10:58:55 -04:00
typedef struct s_dda
{
int map_x;
int map_y;
double side_dist_x;
double side_dist_y;
double delta_dist_x;
double delta_dist_y;
double perp_wall_dist;
int step_x;
int step_y;
int hit;
int side;
} t_dda;
2023-04-26 09:45:21 -04:00
typedef struct s_game
{
mlx_t *mlx;
mlx_image_t *window;
2023-04-26 09:45:21 -04:00
t_ply *ply;
t_map *map;
2023-05-02 09:39:16 -04:00
t_ray *ray;
2023-04-26 09:45:21 -04:00
} t_game;
/* INIT */
t_game *init(t_map *map);
/* MANAGE */
void manage(mlx_key_data_t keydata, void *param);
/* KEYS */
int manage_keys(mlx_key_data_t keydata, t_game *game);
/* RAYCASTING */
int raycasting(t_game *game);
2023-04-26 09:45:21 -04:00
#endif