From 9aab05aa368be99c2f5eec40ea7ae06843b2171b Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Fri, 21 Feb 2020 20:39:35 +0100 Subject: basically C++ --- src/ft_key_loop.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/ft_key_loop.c') diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c index b902e33..df163a9 100644 --- a/src/ft_key_loop.c +++ b/src/ft_key_loop.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include static void ft_collision(float old_y, float old_x, t_player *pl, t_map *ml) @@ -27,24 +29,23 @@ static void } } +static void +*ft_th_input(void *varg) +{ + return (NULL); +} + int ft_key_loop(t_cub *cl) { - int (*fun_ptr[6])(t_cub*); uint8_t i; const float old_y = cl->plist->pos_y; const float old_x = cl->plist->pos_x; - 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; i = 0; while (i < 5 && cl->key_input[i] != -1 && cl->key_input[i] <= 5) { - (*fun_ptr[cl->key_input[i]])(cl); + cl->key_ptr[cl->key_input[i]](cl); ft_collision(old_y, old_x, cl->plist, cl->mlist); ft_draw_scene(cl); i++; -- cgit v1.2.3