Nebula
|
#include <gamepadbase.h>
An input handler which represents one of at most 4 game pads.
Inherits Input::InputHandler.
Classes | |
struct | ButtonState |
Public Types | |
enum | Button { DPadUpButton = 0 , DPadDownButton , DPadLeftButton , DPadRightButton , StartButton , BackButton , LeftThumbButton , RightThumbButton , LeftShoulderButton , RightShoulderButton , AButton , BButton , XButton , YButton , HomeButton , PlusButton , MinusButton , OneButton , TwoButton , ZButton , CButton , SelectButton , NumButtons , InvalidButton , CrossButton = AButton , CircleButton = BButton , SquareButton = XButton , TriangleButton = YButton , L1Button = LeftShoulderButton , R1Button = RightShoulderButton , L3Button = LeftThumbButton , R3Button = RightThumbButton } |
gamepad buttons More... | |
enum | Axis { LeftTriggerAxis = 0 , RightTriggerAxis , LeftThumbXAxis , LeftThumbYAxis , RightThumbXAxis , RightThumbYAxis , NumAxes , InvalidAxis } |
gamepad axis More... | |
Public Member Functions | |
GamePadBase () | |
constructor | |
virtual | ~GamePadBase () |
destructor | |
bool | IsConnected () const |
return true if this game pad is currently connected | |
void | SetIndex (IndexT i) |
set index -> TODO make threadsafe | |
IndexT | GetIndex () const |
get the index of this game pad | |
bool | ButtonPressed (Button btn) const |
return true if a button is currently pressed | |
bool | ButtonDown (Button btn) const |
return true if button was down at least once in current frame | |
bool | ButtonUp (Button btn) const |
return true if button was up at least once in current frame | |
float | GetAxisValue (Axis axis) const |
get current axis value | |
bool | HasTransform () const |
check if device has 3d location sensor | |
const Math::mat4 & | GetTransform () const |
get current position (if supported by device, identity otherwise) | |
void | SetLowFrequencyVibrator (float f) |
set low-frequency vibration effect (0.0f .. 1.0f) | |
float | GetLowFrequencyVibrator () const |
get low-frequency vibration | |
void | SetHighFrequencyVibrator (float f) |
set high-frequency vibration effect (0.0f .. 1.0f) | |
float | GetHighFrequencyVibrator () const |
get high-frequency vibration | |
Util::Array< Input::InputEvent > | GetStateAsInputEvents () const |
get current state as an array of input events (override in subclass!) | |
Public Member Functions inherited from Input::InputHandler | |
InputHandler () | |
constructor | |
virtual | ~InputHandler () |
destructor | |
bool | IsAttached () const |
return true if the input handler is currently attached | |
virtual void | BeginCapture () |
capture input to this event handler | |
virtual void | EndCapture () |
end input capturing to this event handler | |
bool | IsCapturing () const |
return true if this input handler captures input | |
Public Member Functions inherited from Core::RefCounted | |
RefCounted () | |
constructor | |
int | GetRefCount () const |
get the current refcount | |
void | AddRef () |
increment refcount by one | |
void | Release () |
decrement refcount and destroy object if refcount is zero | |
bool | IsInstanceOf (const Rtti &rtti) const |
return true if this object is instance of given class | |
bool | IsInstanceOf (const Util::String &className) const |
return true if this object is instance of given class by string | |
bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
return true if this object is instance of given class by fourcc | |
bool | IsA (const Rtti &rtti) const |
return true if this object is instance of given class, or a derived class | |
bool | IsA (const Util::String &rttiName) const |
return true if this object is instance of given class, or a derived class, by string | |
bool | IsA (const Util::FourCC &rttiFourCC) const |
return true if this object is instance of given class, or a derived class, by fourcc | |
const Util::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Static Public Member Functions | |
static Util::String | ButtonAsString (Button btn) |
convert button code to string | |
static Util::String | AxisAsString (Axis a) |
convert axis to string | |
static SizeT | GetMaxNumControllers () |
get maximum number of controllers | |
Static Public Member Functions inherited from Core::RefCounted | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Protected Member Functions | |
virtual void | OnAttach () |
called when the handler is attached to the input server | |
virtual void | OnReset () |
reset the input handler | |
Protected Member Functions inherited from Input::InputHandler | |
virtual void | OnRemove () |
called when the handler is removed from the input server | |
virtual void | OnBeginFrame () |
called on InputServer::BeginFrame() | |
virtual void | OnEndFrame () |
called on InputServer::EndFrame(); | |
virtual void | OnObtainCapture () |
called when input handler obtains capture | |
virtual void | OnReleaseCapture () |
called when input handler looses capture | |
virtual bool | OnEvent (const InputEvent &inputEvent) |
called when an input event should be processed | |
Protected Member Functions inherited from Core::RefCounted | |
virtual | ~RefCounted () |
destructor (called when refcount reaches zero) | |
Protected Attributes | |
IndexT | index |
bool | isConnected |
Util::FixedArray< ButtonState > | buttonStates |
Util::FixedArray< float > | axisValues |
bool | vibratorsDirty |
bool | hasTransform |
float | lowFreqVibrator |
float | highFreqVibrator |
Threading::CriticalSection | critSect |
Threading::ThreadId | creatorThreadId |
Math::mat4 | transform |
Protected Attributes inherited from Input::InputHandler | |
bool | isAttached |
bool | isCapturing |
Private Member Functions | |
__DeclareClass (GamePadBase) | |
gamepad buttons
Base::GamePadBase::GamePadBase | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
inline |
return true if button was down at least once in current frame
|
inline |
return true if a button is currently pressed
|
inline |
return true if button was up at least once in current frame
|
inline |
get current axis value
|
inline |
get high-frequency vibration
|
inline |
get the index of this game pad
|
inline |
get low-frequency vibration
|
inlinestatic |
get maximum number of controllers
Array< InputEvent > Base::GamePadBase::GetStateAsInputEvents | ( | ) | const |
get current state as an array of input events (override in subclass!)
This method should return the current state of the game pad as input events.
It is up to a specific subclass to implement this method.
|
inline |
get current position (if supported by device, identity otherwise)
|
inline |
check if device has 3d location sensor
|
inline |
return true if this game pad is currently connected
|
protectedvirtual |
called when the handler is attached to the input server
Reimplemented from Input::InputHandler.
|
protectedvirtual |
reset the input handler
Reimplemented from Input::InputHandler.
|
inline |
set high-frequency vibration effect (0.0f .. 1.0f)
|
inline |
set index -> TODO make threadsafe
|
inline |
set low-frequency vibration effect (0.0f .. 1.0f)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |