-
Notifications
You must be signed in to change notification settings - Fork 1
/
JOY.CPP
54 lines (51 loc) · 1015 Bytes
/
JOY.CPP
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
#include "joy.h"
void Joy::status(void) {
jstat();
Joy::a.x=xa;
Joy::a.y=ya;
Joy::b.x=xb;
Joy::b.y=yb;
Joy::a.a=a_1?0:1;
Joy::a.b=a_2?0:1;
Joy::b.b=b_1?0:1;
Joy::b.b=b_2?0:1;
//®¡à ¡®â稪 ¤¦®©á⨪
a.left=a.x<a.fleft;
a.right=a.x>a.fright;
a.up=a.y<a.fup;
a.down=a.y>a.fdown;
};
void Joy::init(void) { // áâனª ¤¦®©á⨪
//àãçª ¢ æ¥âà¥
do {
jstat();
} while ( a_1 && a_2 );
Joy::a.x=xa;
Joy::a.y=ya;
do {
jstat();
} while ( a_1==0 || a_2==0 );
//àãçª ¢ «¥¢®¬ ¢¥å¥¬ 㣫ã
do {
jstat();
} while ( a_1 && a_2 );
Joy::a.mleft=xa;
Joy::a.mup=ya;
do {
jstat();
} while ( a_1==0 || a_2==0 );
//àãçª ¢ ¯à ¢®¬ ¨¦¥¬ 㣫ã
do {
jstat();
} while ( a_1 && a_2 );
Joy::a.mright=xa;
Joy::a.mdown=ya;
do {
jstat();
} while ( a_1==0 || a_2==0 );
Joy::a.fleft=(a.mleft+(a.x-a.mleft)/2);
Joy::a.fright=(a.mright-(a.mright-a.x)/2);
Joy::a.fup=(a.mup+(a.y-a.mup)/2);
Joy::a.fdown=(a.mdown-(a.mdown-a.y)/2);
};