From 78b858658ae508cb5e755d9a365dab9ba491831e Mon Sep 17 00:00:00 2001 From: Etienne Rey-bethbeder Date: Wed, 3 May 2023 12:45:40 +0200 Subject: [PATCH] =?UTF-8?q?=C3=A7a=20compile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/.game.h.swp | Bin 12288 -> 12288 bytes game/game.h | 7 +++++-- game/init.c | 19 +++++++++++-------- game/manage_keys.c | 4 ++-- game/raycasting.c | 6 +++--- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/game/.game.h.swp b/game/.game.h.swp index 8de16d6bcfe3054096eb7c0fd58c632372127d5e..f392d08dbad1b092fd5ba75fbb13f4731ce7e95b 100644 GIT binary patch delta 180 zcmZojXh@JwG6?hZRj|}EU;qLE28QWYK`BQYlXzEIGES7%VsbXw=)Q<~;s#bGUWUyd zm_=k*C$KXxJlM>sAk1hqo0EZI77+IWaWoJ|0kJ<2O8~Jr5VHaC3l0W`=Ro`bi0^Z3 zW@MSfKKZrAZl$vP%oNVdyv!1flK9-j0tGD~p`%a|pPrbTs-OiTH}BPKWactfFf_6< OF|sl?-0Y#dg9!jM-Yt#* delta 167 zcmZojXh@JwG6?hZRj|}EU;qLE1_oidz?8j>NxXcyOcSNGm|ToDx-Vj8FD*&awcrii z{DE0ShIKYO1HddoN&7?uL@3?NPe;#44x0%Bz#Rsv!{ApXq3!0-u(Uvq3` zWLd~Q`GLl6@sjxT#N1R)t<1d45{;7h+{6L}Eg-RZuVy1Nmyv>@sg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 hit; int side; + int line_height; + int draw_start; + int draw_end; } t_dda; typedef struct s_game @@ -60,7 +63,7 @@ typedef struct s_game } t_game; /* INIT */ -t_game *init(t_map *map); +void init(t_map *map, t_game *game); /* MANAGE */ void manage(mlx_key_data_t keydata, void *param); diff --git a/game/init.c b/game/init.c index f343418..403166a 100644 --- a/game/init.c +++ b/game/init.c @@ -6,7 +6,7 @@ /* 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) { - ray->x = 0; - ray->y = 0; + ray->dir_x = 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_ray ray; - game.mlx = mlx_init(WIDTH, HEIGHT, "jan lili", true); - if (!game.mlx) - return (NULL); - game.map = map; + game->mlx = mlx_init(WIDTH, HEIGHT, "jan lili", true); + if (!game->mlx) + return ; + game->map = map; init_ply(map, &ply); + game->ply = &ply; + init_ray(&ray); + game->ray = &ray; } diff --git a/game/manage_keys.c b/game/manage_keys.c index d58fcd7..acde5d5 100644 --- a/game/manage_keys.c +++ b/game/manage_keys.c @@ -6,7 +6,7 @@ /* 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) { - else if (key == MLX_KEY_W) + if (key == MLX_KEY_W) ply->pos_y -= 0.1; else if (key == MLX_KEY_S) ply->pos_y += 0.1; diff --git a/game/raycasting.c b/game/raycasting.c index 742dbf0..46c80c9 100644 --- a/game/raycasting.c +++ b/game/raycasting.c @@ -6,7 +6,7 @@ /* 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_y = p->dir_y + p->pla_y * camera; } + return(0); } int raycasting(t_game *game) { - (void)game; - ray(game) + ray(game); write(1, "raycasting...\n", 14); return (0); }