diff --git a/algo.c b/algo.c index 52271f0..2d2eef2 100644 --- a/algo.c +++ b/algo.c @@ -6,7 +6,7 @@ /* By: grobledo +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/01 16:24:58 by grobledo #+# #+# */ -/* Updated: 2024/10/29 14:23:34 by grobledo ### ########.fr */ +/* Updated: 2024/10/29 14:33:28 by grobledo ### ########.fr */ /* */ /* ************************************************************************** */ @@ -77,8 +77,6 @@ static int loop_hook(void *param) return (0); } - - int main(int argc, char *argv[]) { g_mlx = mlx_init(); @@ -93,6 +91,7 @@ int main(int argc, char *argv[]) g_win = mlx_new_window(g_mlx, SCREEN_WIDTH, SCREEN_HEIGHT, "cub3d"); mlx_hook(g_win, KeyPress, KeyPressMask, keypress, NULL); mlx_hook(g_win, KeyRelease, KeyReleaseMask, keyrelease, NULL); + mlx_hook(g_win, 17, 1L<<17, ft_exit, NULL); mlx_loop_hook(g_mlx, loop_hook, NULL); draw_screen(); mlx_loop(g_mlx); diff --git a/input.c b/input.c index 45168e0..d3c2358 100644 --- a/input.c +++ b/input.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* input.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mcolonna +#+ +:+ +#+ */ +/* By: grobledo +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/17 14:43:36 by mcolonna #+# #+# */ -/* Updated: 2024/10/17 16:05:50 by mcolonna ### ########.fr */ +/* Updated: 2024/10/29 14:32:46 by grobledo ### ########.fr */ /* */ /* ************************************************************************** */ @@ -50,3 +50,8 @@ void input_init(void) g_input_actions.right = false; g_input_actions.quit = false; } +int ft_exit(void) +{ + g_input_actions.quit = true; + return(0); +} \ No newline at end of file diff --git a/input.h b/input.h index becd5a1..51f67d8 100644 --- a/input.h +++ b/input.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* input.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mcolonna +#+ +:+ +#+ */ +/* By: grobledo +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/17 14:43:09 by mcolonna #+# #+# */ -/* Updated: 2024/10/17 14:59:41 by mcolonna ### ########.fr */ +/* Updated: 2024/10/29 14:33:04 by grobledo ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,5 +31,5 @@ extern t_input_actions g_input_actions; int keypress(int keycode); int keyrelease(int keycode); void input_init(void); - +int ft_exit(void); #endif