diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_key_events.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c index da416fa..2c189ad 100644 --- a/src/ft_key_events.c +++ b/src/ft_key_events.c @@ -61,23 +61,28 @@ int { t_player *pl; t_map *ml; - int8_t (*fun_ptr[4])(t_cub*); + int8_t (*fun_ptr[6])(t_cub*); const uint16_t tmp_code = keycode; fun_ptr[0] = ft_w_key; fun_ptr[1] = ft_a_key; fun_ptr[2] = ft_s_key; fun_ptr[3] = ft_d_key; + fun_ptr[4] = ft_left_key; + fun_ptr[5] = ft_right_key; ft_printf("Key [%d] pressed\n", tmp_code); (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 == 3) ? (keycode = INT16_MAX) : 0; - (tmp_code == 4) ? (keycode = INT16_MAX) : 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; pl = clist->plist; ml = clist->mlist; - if (keycode <= 3) + if (keycode <= 5) { (*fun_ptr[keycode])(clist); (pl->pos_y < 1) ? (pl->pos_y = 1.1) : 0; |