aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_key_events.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-02-14 00:04:37 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-02-14 00:04:37 +0100
commit3831ffb031bd236cba9eedd2b6dc24a6d9bff515 (patch)
treeacc698bc7a81303f5f2206c8e5446d4379235610 /src/ft_key_events.c
parentLess retarded Makefile (diff)
download42-cub3d-3831ffb031bd236cba9eedd2b6dc24a6d9bff515.tar.gz
42-cub3d-3831ffb031bd236cba9eedd2b6dc24a6d9bff515.tar.bz2
42-cub3d-3831ffb031bd236cba9eedd2b6dc24a6d9bff515.tar.xz
42-cub3d-3831ffb031bd236cba9eedd2b6dc24a6d9bff515.tar.zst
42-cub3d-3831ffb031bd236cba9eedd2b6dc24a6d9bff515.zip
Added turn around keys
Diffstat (limited to 'src/ft_key_events.c')
-rw-r--r--src/ft_key_events.c13
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;