diff options
author | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-02-17 19:14:45 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-02-17 19:14:45 +0100 |
commit | 3843a3acf8553e3a01f3c2b80410ccf69142e23f (patch) | |
tree | 3afd9f0e92cfc1f18aa43389a56d39e20091e526 /src/ft_key_release.c | |
parent | Makefile update (diff) | |
download | 42-cub3d-3843a3acf8553e3a01f3c2b80410ccf69142e23f.tar.gz 42-cub3d-3843a3acf8553e3a01f3c2b80410ccf69142e23f.tar.bz2 42-cub3d-3843a3acf8553e3a01f3c2b80410ccf69142e23f.tar.xz 42-cub3d-3843a3acf8553e3a01f3c2b80410ccf69142e23f.tar.zst 42-cub3d-3843a3acf8553e3a01f3c2b80410ccf69142e23f.zip |
Multi-key in progress
Diffstat (limited to '')
-rw-r--r-- | src/ft_key_release.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/ft_key_release.c b/src/ft_key_release.c new file mode 100644 index 0000000..e56b9d0 --- /dev/null +++ b/src/ft_key_release.c @@ -0,0 +1,43 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_key_release.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/17 18:43:56 by rbousset #+# #+# */ +/* Updated: 2020/02/17 18:43:59 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <stdint.h> + +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++; + } +} + +int + ft_key_release(int keycode, t_cub *clist) +{ + keycode = ft_convert_keycode(keycode); + ft_pop_key(keycode, clist); + ft_printf("keys [%d][%d][%d][%d][%d]\n", + clist->key_input[0], + clist->key_input[1], + clist->key_input[2], + clist->key_input[3], + clist->key_input[4]); + return (0); +} |