167 n_assert2(
creatorThreadId == Threading::Thread::GetMyThreadId(),
"IsConnected can't be called from any thread but the creator thread!");
224 n_assert2(
creatorThreadId == Threading::Thread::GetMyThreadId(),
"ButtonPressed can't be called from any thread but the creator thread!");
234 n_assert2(
creatorThreadId == Threading::Thread::GetMyThreadId(),
"ButtonDown can't be called from any thread but the creator thread!");
244 n_assert2(
creatorThreadId == Threading::Thread::GetMyThreadId(),
"ButtonUp can't be called from any thread but the creator thread!");
254 n_assert2(
creatorThreadId == Threading::Thread::GetMyThreadId(),
"GetAxisValue can't be called from any thread but the creator thread!");
An input handler which represents one of at most 4 game pads.
Definition gamepadbase.h:23
bool ButtonDown(Button btn) const
return true if button was down at least once in current frame
Definition gamepadbase.h:232
bool HasTransform() const
check if device has 3d location sensor
Definition gamepadbase.h:175
Util::FixedArray< float > axisValues
Definition gamepadbase.h:151
__DeclareClass(GamePadBase)
Button
gamepad buttons
Definition gamepadbase.h:28
@ HomeButton
Definition gamepadbase.h:46
@ L3Button
Definition gamepadbase.h:68
@ DPadUpButton
Definition gamepadbase.h:29
@ L1Button
Definition gamepadbase.h:66
@ BButton
Definition gamepadbase.h:41
@ XButton
Definition gamepadbase.h:42
@ OneButton
Definition gamepadbase.h:49
@ MinusButton
Definition gamepadbase.h:48
@ ZButton
Definition gamepadbase.h:51
@ StartButton
Definition gamepadbase.h:33
@ RightShoulderButton
Definition gamepadbase.h:38
@ InvalidButton
Definition gamepadbase.h:58
@ SquareButton
Definition gamepadbase.h:64
@ NumButtons
Definition gamepadbase.h:57
@ DPadLeftButton
Definition gamepadbase.h:31
@ CircleButton
Definition gamepadbase.h:63
@ AButton
Definition gamepadbase.h:40
@ R3Button
Definition gamepadbase.h:69
@ LeftThumbButton
Definition gamepadbase.h:35
@ CrossButton
Definition gamepadbase.h:62
@ TriangleButton
Definition gamepadbase.h:65
@ TwoButton
Definition gamepadbase.h:50
@ CButton
Definition gamepadbase.h:52
@ DPadRightButton
Definition gamepadbase.h:32
@ DPadDownButton
Definition gamepadbase.h:30
@ YButton
Definition gamepadbase.h:43
@ LeftShoulderButton
Definition gamepadbase.h:37
@ BackButton
Definition gamepadbase.h:34
@ RightThumbButton
Definition gamepadbase.h:36
@ R1Button
Definition gamepadbase.h:67
@ PlusButton
Definition gamepadbase.h:47
@ SelectButton
Definition gamepadbase.h:55
Util::Array< Input::InputEvent > GetStateAsInputEvents() const
get current state as an array of input events (override in subclass!)
Definition gamepadbase.cc:146
Math::mat4 transform
Definition gamepadbase.h:158
float highFreqVibrator
Definition gamepadbase.h:155
void SetHighFrequencyVibrator(float f)
set high-frequency vibration effect (0.0f .. 1.0f)
Definition gamepadbase.h:286
bool IsConnected() const
return true if this game pad is currently connected
Definition gamepadbase.h:165
bool isConnected
Definition gamepadbase.h:149
float GetAxisValue(Axis axis) const
get current axis value
Definition gamepadbase.h:252
void SetIndex(IndexT i)
set index -> TODO make threadsafe
Definition gamepadbase.h:194
const Math::mat4 & GetTransform() const
get current position (if supported by device, identity otherwise)
Definition gamepadbase.h:185
virtual ~GamePadBase()
destructor
Definition gamepadbase.cc:36
float GetLowFrequencyVibrator() const
get low-frequency vibration
Definition gamepadbase.h:274
bool ButtonUp(Button btn) const
return true if button was up at least once in current frame
Definition gamepadbase.h:242
float lowFreqVibrator
Definition gamepadbase.h:154
static SizeT GetMaxNumControllers()
get maximum number of controllers
Definition gamepadbase.h:213
Util::FixedArray< ButtonState > buttonStates
Definition gamepadbase.h:150
IndexT GetIndex() const
get the index of this game pad
Definition gamepadbase.h:204
Axis
gamepad axis
Definition gamepadbase.h:74
@ NumAxes
Definition gamepadbase.h:83
@ RightThumbYAxis
Definition gamepadbase.h:81
@ LeftTriggerAxis
Definition gamepadbase.h:76
@ LeftThumbXAxis
Definition gamepadbase.h:78
@ InvalidAxis
Definition gamepadbase.h:84
@ LeftThumbYAxis
Definition gamepadbase.h:79
@ RightThumbXAxis
Definition gamepadbase.h:80
@ RightTriggerAxis
Definition gamepadbase.h:77
Threading::ThreadId creatorThreadId
Definition gamepadbase.h:157
bool hasTransform
Definition gamepadbase.h:153
static Util::String ButtonAsString(Button btn)
convert button code to string
Definition gamepadbase.cc:87
virtual void OnAttach()
called when the handler is attached to the input server
Definition gamepadbase.cc:45
bool vibratorsDirty
Definition gamepadbase.h:152
IndexT index
Definition gamepadbase.h:148
static Util::String AxisAsString(Axis a)
convert axis to string
Definition gamepadbase.cc:123
float GetHighFrequencyVibrator() const
get high-frequency vibration
Definition gamepadbase.h:298
GamePadBase()
constructor
Definition gamepadbase.cc:19
void SetLowFrequencyVibrator(float f)
set low-frequency vibration effect (0.0f .. 1.0f)
Definition gamepadbase.h:262
virtual void OnReset()
reset the input handler
Definition gamepadbase.cc:59
bool ButtonPressed(Button btn) const
return true if a button is currently pressed
Definition gamepadbase.h:222
Threading::CriticalSection critSect
Definition gamepadbase.h:156
Critical section objects are used to protect a portion of code from parallel execution.
Nebula's dynamic array class.
Definition array.h:60
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
#define n_assert2(exp, msg)
Definition debug.h:51
#define n_assert(exp)
Definition debug.h:50
#define MAX_GAMEPADS
Definition gamepadbase.h:17
Definition gamecontentserverbase.cc:10
__forceinline float clamp(float val, float minVal, float maxVal)
Float clamping.
Definition scalar.h:487
pthread_t ThreadId
Definition linuxthreadid.h:15
A 4x4 single point precision float matrix.
Definition mat4.h:49
Nebula's universal string class.
Definition string.h:50
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48