![]() |
Plasma Engine
2.0
|
An implementation of plInputDeviceController that handles XBox 360 controllers. More...
#include <InputDeviceXBox.h>
Public Member Functions | |
virtual bool | IsControllerConnected (plUInt8 uiPhysical) const override |
Queries whether the controller with the given physical index is connected to the computer. This may change at any time. | |
![]() | |
void | EnableVibration (plUInt8 uiVirtual, bool bEnable) |
Enables or disables vibration on the given controller (virtual index). If it is disabled, the controller will never vibrate, even if vibration profiles are sent to it. | |
bool | IsVibrationEnabled (plUInt8 uiVirtual) const |
Checks whether vibration is enabled on the given controller (virtual index). | |
void | SetVibrationStrength (plUInt8 uiVirtual, Motor::Enum motor, float fValue) |
Sets the vibration strength for the given controller and motor. fValue is a value between 0 and 1. | |
float | GetVibrationStrength (plUInt8 uiVirtual, Motor::Enum motor) |
Returns the amount of (constant) vibration that is currently set on this controller. | |
void | SetControllerMapping (plUInt8 uiVirtualController, plInt8 iTakeInputFromPhysical) |
Sets from which physical controller a virtual controller is supposed to take its input. | |
plInt8 | GetControllerMapping (plUInt8 uiVirtual) const |
Returns from which physical controller the given virtual controller takes its input. May be negative, which means the virtual controller is deactivated. | |
void | AddVibrationTrack (plUInt8 uiVirtual, Motor::Enum motor, float *pVibrationTrackValue, plUInt32 uiSamples, float fScalingFactor=1.0f) |
Adds a short 'vibration track' (a sequence of vibrations) to the given controller. | |
![]() | |
plInputDevice () | |
Default Constructor. | |
float | GetInputSlotState (plStringView sSlot) const |
Allows to query current input values for the given slot. | |
bool | HasDeviceBeenUsedLastFrame () const |
Returns true, if the device was 'used' during the last frame, ie. when it generated input due to some user interaction. | |
![]() | |
virtual const plRTTI * | GetDynamicRTTI () const |
bool | IsInstanceOf (const plRTTI *pType) const |
Returns whether the type of this instance is of the given type or derived from it. | |
template<typename T > | |
PL_ALWAYS_INLINE bool | IsInstanceOf () const |
Returns whether the type of this instance is of the given type or derived from it. | |
Static Public Member Functions | |
static plInputDeviceXBox360 * | GetDevice () |
Returns an plInputDeviceXBox360 device. | |
static void | DestroyAllDevices () |
Destroys all devices of this type. Automatically called at engine shutdown. | |
![]() | |
static const plRTTI * | GetStaticRTTI () |
Private Member Functions | |
virtual void | InitializeDevice () override |
Override this if you need to do device specific initialization before the first use. | |
virtual void | UpdateInputSlotValues () override |
Override this, if you need to query the state of the hardware to update the input slots. | |
virtual void | RegisterInputSlots () override |
Override this to register all the input slots that this device exposes. | |
virtual void | UpdateHardwareState (plTime tTimeDifference) override |
This function is called once after plInputManager::Update with the same time delta value. It allows to update hardware state, such as the vibration of gamepad motors. | |
Additional Inherited Members | |
![]() | |
enum | { MaxControllers = 4 , VibrationSamplesPerSecond = 16 , VibrationTrackSeconds = 2 , MaxVibrationSamples = VibrationSamplesPerSecond * VibrationTrackSeconds } |
![]() | |
void | UpdateVibration (plTime tTimeDifference) |
Combines the constant vibration and vibration tracks and applies them on each controller. | |
![]() | |
virtual void | ResetInputSlotValues () |
Override this, if you need to reset certain input slot values to zero, after the plInputManager is finished with the current frame update. | |
![]() | |
static void | RegisterInputSlot (plStringView sName, plStringView sDefaultDisplayName, plBitflags< plInputSlotFlags > SlotFlags) |
Calls RegisterInputSlot() on the plInputManager and passes the parameters through. | |
![]() | |
plMap< plString, float > | m_InputSlotValues |
Stores all the values for all input slots that this device handles. | |
plUInt32 | m_uiLastCharacter |
If this input device type handles character input, it should write the last typed character into this variable. The plInputManager calls RetrieveLastCharacter() to query what the user typed last. | |
![]() | |
plEnumerable * | m_pNextInstance |
An implementation of plInputDeviceController that handles XBox 360 controllers.
Works on all platforms that provide the XINPUT API.
|
inlineoverrideprivatevirtual |
Override this if you need to do device specific initialization before the first use.
Implements plInputDevice.
|
overridevirtual |
Queries whether the controller with the given physical index is connected to the computer. This may change at any time.
Implements plInputDeviceController.
|
overrideprivatevirtual |
Override this to register all the input slots that this device exposes.
This is called once during initialization. It needs to call RegisterInputSlot() once for every input slot that this device exposes to the system.
Implements plInputDevice.
|
overrideprivatevirtual |
This function is called once after plInputManager::Update with the same time delta value. It allows to update hardware state, such as the vibration of gamepad motors.
Reimplemented from plInputDevice.
|
overrideprivatevirtual |
Override this, if you need to query the state of the hardware to update the input slots.
Implements plInputDevice.