Get Joypad button state.
More...
|
#define | VK_UP (1 << 0) |
| Bitmask for UP direction of joystick or UP arrow key.
|
|
#define | VK_DOWN (1 << 1) |
| Bitmask for DOWN direction of joystick or DOWN arrow key.
|
|
#define | VK_LEFT (1 << 2) |
| Bitmask for LEFT direction of joystick or LEFT arrow key.
|
|
#define | VK_RIGHT (1 << 3) |
| Bitmask for RIGHT direction of joystick or RIGHT arrow key.
|
|
#define | VK_FIRE_0 (1 << 4) |
| Bitmask for trigger button #1 or SPACE key.
|
|
#define | VK_FIRE_1 (1 << 5) |
| Bitmask for trigger button #2.
|
|
|
uint8_t | joypad_get_state (uint8_t controller) |
| MSX Get the status of the joystick buttons and levers.
|
|
Get Joypad button state.
◆ VK_UP
◆ VK_DOWN
◆ VK_LEFT
◆ VK_RIGHT
#define VK_RIGHT (1 << 3) |
◆ VK_FIRE_0
#define VK_FIRE_0 (1 << 4) |
◆ VK_FIRE_1
#define VK_FIRE_1 (1 << 5) |
◆ joypad_get_state()
uint8_t joypad_get_state |
( |
uint8_t | controller | ) |
|
MSX
Get the status of the joystick buttons and levers.
Get the status of the two trigger buttons and eight-way lever of the specified joystick (or SPACE key and arrow keys of the keyboard).
- Parameters
-
controller | joystick number
0 : keyboard (the arrow keys and the SPACE key)
1 : joystick #1
2 : joystick #2
|
- Returns
- status of buttons.
the following bits will be 1
if corresponding buttons / keys were pressed or will be 0
if released.
bit #0
: VK_UP
bit #1
: VK_DOWN
bit #2
: VK_LEFT
bit #3
: VK_RIGHT
bit #4
: VK_FIRE_0
bit #5
: VK_FIRE_1
- Note
- Each bit of the return value is independent and dedicated to the corresponding button/key. Therefore, a single call to joypad_get_state() can be used to get the state of all buttons on the specified joystick.
-
For example, if you push the joystick lever to the upper right and press trigger #1, bit #0, bit #3, and bit #4 of the return value will be set to 1 (i.e., the value
VK_UP | VK_RIGHT | VK_FIRE_0
will be returned).
- See also
- msx_GTSTCK()
-
msx_GTTRIG()