blob: ee103f00c44213a40358071361def52ff7f5be3d (
plain)
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
|
#include <stdint.h>
#include "keyb.h"
#include "joy.h"
#include "control.h"
static uint8_t joy = 0;
void control_init()
{
joy = joy_detect();
}
uint8_t control_read()
{
uint8_t r = CTL_NONE;
if (keys[KEY_UP])
r |= CTL_UP;
if (keys[KEY_DOWN])
r |= CTL_DOWN;
if (keys[KEY_LEFT])
r |= CTL_LEFT;
if (keys[KEY_RIGHT])
r |= CTL_RIGHT;
if (keys[KEY_Z])
r |= CTL_FIRE1;
if (keys[KEY_X])
r |= CTL_FIRE2;
if (joy)
r |= joy_read();
return r;
}
|