Merge branch 'master' of git.sr.ht:~xamora/cube3D
This commit is contained in:
commit
65045662a6
BIN
game/.game.h.swp
BIN
game/.game.h.swp
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/26 15:29:34 by erey-bet #+# #+# */
|
/* Created: 2023/04/26 15:29:34 by erey-bet #+# #+# */
|
||||||
/* Updated: 2023/05/02 15:56:17 by erey-bet ### ########.fr */
|
/* Updated: 2023/05/03 12:42:31 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -48,6 +48,9 @@ typedef struct s_dda
|
|||||||
int step_y;
|
int step_y;
|
||||||
int hit;
|
int hit;
|
||||||
int side;
|
int side;
|
||||||
|
int line_height;
|
||||||
|
int draw_start;
|
||||||
|
int draw_end;
|
||||||
} t_dda;
|
} t_dda;
|
||||||
|
|
||||||
typedef struct s_game
|
typedef struct s_game
|
||||||
@ -60,7 +63,7 @@ typedef struct s_game
|
|||||||
} t_game;
|
} t_game;
|
||||||
|
|
||||||
/* INIT */
|
/* INIT */
|
||||||
t_game *init(t_map *map);
|
void init(t_map *map, t_game *game);
|
||||||
|
|
||||||
/* MANAGE */
|
/* MANAGE */
|
||||||
void manage(mlx_key_data_t keydata, void *param);
|
void manage(mlx_key_data_t keydata, void *param);
|
||||||
|
19
game/init.c
19
game/init.c
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/27 14:50:22 by erey-bet #+# #+# */
|
/* Created: 2023/04/27 14:50:22 by erey-bet #+# #+# */
|
||||||
/* Updated: 2023/05/02 15:18:05 by erey-bet ### ########.fr */
|
/* Updated: 2023/05/03 12:44:19 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -20,18 +20,21 @@ void init_ply(t_map *map, t_ply *ply)
|
|||||||
|
|
||||||
void init_ray(t_ray *ray)
|
void init_ray(t_ray *ray)
|
||||||
{
|
{
|
||||||
ray->x = 0;
|
ray->dir_x = 0;
|
||||||
ray->y = 0;
|
ray->dir_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(t_map *map, t_game &game)
|
void init(t_map *map, t_game *game)
|
||||||
{
|
{
|
||||||
t_ply ply;
|
t_ply ply;
|
||||||
t_ray ray;
|
t_ray ray;
|
||||||
|
|
||||||
game.mlx = mlx_init(WIDTH, HEIGHT, "jan lili", true);
|
game->mlx = mlx_init(WIDTH, HEIGHT, "jan lili", true);
|
||||||
if (!game.mlx)
|
if (!game->mlx)
|
||||||
return (NULL);
|
return ;
|
||||||
game.map = map;
|
game->map = map;
|
||||||
init_ply(map, &ply);
|
init_ply(map, &ply);
|
||||||
|
game->ply = &ply;
|
||||||
|
init_ray(&ray);
|
||||||
|
game->ray = &ray;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/27 14:14:51 by erey-bet #+# #+# */
|
/* Created: 2023/04/27 14:14:51 by erey-bet #+# #+# */
|
||||||
/* Updated: 2023/04/28 12:50:21 by erey-bet ### ########.fr */
|
/* Updated: 2023/05/03 12:44:41 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
int movement(t_ply *ply, int key)
|
int movement(t_ply *ply, int key)
|
||||||
{
|
{
|
||||||
else if (key == MLX_KEY_W)
|
if (key == MLX_KEY_W)
|
||||||
ply->pos_y -= 0.1;
|
ply->pos_y -= 0.1;
|
||||||
else if (key == MLX_KEY_S)
|
else if (key == MLX_KEY_S)
|
||||||
ply->pos_y += 0.1;
|
ply->pos_y += 0.1;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/27 14:30:29 by erey-bet #+# #+# */
|
/* Created: 2023/04/27 14:30:29 by erey-bet #+# #+# */
|
||||||
/* Updated: 2023/05/02 15:56:09 by erey-bet ### ########.fr */
|
/* Updated: 2023/05/03 12:45:15 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -28,12 +28,12 @@ int ray(t_game *game)
|
|||||||
ray->dir_x = p->dir_x + p->pla_x * camera;
|
ray->dir_x = p->dir_x + p->pla_x * camera;
|
||||||
ray->dir_y = p->dir_y + p->pla_y * camera;
|
ray->dir_y = p->dir_y + p->pla_y * camera;
|
||||||
}
|
}
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int raycasting(t_game *game)
|
int raycasting(t_game *game)
|
||||||
{
|
{
|
||||||
(void)game;
|
ray(game);
|
||||||
ray(game)
|
|
||||||
write(1, "raycasting...\n", 14);
|
write(1, "raycasting...\n", 14);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user