diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_key_events.c | 18 | ||||
-rw-r--r-- | src/main.c | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c new file mode 100644 index 0000000..f333cd0 --- /dev/null +++ b/src/ft_key_events.c @@ -0,0 +1,18 @@ +#include <libft.h> +#include <cub3d.h> +#include <stdlib.h> + +int +ft_key_event(int keycode, void *param) +{ + (void)param; + ft_printf("Key [%d] pressed\n", keycode); + if (keycode == 53) + { + /* ft_memdel(param->wlx); */ + /* ft_memdel(param->winptr); */ + /* ft_memdel(param); */ + exit(0); + } + return (0); +} @@ -11,6 +11,7 @@ int wlist = ft_init_winlist(); clist = ft_init_cublist(); + mlx_key_hook(wlist->winptr, ft_key_event, wlist); mlx_loop(wlist->wlx); ft_memdel(wlist->wlx); ft_memdel(wlist->winptr); |