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
67
68
69
70
71
72
|
#include <main.h>
void setEvent(Controller *c){
c->left.stick.x = joystickGetAnalog(c->num, 4);
c->left.stick.y = joystickGetAnalog(c->num, 3);
c->right.stick.x = joystickGetAnalog(c->num, 1);
c->right.stick.y = joystickGetAnalog(c->num, 2);
/**
* BACK RIGHT BUTTONS
*/
if(c->right.back.d == KEY_UP)c->right.back.d = UP;
else if(c->right.back.d == DOWN && !joystickGetDigital(c->num, 6, JOY_DOWN))c->right.back.d = KEY_UP;
else c->right.back.d = joystickGetDigital(c->num, 6, JOY_DOWN);
if(c->right.back.u == KEY_UP)c->right.back.u = UP;
else if(c->right.back.u == DOWN && !joystickGetDigital(c->num, 6, JOY_UP))c->right.back.u = KEY_UP;
else c->right.back.u = joystickGetDigital(c->num, 6, JOY_UP);
/*
* BACK LEFT BUTTONS
*/
if(c->left.back.d == KEY_UP)c->left.back.d = UP;
else if(c->left.back.d == DOWN && !joystickGetDigital(c->num, 5, JOY_DOWN))c->left.back.d = KEY_UP;
else c->left.back.d = joystickGetDigital(c->num, 5, JOY_DOWN);
if(c->left.back.u == KEY_UP)c->left.back.u = UP;
else if(c->left.back.u == DOWN && !joystickGetDigital(c->num, 5, JOY_UP))c->left.back.u = KEY_UP;
else c->left.back.u = joystickGetDigital(c->num, 5, JOY_UP);
/*
* LEFT FRONT BUTTONS
*/
if(c->left.front.l == KEY_UP)c->left.front.l = UP;
else if(c->left.front.l == DOWN && !joystickGetDigital(c->num, 7, JOY_LEFT))c->left.front.l = KEY_UP;
else c->left.front.l = joystickGetDigital(c->num, 7, JOY_LEFT);
if(c->left.front.r == KEY_UP)c->left.front.r = UP;
else if(c->left.front.r == DOWN && !joystickGetDigital(c->num, 7, JOY_RIGHT))c->left.front.r = KEY_UP;
else c->left.front.r = joystickGetDigital(c->num, 7, JOY_RIGHT);
if(c->left.front.u == KEY_UP)c->left.front.u = UP;
else if(c->left.front.u == DOWN && !joystickGetDigital(c->num, 7, JOY_UP))c->left.front.u = KEY_UP;
else c->left.front.u = joystickGetDigital(c->num, 7, JOY_UP);
if(c->left.front.d == KEY_UP)c->left.front.d = UP;
else if(c->left.front.d == DOWN && !joystickGetDigital(c->num, 7, JOY_DOWN))c->left.front.d = KEY_UP;
else c->left.front.d = joystickGetDigital(c->num, 7, JOY_DOWN);
/*
* RIGHT FRONT BUTTONS
*/
if(c->right.front.d == KEY_UP)c->right.front.d = UP;
else if(c->right.front.d == DOWN && !joystickGetDigital(c->num, 8, JOY_DOWN))c->right.front.d = KEY_UP;
else c->right.front.d = joystickGetDigital(c->num, 8, JOY_DOWN);
if(c->right.front.l == KEY_UP)c->right.front.l = UP;
else if(c->right.front.l == DOWN && !joystickGetDigital(c->num, 8, JOY_LEFT))c->right.front.l = KEY_UP;
else c->right.front.l = joystickGetDigital(c->num, 8, JOY_LEFT);
if(c->right.front.u == KEY_UP)c->right.front.u = UP;
else if(c->right.front.u == DOWN && !joystickGetDigital(c->num, 8, JOY_UP))c->right.front.u = KEY_UP;
else c->right.front.u = joystickGetDigital(c->num, 8, JOY_UP);
if(c->right.front.r == KEY_UP)c->right.front.r = UP;
else if(c->right.front.r == DOWN && !joystickGetDigital(c->num, 8, JOY_RIGHT))c->right.front.r = KEY_UP;
else c->right.front.r = joystickGetDigital(c->num, 8, JOY_RIGHT);
}
|