-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_key_pressed2.c
54 lines (49 loc) · 1.55 KB
/
ft_key_pressed2.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_key_pressed2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atabiti <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/20 08:51:51 by atabiti #+# #+# */
/* Updated: 2022/03/25 11:53:08 by atabiti ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
int ft_key_w(int key, struct s_s2 *a)
{
if (key == 13)
{
if (a->exactarray[a->y_p - 1][a->x_p] != '1')
{
a->collects = check_collectible_up(a, a->collects);
deal_key4(a, a->collects);
ft_printer(a->ft_movements);
}
}
return (0);
}
int ft_key_a(int key, struct s_s2 *a)
{
if (key == 0)
{
if (a->exactarray[a->y_p][a->x_p - 1] != '1')
{
a->collects = check_collectible_left(a, a->collects);
deal_key3(a, a->collects);
ft_printer(a->ft_movements);
}
}
return (0);
}
void ft_printer(int i)
{
write(1, "\n", 1);
ft_putnbr(i);
}
void ft_printer2(char **s, int size)
{
write(2, "\nError BAD MAP\n", 15);
ft_free(s, size);
exit(1);
}