aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_key_events.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-01-24 16:51:34 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-01-24 16:51:34 +0100
commit090bda7406b0a3d1692624cf464dd46fb781d55f (patch)
treeadcb05fd965a98d1f4fda9a2cdf2168d103a5a80 /src/ft_key_events.c
parentIt ain't much but it's honest work (diff)
download42-cub3d-090bda7406b0a3d1692624cf464dd46fb781d55f.tar.gz
42-cub3d-090bda7406b0a3d1692624cf464dd46fb781d55f.tar.bz2
42-cub3d-090bda7406b0a3d1692624cf464dd46fb781d55f.tar.xz
42-cub3d-090bda7406b0a3d1692624cf464dd46fb781d55f.tar.zst
42-cub3d-090bda7406b0a3d1692624cf464dd46fb781d55f.zip
Key defines for compatibility between Linux/Darwin
Diffstat (limited to 'src/ft_key_events.c')
-rw-r--r--src/ft_key_events.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index 088df54..74d6346 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -35,14 +35,17 @@ ft_key_event(int keycode, void *param)
{
int (*fun_ptr[4])(void);
- fun_ptr[0] = ft_a_key;
- fun_ptr[1] = ft_s_key;
- fun_ptr[2] = ft_d_key;
- fun_ptr[3] = ft_w_key;
+ fun_ptr[0] = ft_w_key;
+ fun_ptr[1] = ft_a_key;
+ fun_ptr[2] = ft_s_key;
+ fun_ptr[3] = ft_d_key;
ft_printf("Key [%d] pressed\n", keycode);
- (keycode == 13) ? (keycode = 3) : 0;
+ (keycode == FT_W_KEY) ? (keycode = 0) : 0;
+ (keycode == FT_A_KEY) ? (keycode = 1) : 0;
+ (keycode == FT_S_KEY) ? (keycode = 2) : 0;
+ (keycode == FT_D_KEY) ? (keycode = 3) : 0;
(keycode <= 3) ? ((*fun_ptr[keycode])()) : 0;
- if (keycode == 53)
+ if (keycode == FT_ESC_KEY)
{
ft_memdel(((t_win*)param)->winptr);
ft_memdel(((t_win*)param)->wlx);