/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_key_loop.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/17 20:06:26 by rbousset #+# #+# */ /* Updated: 2020/02/17 20:06:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include #include #include #include int ft_key_loop(t_cub *cl) { uint8_t i; const float old_y = cl->plist.pos_y; const float old_x = cl->plist.pos_x; clock_t begin_frame; i = 0; while (i < 5 && cl->key_input[i] != -1 && cl->key_input[i] <= 5) { ft_handle_keys(i, old_y, old_x, cl); i++; } ft_check_bad_boy_shoot(cl); cl->moves = (cl->key_input[0] == -1) ? (0) : (cl->moves); begin_frame = clock(); ft_draw_scene(cl); ft_timings(begin_frame, cl); ft_get_fps_count(begin_frame, cl); return (0); }