FPLBase
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
fplbase::Gamepad Class Reference

Represents the state of a connected gamepad. More...

#include <input.h>

Detailed Description

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...
 
ButtonGetButton (GamepadInputButton i)
 Get the Button from a given enum of all possible input buttons. More...
 
const ButtonGetButton (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.
 

Member Function Documentation

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().

AndroidInputDeviceId fplbase::Gamepad::controller_id ( )
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.

Parameters
[in]iA GamepadInputButton enum describing all of the possible button inputs on a gamepad.
const Button& fplbase::Gamepad::GetButton ( GamepadInputButton  i) const
inline

Get the Button from a given enum of all possible input buttons.

Parameters
[in]iA GamepadInputButton enum describing all of the possible button inputs on a gamepad.
void fplbase::Gamepad::set_controller_id ( AndroidInputDeviceId  controller_id)
inline

Set the controller ID.

Parameters
[in]controller_idAn AndroidInputDeviceId to set as the controller ID.

The documentation for this class was generated from the following file: