/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_death_hooks.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:28:52 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:28:52 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include static int ft_death_key_event(int keycode, t_cub *clist) { const int32_t tmp_code = keycode; keycode = ft_convert_keycode(tmp_code); if (keycode == FT_ESC_KEY) return (ft_exit(0, (clist))); if (keycode == FT_RET_KEY) { if (ft_warp_level(clist->mlist.filename, clist) < 0) return (ft_alloc_error(clist)); ft_draw_scene(clist); ft_hooks_and_loops(&clist->wlist, clist); return (0); } return (0); } static int ft_death_key_loop(t_cub *cl) { (void)cl; return (0); } void ft_death_hooks(t_win *wl, t_cub *cl) { mlx_hook(wl->winptr, 2, (1L << 0), ft_death_key_event, cl); mlx_loop_hook(wl->wlx, ft_death_key_loop, cl); mlx_loop(wl->wlx); }