aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_convert_keycode.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-17 19:14:45 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-17 19:14:45 +0100
commit3843a3acf8553e3a01f3c2b80410ccf69142e23f (patch)
tree3afd9f0e92cfc1f18aa43389a56d39e20091e526 /src/ft_convert_keycode.c
parentMakefile update (diff)
download42-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 'src/ft_convert_keycode.c')
-rw-r--r--src/ft_convert_keycode.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ft_convert_keycode.c b/src/ft_convert_keycode.c
new file mode 100644
index 0000000..c676920
--- /dev/null
+++ b/src/ft_convert_keycode.c
@@ -0,0 +1,36 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_convert_keycode.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/17 19:00:20 by rbousset #+# #+# */
+/* Updated: 2020/02/17 19:00:21 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <cub3d.h>
+#include <stdint.h>
+
+int32_t
+ ft_convert_keycode(const int32_t tmp_code)
+{
+ uint16_t keycode;
+
+ keycode = UINT16_MAX;
+ (tmp_code == FT_W_KEY) ? (keycode = 0) : 0;
+ (tmp_code == FT_A_KEY) ? (keycode = 1) : 0;
+ (tmp_code == FT_S_KEY) ? (keycode = 2) : 0;
+ (tmp_code == FT_D_KEY) ? (keycode = 3) : 0;
+ (tmp_code == FT_L_ARR_KEY) ? (keycode = 4) : 0;
+ (tmp_code == FT_R_ARR_KEY) ? (keycode = 5) : 0;
+ (tmp_code == 3) ? (keycode = UINT16_MAX) : 0;
+ (tmp_code == 4) ? (keycode = UINT16_MAX) : 0;
+ (tmp_code == 5) ? (keycode = UINT16_MAX) : 0;
+ (tmp_code == FT_ESC_KEY) ? (keycode = FT_ESC_KEY) : 0;
+ (tmp_code == FT_F1_KEY) ? (keycode = FT_F1_KEY) : 0;
+ (tmp_code == FT_TAB_KEY) ? (keycode = FT_TAB_KEY) : 0;
+ return (keycode);
+}
+