Mercurial > hg > index.fcgi > lj > lj046-2players
comparison src/dsjoy.c @ 1:38c62fded078
initial builds (linux and lj.nds)
author | paulo@localhost |
---|---|
date | Fri, 13 Mar 2009 01:10:13 -0700 |
parents | |
children | 80a2761bd3a4 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c355179f3b6 |
---|---|
1 #include "ljcontrol.h" | |
2 #ifdef ARM9 | |
3 #include <nds.h> | |
4 #else | |
5 #include <gba.h> | |
6 #endif | |
7 | |
8 LJBits readHWKeys(void); | |
9 | |
10 LJBits readPad(unsigned int player) { | |
11 LJBits hwKeys = readHWKeys(); | |
12 LJBits out = 0; | |
13 | |
14 if (hwKeys & KEY_UP) { | |
15 out |= VKEY_UP; | |
16 } | |
17 if (hwKeys & KEY_DOWN) { | |
18 out |= VKEY_DOWN; | |
19 } | |
20 if (hwKeys & KEY_LEFT) { | |
21 out |= VKEY_LEFT; | |
22 } | |
23 if (hwKeys & KEY_RIGHT) { | |
24 out |= VKEY_RIGHT; | |
25 } | |
26 if (hwKeys & KEY_B) { | |
27 out |= VKEY_ROTL; | |
28 } | |
29 if (hwKeys & KEY_A) { | |
30 out |= VKEY_ROTR; | |
31 } | |
32 if (hwKeys & (KEY_L | KEY_R)) { | |
33 out |= VKEY_HOLD; | |
34 } | |
35 | |
36 #ifdef ARM9 | |
37 if (hwKeys & KEY_X) { | |
38 out |= VKEY_MACRO(3); | |
39 } | |
40 if (hwKeys & KEY_Y) { | |
41 out |= VKEY_MACRO(2); | |
42 } | |
43 #endif | |
44 | |
45 // on the GBA and DS, we need to add the console buttons in | |
46 out |= hwKeys << 16; | |
47 return out; | |
48 } |