/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_basic_keys.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: joelecle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:43:55 by joelecle #+# #+# */ /* Updated: 2020/02/14 17:43:56 by joelecle ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include int ft_w_key(t_cub *clist) { t_player *pl; const float move_speed = FT_MOVE_SPEED; pl = &clist->plist; pl->pos_y += move_speed * -pl->dir_y; pl->pos_x += move_speed * pl->dir_x; clist->moves = 1; return (0); } int ft_s_key(t_cub *clist) { t_player *pl; const float move_speed = FT_MOVE_SPEED; pl = &clist->plist; pl->pos_y += move_speed * pl->dir_y; pl->pos_x += move_speed * -pl->dir_x; clist->moves = 1; return (0); } int ft_a_key(t_cub *clist) { t_player *pl; const float move_speed = FT_STRAFE_SPEED; pl = &clist->plist; pl->pos_y += move_speed * -pl->dir_x; pl->pos_x += move_speed * -pl->dir_y; clist->moves = 1; return (0); } int ft_d_key(t_cub *clist) { t_player *pl; const float move_speed = FT_STRAFE_SPEED; pl = &clist->plist; pl->pos_y += move_speed * pl->dir_x; pl->pos_x += move_speed * pl->dir_y; clist->moves = 1; return (0); }