blob: f0e3451101545183e520c82815b6ce52550e33e5 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_key_release.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: joelecle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/17 18:43:56 by joelecle #+# #+# */
/* Updated: 2020/02/17 18:43:59 by joelecle ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
static void
ft_decale(t_cub *cl)
{
uint8_t i;
i = 0;
while (i < 3)
{
if (cl->key_input[i] == -1 && cl->key_input[i + 1] != -1)
{
cl->key_input[i] = cl->key_input[i + 1];
cl->key_input[i + 1] = -1;
}
i++;
}
}
static void
ft_pop_key(uint16_t keycode, t_cub *clist)
{
uint8_t i;
i = 0;
while (i < 5)
{
if (clist->key_input[i] == keycode)
clist->key_input[i] = -1;
i++;
}
ft_decale(clist);
}
int
ft_key_release(int keycode, t_cub *clist)
{
keycode = ft_convert_keycode(keycode);
ft_pop_key(keycode, clist);
return (0);
}
|