Plasma Engine  2.0
Loading...
Searching...
No Matches
plInputDeviceXBox360 Class Reference

An implementation of plInputDeviceController that handles XBox 360 controllers. More...

#include <InputDeviceXBox.h>

Inheritance diagram for plInputDeviceXBox360:

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.
 
- Public Member Functions inherited from plInputDeviceController
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.
 
- Public Member Functions inherited from plInputDevice
 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.
 
- Public Member Functions inherited from plReflectedClass
virtual const plRTTIGetDynamicRTTI () 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 plInputDeviceXBox360GetDevice ()
 Returns an plInputDeviceXBox360 device.
 
static void DestroyAllDevices ()
 Destroys all devices of this type. Automatically called at engine shutdown.
 
- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 

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

- Public Types inherited from plInputDeviceController
enum  { MaxControllers = 4 , VibrationSamplesPerSecond = 16 , VibrationTrackSeconds = 2 , MaxVibrationSamples = VibrationSamplesPerSecond * VibrationTrackSeconds }
 
- Protected Member Functions inherited from plInputDeviceController
void UpdateVibration (plTime tTimeDifference)
 Combines the constant vibration and vibration tracks and applies them on each controller.
 
- Protected Member Functions inherited from plInputDevice
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 Protected Member Functions inherited from plInputDevice
static void RegisterInputSlot (plStringView sName, plStringView sDefaultDisplayName, plBitflags< plInputSlotFlags > SlotFlags)
 Calls RegisterInputSlot() on the plInputManager and passes the parameters through.
 
- Protected Attributes inherited from plInputDevice
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.
 
- Protected Attributes inherited from plEnumerable< plInputDevice, plReflectedClass >
plEnumerablem_pNextInstance
 

Detailed Description

An implementation of plInputDeviceController that handles XBox 360 controllers.

Works on all platforms that provide the XINPUT API.

Member Function Documentation

◆ InitializeDevice()

virtual void plInputDeviceXBox360::InitializeDevice ( )
inlineoverrideprivatevirtual

Override this if you need to do device specific initialization before the first use.

Implements plInputDevice.

◆ IsControllerConnected()

bool plInputDeviceXBox360::IsControllerConnected ( plUInt8 uiPhysical) const
overridevirtual

Queries whether the controller with the given physical index is connected to the computer. This may change at any time.

Implements plInputDeviceController.

◆ RegisterInputSlots()

void plInputDeviceXBox360::RegisterInputSlots ( )
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.

◆ UpdateHardwareState()

void plInputDeviceXBox360::UpdateHardwareState ( plTime tTimeDifference)
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.

◆ UpdateInputSlotValues()

void plInputDeviceXBox360::UpdateInputSlotValues ( )
overrideprivatevirtual

Override this, if you need to query the state of the hardware to update the input slots.

Note
This function might be called multiple times before ResetInputSlotValues() is called. This will be the case when plInputManager::PollHardware is used to make more frequent hardware updates than input is actually processed. Just make sure to always accumulate delta values (such as mouse move values) and don't expect ResetInputSlotValues() to be called in tandem with this function and it will be fine.

Implements plInputDevice.


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