feat: made 3d... for the cub3d

This commit is contained in:
Theo Champion 2025-07-30 16:25:12 +02:00
parent 077659cd25
commit 5281fe6abd
8 changed files with 185 additions and 5 deletions

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
/* Updated: 2025/07/29 14:00:36 by tchampio ### ########.fr */
/* Updated: 2025/07/30 16:21:26 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,6 +21,9 @@
#include "draw/draw_map.h"
#include "map/mapdata.h"
#include "player/player.h"
#include "raycast/raycaster.h"
#include "renderer/render.h"
#include "raycast/ray.h"
#include "utils/hooks.h"
#include "utils/frees.h"
#include <stdbool.h>
@ -103,8 +106,12 @@ float coord_global_to_local(float coord)
int game_loop(t_cub3d_data *data)
{
t_ray ray;
mlx_destroy_image(data->mlx, data->img_data->img);
data->img_data->img = mlx_new_image(data->mlx, WIDTH, HEIGHT);
reset_matrix(data);
raycaster(data, &ray);
move_player(data);
// if (player_intercardinal_dir(data->player) == SOUTHEAST)
@ -137,7 +144,8 @@ int game_loop(t_cub3d_data *data)
// ray_angle += fraction;
// }
draw_map(data->map, &data->player, data->img_data);
//draw_map(data->map, &data->player, data->img_data);
matrix_to_image(data);
mlx_put_image_to_window(data->mlx, data->mlx_win,
data->img_data->img, 0, 0);
mlx_string_put(data->mlx, data->mlx_win, 10, 10, 0x00FFFFFF, COMPILED_TEXT);