params adjust angle of view and size of game window

This commit is contained in:
hugogogo
2022-04-24 11:14:08 +02:00
parent fac1f78230
commit c886118bd6
9 changed files with 135 additions and 103 deletions

View File

@@ -1,13 +1,27 @@
#ifndef CUBE3D_MACRO_H
# define CUBE3D_MACRO_H
/*
* game params
*/
/* nbr pixel player move */
# define PLR_MV 1
/* nbr key you can press at the same time */
# define MAX_NB_KEY 3
# define SCREEN_DIST 50
# define SCREEN_SIZE 100
# define SCREEN_DEF 50
# define PLR_MV 5
/* screen width */
# define SCREEN_WIDTH 500
/* screen height */
# define SCREEN_HEIGHT 200
/* screen focal (in degree) */
# define SCREEN_FOCAL 90
/* size of a cell on the map */
# define CELL 20
/*
* keys macro
*/
# define ARROW_LEFT 65361
# define ARROW_UP 65362
# define ARROW_RIGHT 65363

View File

@@ -35,6 +35,8 @@ typedef struct s_rcast
t_vec screen_dist;
t_vec screen_size;
t_vec ray;
int screen_def;
int cell;
int cell_x;
int cell_y;
int slope_x;
@@ -84,6 +86,7 @@ typedef struct s_map
char **content;
int size_x;
int size_y;
int cell;
} t_map;
/*
@@ -110,18 +113,18 @@ typedef struct s_plr
typedef struct s_game
{
void *mlx_ptr;
// map window
t_win map_win;
t_img map_img;
// game window
// t_win win;
// t_img img;
t_win win;
t_img img;
// player
t_plr plr;
// rays
t_rcast rcast;
// map
t_map map;
// map window
t_win map_win;
t_img map_img;
// key hook
int k_hook[MAX_NB_KEY];
} t_game;