-
Notifications
You must be signed in to change notification settings - Fork 0
/
move_head.c
66 lines (60 loc) · 1.59 KB
/
move_head.c
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
/*
** move_head.c for w3d in /home/sebastien/travaux/Wolf3d
**
** Made by sebastien
** Login <sebastien@epitech.net>
**
** Started on Fri Jan 10 22:16:48 2014 sebastien
** Last update Sun Jan 12 17:56:54 2014 sebastien
*/
#include "wolf.h"
void head_up(t_infos_mlx *infos_mlx)
{
if (infos_mlx->env->head <= 200)
{
infos_mlx->env->head = infos_mlx->env->head + 5;
disp_img(infos_mlx, infos_mlx->env->map, infos_mlx->env);
manage_expose(infos_mlx);
}
}
void head_down(t_infos_mlx *infos_mlx)
{
if (infos_mlx->env->head >= -200)
{
infos_mlx->env->head = infos_mlx->env->head - 5;
disp_img(infos_mlx, infos_mlx->env->map, infos_mlx->env);
manage_expose(infos_mlx);
}
}
void head_restore(t_infos_mlx *infos_mlx)
{
if (infos_mlx->env->head != 0)
{
if ((infos_mlx->env->head > 0 && infos_mlx->env->head < 25)
|| (infos_mlx->env->head < 0 && infos_mlx->env->head > -25))
infos_mlx->env->head = 0;
else if (infos_mlx->env->head > 0)
infos_mlx->env->head = infos_mlx->env->head - 25;
else
infos_mlx->env->head = infos_mlx->env->head + 25;
infos_mlx->env->head = infos_mlx->env->head - 1;
disp_img(infos_mlx, infos_mlx->env->map, infos_mlx->env);
manage_expose(infos_mlx);
}
}
void more_rot(t_infos_mlx *infos_mlx)
{
if (infos_mlx->env->rot_speed + 5 < 100)
{
infos_mlx->env->rot_speed = infos_mlx->env->rot_speed + 5;
manage_expose(infos_mlx);
}
}
void less_rot(t_infos_mlx *infos_mlx)
{
if (infos_mlx->env->rot_speed - 5 > 0)
{
infos_mlx->env->rot_speed = infos_mlx->env->rot_speed - 5;
manage_expose(infos_mlx);
}
}