From 3b479838dbc39c1f1a47f3479207f065ebeef5b1 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 13:35:58 +0100 Subject: [PATCH 01/18] remove pad i find that without pad the view is far more realistic, without that empty space between the camera plane and the wall --- src/engine/player/move_player.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/engine/player/move_player.c b/src/engine/player/move_player.c index d213073..8bce75c 100644 --- a/src/engine/player/move_player.c +++ b/src/engine/player/move_player.c @@ -12,38 +12,38 @@ #include "main.h" -int move_up(t_player *p, char **map, double speed, double pad) +int move_up(t_player *p, char **map, double speed) { - if (map[(int)p->pos_y][(int)(p->pos_x + p->dir_x * (speed + pad))] != '1') + if (map[(int)p->pos_y][(int)(p->pos_x + p->dir_x * speed)] != '1') p->pos_x += p->dir_x * speed; - if (map[(int)(p->pos_y + p->dir_y * (speed + pad))][(int)p->pos_x] != '1') + if (map[(int)(p->pos_y + p->dir_y * speed)][(int)p->pos_x] != '1') p->pos_y += p->dir_y * speed; return (0); } -int move_down(t_player *p, char **map, double speed, double pad) +int move_down(t_player *p, char **map, double speed) { - if (map[(int)p->pos_y][(int)(p->pos_x - p->dir_x * (speed + pad))] != '1') + if (map[(int)p->pos_y][(int)(p->pos_x - p->dir_x * speed)] != '1') p->pos_x -= p->dir_x * speed; - if (map[(int)(p->pos_y - p->dir_y * (speed + pad))][(int)p->pos_x] != '1') + if (map[(int)(p->pos_y - p->dir_y * speed)][(int)p->pos_x] != '1') p->pos_y -= p->dir_y * speed; return (0); } -int move_rigth(t_player *p, char **map, double speed, double pad) +int move_rigth(t_player *p, char **map, double speed) { - if (map[(int)p->pos_y][(int)(p->pos_x + p->plane_x * (speed + pad))] != '1') + if (map[(int)p->pos_y][(int)(p->pos_x + p->plane_x * speed)] != '1') p->pos_x += p->plane_x * speed; - if (map[(int)(p->pos_y + p->plane_y * (speed + pad))][(int)p->pos_x] != '1') + if (map[(int)(p->pos_y + p->plane_y * speed)][(int)p->pos_x] != '1') p->pos_y += p->plane_y * speed; return (0); } -int move_left(t_player *p, char **map, double speed, double pad) +int move_left(t_player *p, char **map, double speed) { - if (map[(int)p->pos_y][(int)(p->pos_x - p->plane_x * (speed + pad))] != '1') + if (map[(int)p->pos_y][(int)(p->pos_x - p->plane_x * speed)] != '1') p->pos_x -= p->plane_x * speed; - if (map[(int)(p->pos_y - p->plane_y * speed - pad)][(int)p->pos_x] != '1') + if (map[(int)(p->pos_y - p->plane_y * speed)][(int)p->pos_x] != '1') p->pos_y -= p->plane_y * speed; return (0); } @@ -51,12 +51,12 @@ int move_left(t_player *p, char **map, double speed, double pad) int move_player(t_player *p, char **map, t_game *game) { if (p->key_w) - move_up(p, map, p->move_speed * game->delta_time, 0.30); + move_up(p, map, p->move_speed * game->delta_time); if (p->key_s) - move_down(p, map, p->move_speed * game->delta_time, 0.30); + move_down(p, map, p->move_speed * game->delta_time); if (p->key_d) - move_rigth(p, map, p->move_speed * game->delta_time, 0.30); + move_rigth(p, map, p->move_speed * game->delta_time); if (p->key_a) - move_left(p, map, p->move_speed * game->delta_time, 0.30); + move_left(p, map, p->move_speed * game->delta_time); return (0); } From 50d82aa117f9d3ccbebcbd2e7b85fcf969fb0cf7 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 13:36:07 +0100 Subject: [PATCH 02/18] only render minimap on bonus --- src/render/render_canvas.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/render/render_canvas.c b/src/render/render_canvas.c index c2854e4..46e2f24 100644 --- a/src/render/render_canvas.c +++ b/src/render/render_canvas.c @@ -33,12 +33,11 @@ void draw_square(t_game *game, int x, int y, int size) return ; } -// -50 to hide textures - void create_canvas(t_game *game) { ft_bzero(game->screen.addr, HEIGHT * game->screen.size_line); draw_background(game); cast_rays(game); - generate_minimap(game); + if (BONUS) + generate_minimap(game); } From a57ff60fb9d95246f0deacd269e910279442760a Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 13:36:15 +0100 Subject: [PATCH 03/18] only print data on debug mode --- src/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index e8414b6..3d200be 100644 --- a/src/main.c +++ b/src/main.c @@ -29,7 +29,8 @@ int main(int ac, char **av) if (error) return (safe_exit(&game, error)); load_player_dt(&game); - print_data(&game); + if (DEBUG) + print_data(&game); run_win_mlx(&game); return (safe_exit(&game, 0)); } From 6279c8fddfabbf9265cd5f39880664d42266ca1e Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 13:36:25 +0100 Subject: [PATCH 04/18] setup debug and bonus variables --- inc/main.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inc/main.h b/inc/main.h index a39344e..63016ac 100644 --- a/inc/main.h +++ b/inc/main.h @@ -27,4 +27,13 @@ # include "mini_map.h" # include "raycast.h" # include + +# ifndef DEBUG +# define DEBUG 0 +# endif + +# ifndef BONUS +# define BONUS 1 +# endif + #endif From d121b2376dc89ada7d34d349be41bd8b87a9395d Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 13:36:37 +0100 Subject: [PATCH 05/18] setup makefile with bonus and debug modes --- Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f3ba90c..ca78f9c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -NAME = cub3d +NAME = cub3D SRCDIR = src OBJDIR = .obj INCDIR = inc @@ -6,6 +6,8 @@ MINILIB_DIR = $(INCDIR)/minilibx MINILIB = $(MINILIB_DIR)/libmlx.a LIBFT_DIR = $(INCDIR)/libft LIBFT = $(LIBFT_DIR)/libft.a +DEBUG = 0 +BONUS = 0 CC = cc CFLAGS = -Wall -Wextra -Werror -I$(INCDIR) -I$(LIBFT_DIR) -g3 -O0 -Wshadow -Wstrict-prototypes -Wpointer-arith ASAN_FLAGS = -fsanitize=address,undefined -fno-omit-frame-pointer @@ -70,7 +72,7 @@ all: $(NAME) compile_flags.txt @printf " $(C)✅ [$(NAME)] $(B)Build complete$(X)\n" $(NAME): $(OBJ) $(LIBFT) $(MINILIB) - @$(CC) $(CFLAGS) -L$(LIBFT_DIR) $(OBJ) $(LIBFT) -L$(MINILIB_DIR) $(MINILIB) -lmlx -lXext -lX11 -lm -o $(NAME) + @$(CC) $(CFLAGS) -DDEBUG=$(DEBUG) -DBONUS=$(BONUS) -L$(LIBFT_DIR) $(OBJ) $(LIBFT) -L$(MINILIB_DIR) $(MINILIB) -lmlx -lXext -lX11 -lm -o $(NAME) $(MINILIB): @printf "$(Y) 📚 [MiniLibX] building... $(RESET)" @@ -81,7 +83,7 @@ $(LIBFT): $(OBJDIR)/%.o: $(SRCDIR)/%.c @mkdir -p $(@D) - @$(CC) $(CFLAGS) -c $< -o $@ + @$(CC) $(CFLAGS) -DDEBUG=$(DEBUG) -DBONUS=$(BONUS) -c $< -o $@ @$(call progress,$(words $(SRC))) clean: @@ -100,8 +102,13 @@ re: fclean all asan: CFLAGS += $(VAL_FLAGS) $(ASAN_FLAGS) asan: re -run: re - ./$(NAME) +bonus: + make re BONUS=1 + +debug: + make re DEBUG=1 +bonus-dbg: + make re BONUS=1 DEBUG=1 norm: @norminette src inc/*.h inc/libft | grep "Error" || echo "${G}No errors found :3${X}" From 513a3d61178a760946b67c7d2d5ece7a2de79c32 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 15:34:49 +0100 Subject: [PATCH 06/18] add mouse bonus and remove flag that was conflicting with minilibx --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ca78f9c..8f21589 100644 --- a/Makefile +++ b/Makefile @@ -9,11 +9,12 @@ LIBFT = $(LIBFT_DIR)/libft.a DEBUG = 0 BONUS = 0 CC = cc -CFLAGS = -Wall -Wextra -Werror -I$(INCDIR) -I$(LIBFT_DIR) -g3 -O0 -Wshadow -Wstrict-prototypes -Wpointer-arith +CFLAGS = -Wall -Wextra -Werror -I$(INCDIR) -I$(LIBFT_DIR) -g3 -O0 -Wshadow -Wpointer-arith ASAN_FLAGS = -fsanitize=address,undefined -fno-omit-frame-pointer SRC =main.c \ core/utils.c \ core/win.c \ + core/mouse_bonus.c \ \ debug/main.c \ \ From bed27a3b005312c515b9d63e2d011016ddeebaf2 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 15:35:13 +0100 Subject: [PATCH 07/18] add x11 mouse headers --- inc/main.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/main.h b/inc/main.h index 63016ac..e8ca33b 100644 --- a/inc/main.h +++ b/inc/main.h @@ -13,6 +13,11 @@ #ifndef MAIN_H # define MAIN_H +# include +# include +# include +# include + # include "libft/libft.h" # include "minilibx/mlx.h" # include "struct.h" @@ -22,11 +27,9 @@ # include "mlx_win.h" # include "parsing.h" # include "player.h" -# include # include "textures.h" # include "mini_map.h" # include "raycast.h" -# include # ifndef DEBUG # define DEBUG 0 From a09922ee8590cbf171b1f0d72d7ae6bcce6ef224 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 15:35:24 +0100 Subject: [PATCH 08/18] revert to use any param --- inc/minilibx/mlx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/minilibx/mlx.h b/inc/minilibx/mlx.h index 21d9050..a13d348 100644 --- a/inc/minilibx/mlx.h +++ b/inc/minilibx/mlx.h @@ -6,7 +6,7 @@ /* By: rpinheir +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/04 12:28:03 by rpinheir #+# #+# */ -/* Updated: 2026/11/04 12:30:09 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 14:22:28 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -103,7 +103,7 @@ int mlx_destroy_display(void *mlx_ptr); */ int mlx_hook(void *win_ptr, int x_event, int x_mask, - int (*funct)(void), void *param); + int (*funct)(), void *param); int mlx_do_key_autorepeatoff(void *mlx_ptr); int mlx_do_key_autorepeaton(void *mlx_ptr); From bf216830d7f868e8081461b07370f5214edbe1c7 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 15:36:45 +0100 Subject: [PATCH 09/18] setup mouse variables DIST_EDGE = Distance x should be from the edge of window mouse_x = x of mouse on window --- inc/mlx_win.h | 4 +++- inc/struct.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/mlx_win.h b/inc/mlx_win.h index 08274a2..3644477 100644 --- a/inc/mlx_win.h +++ b/inc/mlx_win.h @@ -6,7 +6,7 @@ /* By: ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/12 15:00:51 by ch #+# #+# */ -/* Updated: 2026/11/16 20:08:58 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 14:53:18 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -17,6 +17,7 @@ # define WIDTH 1920 # define MINI_OFFSET_X 0 # define MINI_OFFSET_Y 0 +# define DIST_EDGE_WRAP 20 void draw_background(t_game *game); int fill_path_img(t_img *img, char *path); @@ -29,4 +30,5 @@ void clear_paths(t_game *game); int safe_exit(t_game *game, int code); void generate_minimap(t_game *game); double get_time_in_seconds(void); +int mouse_handler(int x, int y, t_game *game); #endif // H_WIN diff --git a/inc/struct.h b/inc/struct.h index d19f074..569f39a 100644 --- a/inc/struct.h +++ b/inc/struct.h @@ -6,7 +6,7 @@ /* By: chguerre Date: Tue, 24 Nov 2026 15:36:59 +0100 Subject: [PATCH 10/18] use mouse to rotate player --- src/core/win.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/win.c b/src/core/win.c index f62af6a..4610063 100644 --- a/src/core/win.c +++ b/src/core/win.c @@ -6,7 +6,7 @@ /* By: ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/12 17:26:06 by ch #+# #+# */ -/* Updated: 2026/11/12 17:26:06 by ch ### ########.ch */ +/* Updated: 2026/11/24 15:34:09 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -59,6 +59,9 @@ int run_win_mlx(t_game *game) init_graphics(game); mlx_hook(game->win_ptr, 2, 1L << 0, (void *)handle_keypressed, game); mlx_hook(game->win_ptr, 3, 1L << 1, (void *)handle_keyrelease, game); + if (BONUS) + mlx_hook(game->win_ptr, MotionNotify, PointerMotionMask, + mouse_handler, game); mlx_hook(game->win_ptr, 17, 9, (void *)close_window, game); mlx_loop_hook(game->mlx_ptr, (void *)game_loop, game); mlx_loop(game->mlx_ptr); From 0ade9f895832a4494c3087ccc0e8dd011ad54822 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 15:37:07 +0100 Subject: [PATCH 11/18] main mouse bonus function --- src/core/mouse_bonus.c | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/core/mouse_bonus.c diff --git a/src/core/mouse_bonus.c b/src/core/mouse_bonus.c new file mode 100644 index 0000000..4ea017b --- /dev/null +++ b/src/core/mouse_bonus.c @@ -0,0 +1,69 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* mouse_bonus.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rpinheir +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2026/11/24 13:58:37 by rpinheir #+# #+# */ +/* Updated: 2026/11/24 15:33:20 by rpinheir ### ########.ch */ +/* */ +/* ************************************************************************** */ + +#include "main.h" + +static int wrap_mouse_location(int x, int y, t_game *game) +{ + if (x > WIDTH - DIST_EDGE_WRAP) + { + x = DIST_EDGE_WRAP; + mlx_mouse_move(game->mlx_ptr, game->win_ptr, x, y); + game->mouse_x = x ; + return (1); + } + if (x < DIST_EDGE_WRAP) + { + x = WIDTH - DIST_EDGE_WRAP; + mlx_mouse_move(game->mlx_ptr, game->win_ptr, x, y); + game->mouse_x = x; + return (1); + } + return (0);\ +} + +static void setup_rotation(double cos_rot, double sin_rot, t_game *game) +{ + double old_dir_x; + double old_plane_x; + + old_dir_x = game->player.dir_x; + game->player.dir_x = old_dir_x * cos_rot - game->player.dir_y * sin_rot; + game->player.dir_y = old_dir_x * sin_rot + game->player.dir_y * cos_rot; + old_plane_x = game->player.plane_x; + game->player.plane_x = old_plane_x * cos_rot + - game->player.plane_y * sin_rot; + game->player.plane_y = old_plane_x * sin_rot + + game->player.plane_y * cos_rot; +} + +int mouse_handler(int x, int y, t_game *game) +{ + double cos_rot; + double sin_rot; + double angle; + + mlx_mouse_hide(game->mlx_ptr, game->win_ptr); + if (wrap_mouse_location(x, y, game) != 0) + return (0); + if (x == game->mouse_x) + return (0); + angle = (x - game->mouse_x) * 0.002; + cos_rot = cos(angle); + sin_rot = sin(angle); + game->mouse_x = x; + setup_rotation(cos_rot, sin_rot, game); + if (DEBUG) + printf("dir: %f %f plane: %f %f\n", game->player.dir_x, + game->player.dir_y, game->player.plane_x, game->player.plane_y); + return (0); +} From e4808524c1de836b64425cb798cd79ffe921e734 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 16:03:55 +0100 Subject: [PATCH 12/18] hide mouse by default --- src/core/mouse_bonus.c | 3 +-- src/core/win.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/mouse_bonus.c b/src/core/mouse_bonus.c index 4ea017b..334445e 100644 --- a/src/core/mouse_bonus.c +++ b/src/core/mouse_bonus.c @@ -6,7 +6,7 @@ /* By: rpinheir +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/24 13:58:37 by rpinheir #+# #+# */ -/* Updated: 2026/11/24 15:33:20 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 16:03:31 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -52,7 +52,6 @@ int mouse_handler(int x, int y, t_game *game) double sin_rot; double angle; - mlx_mouse_hide(game->mlx_ptr, game->win_ptr); if (wrap_mouse_location(x, y, game) != 0) return (0); if (x == game->mouse_x) diff --git a/src/core/win.c b/src/core/win.c index 4610063..a41029a 100644 --- a/src/core/win.c +++ b/src/core/win.c @@ -6,7 +6,7 @@ /* By: ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/12 17:26:06 by ch #+# #+# */ -/* Updated: 2026/11/24 15:34:09 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 15:59:49 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -59,6 +59,7 @@ int run_win_mlx(t_game *game) init_graphics(game); mlx_hook(game->win_ptr, 2, 1L << 0, (void *)handle_keypressed, game); mlx_hook(game->win_ptr, 3, 1L << 1, (void *)handle_keyrelease, game); + mlx_mouse_hide(game->mlx_ptr, game->win_ptr); if (BONUS) mlx_hook(game->win_ptr, MotionNotify, PointerMotionMask, mouse_handler, game); From 68014ee5e585f1c3ab2e93351f9264a90cc675bf Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 16:04:16 +0100 Subject: [PATCH 13/18] add struct to mlx_win.h --- inc/mlx_win.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/mlx_win.h b/inc/mlx_win.h index 3644477..0fa30c3 100644 --- a/inc/mlx_win.h +++ b/inc/mlx_win.h @@ -6,13 +6,14 @@ /* By: ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/12 15:00:51 by ch #+# #+# */ -/* Updated: 2026/11/24 14:53:18 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 15:41:01 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ #ifndef MLX_WIN_H # define MLX_WIN_H +#include "struct.h" # define HEIGHT 1080 # define WIDTH 1920 # define MINI_OFFSET_X 0 From 9c8399bab397eea12c2e9d553e742975630c0e37 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 16:08:21 +0100 Subject: [PATCH 14/18] fix norm --- inc/mlx_win.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/mlx_win.h b/inc/mlx_win.h index 0fa30c3..3591cea 100644 --- a/inc/mlx_win.h +++ b/inc/mlx_win.h @@ -6,14 +6,14 @@ /* By: ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/12 15:00:51 by ch #+# #+# */ -/* Updated: 2026/11/24 15:41:01 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 16:08:01 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ #ifndef MLX_WIN_H # define MLX_WIN_H +# include "struct.h" -#include "struct.h" # define HEIGHT 1080 # define WIDTH 1920 # define MINI_OFFSET_X 0 From 16ba118f10a83da5ec08f68bc74562dc33f59798 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 16:10:46 +0100 Subject: [PATCH 15/18] add phony and silence change of directories --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8f21589..f6eea4e 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +MAKEFLAGS += --silent NAME = cub3D SRCDIR = src OBJDIR = .obj @@ -117,4 +118,4 @@ norm: compile_flags.txt: Makefile @printf '%s\n' $(filter -I% -D% -std=%,$(CPPFLAGS) $(CFLAGS)) > $@ -.PHONY: all clean fclean re debug asan +.PHONY: all clean fclean re debug asan bonus bonus-dbg From 07d4676563ce6409d71a08aa0cff058f69acd0c6 Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 16:23:11 +0100 Subject: [PATCH 16/18] fix mlx param --- inc/mlx_win.h | 4 ++-- src/core/mouse_bonus.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/mlx_win.h b/inc/mlx_win.h index 3591cea..343394e 100644 --- a/inc/mlx_win.h +++ b/inc/mlx_win.h @@ -6,7 +6,7 @@ /* By: ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/12 15:00:51 by ch #+# #+# */ -/* Updated: 2026/11/24 16:08:01 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 16:19:43 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -31,5 +31,5 @@ void clear_paths(t_game *game); int safe_exit(t_game *game, int code); void generate_minimap(t_game *game); double get_time_in_seconds(void); -int mouse_handler(int x, int y, t_game *game); +int mouse_handler(int x, int y, void *param); #endif // H_WIN diff --git a/src/core/mouse_bonus.c b/src/core/mouse_bonus.c index 334445e..b1920bb 100644 --- a/src/core/mouse_bonus.c +++ b/src/core/mouse_bonus.c @@ -6,7 +6,7 @@ /* By: rpinheir +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/24 13:58:37 by rpinheir #+# #+# */ -/* Updated: 2026/11/24 16:03:31 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 16:20:48 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -46,12 +46,14 @@ static void setup_rotation(double cos_rot, double sin_rot, t_game *game) + game->player.plane_y * cos_rot; } -int mouse_handler(int x, int y, t_game *game) +int mouse_handler(int x, int y, void *param) { double cos_rot; double sin_rot; double angle; + t_game *game; + game = (t_game *)param; if (wrap_mouse_location(x, y, game) != 0) return (0); if (x == game->mouse_x) From 169320a7b12873e3df051208a9a95ee1f5d3be2c Mon Sep 17 00:00:00 2001 From: ruipedro-pinheiro Date: Tue, 24 Nov 2026 16:29:06 +0100 Subject: [PATCH 17/18] add cast to avoid CI break --- src/core/win.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/win.c b/src/core/win.c index a41029a..d0a2e62 100644 --- a/src/core/win.c +++ b/src/core/win.c @@ -6,7 +6,7 @@ /* By: ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/11/12 17:26:06 by ch #+# #+# */ -/* Updated: 2026/11/24 15:59:49 by rpinheir ### ########.ch */ +/* Updated: 2026/11/24 16:28:54 by rpinheir ### ########.ch */ /* */ /* ************************************************************************** */ @@ -62,7 +62,7 @@ int run_win_mlx(t_game *game) mlx_mouse_hide(game->mlx_ptr, game->win_ptr); if (BONUS) mlx_hook(game->win_ptr, MotionNotify, PointerMotionMask, - mouse_handler, game); + (void *)mouse_handler, game); mlx_hook(game->win_ptr, 17, 9, (void *)close_window, game); mlx_loop_hook(game->mlx_ptr, (void *)game_loop, game); mlx_loop(game->mlx_ptr); From 3a0d41492dadc9d03ba2e1dae55c9e94d08f2b3b Mon Sep 17 00:00:00 2001 From: Pedro Pinheiro Date: Tue, 24 Nov 2026 16:30:45 +0100 Subject: [PATCH 18/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index a03401a..4244282 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -35,4 +35,4 @@ jobs: - name: make run: make - name: cub3d - run: ./cub3d maps/valid/mandatory.cub + run: ./cub3D maps/valid/mandatory.cub