diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_click_close.c | 26 | ||||
-rw-r--r-- | src/main.c | 4 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/ft_click_close.c b/src/ft_click_close.c new file mode 100644 index 0000000..87c0bbf --- /dev/null +++ b/src/ft_click_close.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_click_close.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/09 15:12:16 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/09 15:12:17 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <mlx.h> +#include <stdlib.h> + +int + ft_click_close(int keycode, t_cub *clist) +{ + ft_printf("Button [%d] pressed\n", keycode); + if (keycode == 8800) + return (ft_exit(0, clist)); + return (0); +} @@ -40,8 +40,8 @@ int ft_parse_map(argv[1], clist); if (ft_init_winlx(clist) < 0) return (ft_exit(3, clist)); - mlx_hook(clist->wlist->winptr, 2, 1L<<1, ft_key_event, clist); - /* mlx_key_hook(clist->wlist->winptr, ft_key_event, clist); */ + mlx_hook(clist->wlist->winptr, 2, 1L << 1, ft_key_event, clist); + mlx_hook(clist->wlist->winptr, 17, 1L << 3, ft_click_close, clist); ft_drawmap(clist); mlx_loop(clist->wlist->wlx); return (0); |