FPLBase
An open source project by
FPL.
|
Represents the state of a connected gamepad. More...
#include <input.h>
Represents the state of a connected gamepad.
Gamepads are an android-specific abstraction for controllers that are specifically gamepad-like. (They have a d-pad and one or more buttons.) This is only present if ANDROID_GAMEPAD is defined.
Public Types | |
enum | GamepadInputButton : int { kInvalid = -1, kUp = 0, kDown, kLeft, kRight, kButtonA, kButtonB, kButtonC, kButtonX, kButtonY, kButtonZ, kButtonL1, kButtonR1, kButtonL2, kButtonR2, kButtonThumbL, kButtonThumbR, kButtonBack, kButtonStart, kButtonSelect, kButtonMode, kControlCount } |
Enum describing all possible button inputs on a gamepad. | |
Public Member Functions | |
Gamepad () | |
Default constructor for a Gamepad. | |
void | AdvanceFrame () |
Advances the internal state by one frame. More... | |
Button & | GetButton (GamepadInputButton i) |
Get the Button from a given enum of all possible input buttons. More... | |
const Button & | GetButton (GamepadInputButton i) const |
Get the Button from a given enum of all possible input buttons. More... | |
AndroidInputDeviceId | controller_id () |
Returns the Android controller_id of the gamepad. More... | |
void | set_controller_id (AndroidInputDeviceId controller_id) |
Set the controller ID. More... | |
Static Public Member Functions | |
static int | GetGamepadCodeFromJavaKeyCode (int java_keycode) |
Internal function for translating android input. | |
void fplbase::Gamepad::AdvanceFrame | ( | ) |
Advances the internal state by one frame.
This function ensures that the gamepad readings are up-to-date, and that buttons have their change-bits set correctly. Normally called automatically by InputSystem::AdvanceFrame().
|
inline |
Returns the Android controller_id of the gamepad.
The controller_id is the android-specific identifier for a given gamepad.
Button& fplbase::Gamepad::GetButton | ( | GamepadInputButton | i | ) |
Get the Button from a given enum of all possible input buttons.
[in] | i | A GamepadInputButton enum describing all of the possible button inputs on a gamepad. |
|
inline |
Get the Button from a given enum of all possible input buttons.
[in] | i | A GamepadInputButton enum describing all of the possible button inputs on a gamepad. |
|
inline |
Set the controller ID.
[in] | controller_id | An AndroidInputDeviceId to set as the controller ID. |