Dreambox C/C++ SDK v1.0.0
C/C++ SDK for creating Dreambox games
Loading...
Searching...
No Matches
db_gamepad.h File Reference
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  gamepad_State
 Represents current input state of a gamepad. More...
 

Macros

#define GAMEPAD_BTN_A   (1 << 0)
 
#define GAMEPAD_BTN_B   (1 << 1)
 
#define GAMEPAD_BTN_X   (1 << 2)
 
#define GAMEPAD_BTN_Y   (1 << 3)
 
#define GAMEPAD_BTN_DPAD_UP   (1 << 4)
 
#define GAMEPAD_BTN_DPAD_DOWN   (1 << 5)
 
#define GAMEPAD_BTN_DPAD_LEFT   (1 << 6)
 
#define GAMEPAD_BTN_DPAD_RIGHT   (1 << 7)
 
#define GAMEPAD_BTN_L1   (1 << 8)
 
#define GAMEPAD_BTN_L2   (1 << 9)
 
#define GAMEPAD_BTN_L3   (1 << 10)
 
#define GAMEPAD_BTN_R1   (1 << 11)
 
#define GAMEPAD_BTN_R2   (1 << 12)
 
#define GAMEPAD_BTN_R3   (1 << 13)
 
#define GAMEPAD_BTN_START   (1 << 14)
 
#define GAMEPAD_BTN_SELECT   (1 << 15)
 

Functions

uint8_t gamepad_isConnected (uint32_t port)
 Check if a gamepad is connected to the given port. More...
 
void gamepad_readState (uint32_t port, gamepad_State *state)
 Read the state of the gamepad connected to the given port. More...
 
void gamepad_setRumble (uint32_t port, uint8_t enable)
 Set rumble enabled or disabled on the gamepad connected to the given port. More...
 

Macro Definition Documentation

◆ GAMEPAD_BTN_A

#define GAMEPAD_BTN_A   (1 << 0)

Definition at line 10 of file db_gamepad.h.

◆ GAMEPAD_BTN_B

#define GAMEPAD_BTN_B   (1 << 1)

Definition at line 11 of file db_gamepad.h.

◆ GAMEPAD_BTN_DPAD_DOWN

#define GAMEPAD_BTN_DPAD_DOWN   (1 << 5)

Definition at line 15 of file db_gamepad.h.

◆ GAMEPAD_BTN_DPAD_LEFT

#define GAMEPAD_BTN_DPAD_LEFT   (1 << 6)

Definition at line 16 of file db_gamepad.h.

◆ GAMEPAD_BTN_DPAD_RIGHT

#define GAMEPAD_BTN_DPAD_RIGHT   (1 << 7)

Definition at line 17 of file db_gamepad.h.

◆ GAMEPAD_BTN_DPAD_UP

#define GAMEPAD_BTN_DPAD_UP   (1 << 4)

Definition at line 14 of file db_gamepad.h.

◆ GAMEPAD_BTN_L1

#define GAMEPAD_BTN_L1   (1 << 8)

Definition at line 18 of file db_gamepad.h.

◆ GAMEPAD_BTN_L2

#define GAMEPAD_BTN_L2   (1 << 9)

Definition at line 19 of file db_gamepad.h.

◆ GAMEPAD_BTN_L3

#define GAMEPAD_BTN_L3   (1 << 10)

Definition at line 20 of file db_gamepad.h.

◆ GAMEPAD_BTN_R1

#define GAMEPAD_BTN_R1   (1 << 11)

Definition at line 21 of file db_gamepad.h.

◆ GAMEPAD_BTN_R2

#define GAMEPAD_BTN_R2   (1 << 12)

Definition at line 22 of file db_gamepad.h.

◆ GAMEPAD_BTN_R3

#define GAMEPAD_BTN_R3   (1 << 13)

Definition at line 23 of file db_gamepad.h.

◆ GAMEPAD_BTN_SELECT

#define GAMEPAD_BTN_SELECT   (1 << 15)

Definition at line 25 of file db_gamepad.h.

◆ GAMEPAD_BTN_START

#define GAMEPAD_BTN_START   (1 << 14)

Definition at line 24 of file db_gamepad.h.

◆ GAMEPAD_BTN_X

#define GAMEPAD_BTN_X   (1 << 2)

Definition at line 12 of file db_gamepad.h.

◆ GAMEPAD_BTN_Y

#define GAMEPAD_BTN_Y   (1 << 3)

Definition at line 13 of file db_gamepad.h.

Function Documentation

◆ gamepad_isConnected()

uint8_t gamepad_isConnected ( uint32_t  port)

Check if a gamepad is connected to the given port.

Parameters
portThe port to check (0 to 3)
Returns
1 if the gamepad is connected, false otherwise

◆ gamepad_readState()

void gamepad_readState ( uint32_t  port,
gamepad_State state 
)

Read the state of the gamepad connected to the given port.

Parameters
portThe port to check (0 to 3)
statePointer to the struct to fill with the current gamepad state

◆ gamepad_setRumble()

void gamepad_setRumble ( uint32_t  port,
uint8_t  enable 
)

Set rumble enabled or disabled on the gamepad connected to the given port.

Parameters
portTHe port to check (0 to 3)
enableWhether to enable rumble