blob: e6a79f683dbd5df48d03f138c2ce5ae88a01629e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_key_loop.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: joelecle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/17 20:06:26 by joelecle #+# #+# */
/* Updated: 2020/02/17 20:06:29 by joelecle ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
#include <mlx.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include <unistd.h>
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);
}
|