Dreambox C/C++ SDK v1.0.0
C/C++ SDK for creating Dreambox games
Loading...
Searching...
No Matches
db_gamepad.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4
5#ifdef __cplusplus
6extern "C"
7{
8#endif
9
10#define GAMEPAD_BTN_A (1 << 0)
11#define GAMEPAD_BTN_B (1 << 1)
12#define GAMEPAD_BTN_X (1 << 2)
13#define GAMEPAD_BTN_Y (1 << 3)
14#define GAMEPAD_BTN_DPAD_UP (1 << 4)
15#define GAMEPAD_BTN_DPAD_DOWN (1 << 5)
16#define GAMEPAD_BTN_DPAD_LEFT (1 << 6)
17#define GAMEPAD_BTN_DPAD_RIGHT (1 << 7)
18#define GAMEPAD_BTN_L1 (1 << 8)
19#define GAMEPAD_BTN_L2 (1 << 9)
20#define GAMEPAD_BTN_L3 (1 << 10)
21#define GAMEPAD_BTN_R1 (1 << 11)
22#define GAMEPAD_BTN_R2 (1 << 12)
23#define GAMEPAD_BTN_R3 (1 << 13)
24#define GAMEPAD_BTN_START (1 << 14)
25#define GAMEPAD_BTN_SELECT (1 << 15)
26
28typedef struct
29{
31 uint16_t btnMask;
32
34 int16_t lStickX;
35
37 int16_t lStickY;
38
40 int16_t rStickX;
41
43 int16_t rStickY;
45
49extern uint8_t gamepad_isConnected(uint32_t port);
50
54extern void gamepad_readState(uint32_t port, gamepad_State *state);
55
59extern void gamepad_setRumble(uint32_t port, uint8_t enable);
60
61#ifdef __cplusplus
62}
63#endif
void gamepad_readState(uint32_t port, gamepad_State *state)
Read the state of the gamepad connected to the given port.
uint8_t gamepad_isConnected(uint32_t port)
Check if a gamepad is connected to the given port.
void gamepad_setRumble(uint32_t port, uint8_t enable)
Set rumble enabled or disabled on the gamepad connected to the given port.
Represents current input state of a gamepad.
Definition: db_gamepad.h:29
int16_t lStickX
The X position of the left stick, as a value between -32767 and +32767.
Definition: db_gamepad.h:34
int16_t lStickY
The Y position of the left stick, as a value between -32767 and +32767.
Definition: db_gamepad.h:37
int16_t rStickY
The Y position of the right stick, as a value between -32767 and +32767.
Definition: db_gamepad.h:43
uint16_t btnMask
Bitmask of currently pressed buttons. Refer to GAMEPAD_BTN_* mask defines to check these bits.
Definition: db_gamepad.h:31
int16_t rStickX
The X position of the right stick, as a value between -32767 and +32767.
Definition: db_gamepad.h:40