NvGamepadAndroid Class Reference

Class representing the Android implementation of gamepads. More...

#include <NvGamepadAndroid.h>

Inheritance diagram for NvGamepadAndroid:

NvGamepad

List of all members.

Public Member Functions

virtual bool pollGamepads (AInputEvent *event, uint32_t &changedMask)
 Passes Android input events to the gamepad system for processing.
virtual bool getState (int32_t padID, State &state)
 Get the state of a gamepad.
virtual void setMaxGamepadCount (int32_t max)
 Sets the maximum number of simultaneous gamepads.
virtual int32_t getMaxGamepadCount ()
 Gets the maximum number of simultaneous gamepads.

Static Protected Member Functions

static void ProcessDPAD (AInputEvent *event, State &state)

Protected Attributes

uint32_t mCurrentTimestamp
uint32_t * mLastReturnedTimestamps
StatemStates


Detailed Description

Class representing the Android implementation of gamepads.

Class implementing gamepad support for the Android platform. This is mainly a "producer" class, used by an app framework or main loop implementation to provide Android-specific events, so that an application can access it as the NvGamepad base class and read the gamepads. As a result, the only new function exposed by this subclass is pollGamepads, which passes Android input events to the implementation for updating the gamepad state.


Member Function Documentation

virtual int32_t NvGamepadAndroid::getMaxGamepadCount (  )  [virtual]

Gets the maximum number of simultaneous gamepads.

Returns:
the current maximum number of gamepads. Default is MAX_GAMEPADS

Implements NvGamepad.

virtual bool NvGamepadAndroid::getState ( int32_t  padID,
State state 
) [virtual]

Get the state of a gamepad.

Queries the state of the desired gamepad, copying it into an application-supplied status structure

Parameters:
[in] padID the index of the pad to read [0, MAX_GAMEPADS)
[out] state the current state of the queried gamepad
Returns:
True on success, false if no pad connected at padID
See also:
State

Implements NvGamepad.

virtual bool NvGamepadAndroid::pollGamepads ( AInputEvent *  event,
uint32_t &  changedMask 
) [virtual]

Passes Android input events to the gamepad system for processing.

Used by the app framework or main loop to pass all Android input events to the gamepad system for processing. Updates the internal representation of the state of all attached gamepads

Parameters:
[in] event the Android input event to be processed by the gamepad system. The caller need not and should not pre-process these events; all filtering will be done by the function and irrelevant events ignored
[in,out] changedMask a mask of the changed gamepads. Bits 0-(MAX_GAMEPADS-1) will be 1 if the gamepad of that index (1<<index) has changed. Note that an existing nonzero mask may be sent - this function will either leave the mask unchanged or will add set bits for any newly-changed pads
Returns:
true if gamepad support "ate" the event, and should not be processed any further by the app's framework

virtual void NvGamepadAndroid::setMaxGamepadCount ( int32_t  max  )  [virtual]

Sets the maximum number of simultaneous gamepads.

Sets the maximum number of gamepads that the system should track For apps that will not support more than a fixed count of controllers, this could lower the expense of the library. This is purely a hint

Parameters:
[in] sets the maximum number of expected gamepads [1, MAX_GAMEPADS]

Implements NvGamepad.


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