-
Notifications
You must be signed in to change notification settings - Fork 0
/
move.c
43 lines (37 loc) · 1.39 KB
/
move.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* move.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dvan-der <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/15 08:23:49 by dvan-der #+# #+# */
/* Updated: 2021/12/16 15:41:05 by dvan-der ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
static void increase_xy(t_fdf *fdf, double x, int y);
void move(int key, void *param)
{
t_fdf *fdf;
fdf = (t_fdf *)param;
if (key == 123)
increase_xy(fdf, -100, 1);
else if (key == 124)
increase_xy(fdf, 100, 1);
else if (key == 125)
increase_xy(fdf, 100, 0);
else if (key == 126)
increase_xy(fdf, -100, 0);
}
static void increase_xy(t_fdf *fdf, double x, int y)
{
t_camera *camera;
camera = fdf->camera;
if (y == 0)
camera->y += x;
else
camera->x += x;
make_black(fdf);
letsdraw(fdf);
}