blob: 3b9ce4212596e87a735025f3ba19b76aa425f0a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_basic_keys.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: joelecle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 17:43:55 by joelecle #+# #+# */
/* Updated: 2020/02/14 17:43:56 by joelecle ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <cub3d.h>
#include <stdint.h>
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);
}
|