Classes | |
struct | JoypadData_t |
Data record for each joypad. More... | |
struct | JoypadRange_t |
Range for each axis to convert analog data to digital data. More... | |
Public Types | |
enum | { AXIS1MIN = 0x1 , AXIS1MAX = 0x2 , AXIS2MIN = 0x4 , AXIS2MAX = 0x8 , AXIS3MIN = 0x10 , AXIS3MAX = 0x20 , AXIS4MIN = 0x40 , AXIS4MAX = 0x80 , POVLEFT = 0x100 , POVRIGHT = 0x200 , POVUP = 0x400 , POVDOWN = 0x800 , BUTTON1 = 0x1000 , BUTTON2 = 0x2000 , BUTTON3 = 0x4000 , BUTTON4 = 0x8000 , BUTTON5 = 0x10000 , BUTTON6 = 0x20000 , BUTTON7 = 0x40000 , BUTTON8 = 0x80000 , BUTTON9 = 0x100000 , BUTTON10 = 0x200000 , BUTTON11 = 0x400000 , BUTTON12 = 0x800000 , BUTTON13 = 0x1000000 , BUTTON14 = 0x2000000 , BUTTON15 = 0x4000000 , BUTTON16 = 0x8000000 , BUTTON17 = 0x10000000 , BUTTON18 = 0x20000000 , BUTTON19 = 0x40000000 , BUTTON20 = 0x80000000 } |
enum | { MAXAXIS = 6 , MAXJOYSTICKS = 8 , MAXBUTTONS = 20 , MAXPOV = 1 , CENTERAXISVALUE = 32768 , MAXAXISVALUE = 65535 , POVANALOGFORWARD = 0 , POVANALOGRIGHT = 9000 , POVANALOGBACKWARD = 18000 , POVANALOGLEFT = 27000 , MAXPOVVALUE = 36000 , INVALIDPOVVALUE = 0xFFFFFFFF , POV_SLOP = 1500 } |
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
Joypad (GameApp *pAppInstance) noexcept | |
Init joystick services. | |
virtual | ~Joypad () |
Shut down joystick services. | |
uint32_t | ReadButtons (uint_t uWhich) const noexcept |
Return the game controller button states. | |
uint_t | ReadAbsolute (uint_t uWhich, uint_t uAxis) const noexcept |
Read an analog joystick axis. | |
int | ReadDelta (uint_t uWhich, uint_t uAxis) const noexcept |
Read an analog joystick axis as delta. | |
uint_t | GetAxisCount (uint_t uWhich) const noexcept |
Return the number of analog axises a gamepad possesses. | |
void | SetDigital (uint_t uWhich, uint_t uAxis, uint_t uPercent=20) noexcept |
Set the boundaries for the joystick. | |
uint_t | GetDeviceCount (void) const noexcept |
void | AcquireDirectInput (void) noexcept |
Acquire DirectInput joystick devices. | |
void | UnacquireDirectInput (void) noexcept |
Unacquire DirectInput joystick devices. | |
Public Member Functions inherited from Burger::Base | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Member Functions | |
static RunQueue::eReturnCode | Poll (void *pData) noexcept |
Static Public Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
Static Public Attributes inherited from Burger::Base | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Private Member Functions | |
Joypad (const Joypad &)=delete | |
Joypad & | operator= (const Joypad &)=delete |
Joypad (Joypad &&)=delete | |
Joypad & | operator= (Joypad &&)=delete |
Private Attributes | |
GameApp * | m_pAppInstance |
Application instances. | |
XInputGamePad_t | m_XInputGamepads [4] |
Structures for each XInput device. | |
uint_t | m_bDirectInputFound |
DirectInput devices found. | |
uint_t | m_bXInputFound |
XInput devices found. | |
uint_t | m_uDirectInputDevices |
Number of devices found from DirectInput, not managed by XInput. | |
JoypadData_t | m_Data [MAXJOYSTICKS] |
Current input data from game devices. | |
uint_t | m_uDeviceCount |
Number of game controller drivers found. | |
anonymous enum |
anonymous enum |
|
privatedelete |
|
privatedelete |
|
noexcept |
Init joystick services.
Init the joystick services and detect if a joystick(s) is connected. No joystick manager call will operate properly unless this call is issued. You can call ~Joypad() to shut down the operation at any time.
If you call this function again, the joysticks will be rescanned and your configuration may change. This is due to the fact that users could plug in a joystick at any time.
|
virtual |
Shut down joystick services.
Stop joystick scanning and release all resources attached to reading the joystick. Useful for manual shutdown and restart of joystick services on Win95 and MacOS
|
noexcept |
Acquire DirectInput joystick devices.
When the application gains focus, call this function to acquire the joysticks
Burgerlib does this call automatically.
|
overridevirtualnoexcept |
Get the description to the class.
This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.
Reimplemented from Burger::Base.
|
noexcept |
Return the number of analog axises a gamepad possesses.
Return the number of input axis that return analog data. Zero if none are found or there is no device present
uWhich | Which joystick device to affect |
|
inlinenoexcept |
|
staticnoexcept |
|
noexcept |
Read an analog joystick axis.
Get information from the device and axis of a joystick and return the value of the axis at this moment in time. The value returned is 0 to 65535 with 0 being left/up and 65535 being right/down.
Since reading a joystick may be slow, the function Poll() will actually perform the read and keep all the data in a cache so that the subsequent calls will have very little overhead. If you must be certain that data is freshly read, call Poll() before this call to make sure the data is fresh.
uAxis | Analog axis for the joystick |
uWhich | Which joystick device to read |
|
noexcept |
Return the game controller button states.
Return the current state of all the input buttons
|
noexcept |
Read an analog joystick axis as delta.
Get information from the device and axis of a joystick and return the value of the axis at this moment in time. The value returned is -32768 to 32767 with -32768 being left/up and 32767 being right/down.
Since reading a joystick may be slow, the function Poll(uint_t) will actually perform the read and keep all the data in a cache so that the subsequent calls will have very little overhead. If you must be certain that data is freshly read, call Poll(uint_t) before this call to make sure the data is fresh.
uAxis | Analog axis for the joystick |
uWhich | Which joystick device to read |
|
noexcept |
Set the boundaries for the joystick.
To simulate a digital joypad with a analog joystick, you need to define a bounds rect that has the dead area for digital motion. Burgerlib has an acceptable default but you can override it with this call.
uWhich | Which joystick device to affect |
uAxis | Which analog axis to affect |
uPercent | Percentage from center point for dead zone (20% is normal) |
|
noexcept |
Unacquire DirectInput joystick devices.
When the application loses focus, call this function to release the joysticks
Burgerlib does this call automatically.
|
static |
|
private |
DirectInput devices found.
|
private |
XInput devices found.
|
private |
Current input data from game devices.
|
private |
Application instances.
|
private |
Number of game controller drivers found.
|
private |
Number of devices found from DirectInput, not managed by XInput.
|
private |
Structures for each XInput device.