ezEngine  Milestone 7
ezInputDeviceXBox360 Class Reference

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

#include <InputDeviceXBox.h>

Inheritance diagram for ezInputDeviceXBox360:

Public Member Functions

virtual bool IsControllerConnected (ezUInt8 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 ezInputDeviceController
void EnableVibration (ezUInt8 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 (ezUInt8 uiVirtual) const
 Checks whether vibration is enabled on the given controller (virtual index).
 
void SetVibrationStrength (ezUInt8 uiVirtual, Motor::Enum eMotor, float fValue)
 Sets the vibration strength for the given controller and motor. fValue is a value between 0 and 1. More...
 
float GetVibrationStrength (ezUInt8 uiVirtual, Motor::Enum eMotor)
 Returns the amount of (constant) vibration that is currently set on this controller.
 
void SetControllerMapping (ezUInt8 uiVirtualController, ezInt8 iTakeInputFromPhysical)
 Sets from which physical controller a virtual controller is supposed to take its input. More...
 
ezInt8 GetControllerMapping (ezUInt8 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 (ezUInt8 uiVirtual, Motor::Enum eMotor, float *fVibrationTrackValue, ezUInt32 uiSamples, float fScalingFactor=1.0f)
 Adds a short 'vibration track' (a sequence of vibrations) to the given controller. More...
 
- Public Member Functions inherited from ezInputDevice
 ezInputDevice ()
 Default Constructor.
 

Static Public Member Functions

static ezInputDeviceXBox360GetDevice ()
 Returns an ezInputDeviceXBox360 device.
 
static void DestroyAllDevices ()
 Destroys all devices of this type. Automatically called at engine shutdown.
 

Private Member Functions

 EZ_ADD_DYNAMIC_REFLECTION (ezInputDeviceXBox360)
 
virtual void ApplyVibration (ezUInt8 uiPhysicalController, Motor::Enum eMotor, float fStrength) override
 
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. More...
 
virtual void RegisterInputSlots () override
 Override this to register all the input slots that this device exposes. More...
 
virtual void UpdateHardwareState (ezTime tTimeDifference) override
 This function is called once after ezInputManager::Update with the same time delta value. It allows to update hardware state, such as the vibration of gamepad motors.
 
void SetValue (ezInt32 iController, const char *szButton, float fValue)
 

Static Private Member Functions

static void RegisterControllerButton (const char *szButton, const char *szName, ezBitflags< ezInputSlotFlags > SlotFlags)
 
static void SetDeadZone (const char *szButton)
 

Private Attributes

bool m_bControllerConnected [4]
 

Additional Inherited Members

- Public Types inherited from ezInputDeviceController
enum  { MaxControllers = 4, VibrationSamplesPerSecond = 16, VibrationTrackSeconds = 2, MaxVibrationSamples = VibrationSamplesPerSecond * VibrationTrackSeconds }
 
- Protected Member Functions inherited from ezInputDeviceController
void UpdateVibration (ezTime tTimeDifference)
 Combines the constant vibration and vibration tracks and applies them on each controller. More...
 
- Static Protected Member Functions inherited from ezInputDevice
static void RegisterInputSlot (const char *szName, const char *szDefaultDisplayName, ezBitflags< ezInputSlotFlags > SlotFlags)
 Calls RegisterInputSlot() on the ezInputManager and passes the parameters through.
 
- Protected Attributes inherited from ezInputDevice
ezMap< ezString, float > m_InputSlotValues
 Stores all the values for all input slots that this device handles. More...
 
ezUInt32 m_LastCharacter
 If this input device type handles character input, it should write the last typed character into this variable. The ezInputManager calls RetrieveLastCharacter() to query what the user typed last.
 

Detailed Description

An implementation of ezInputDeviceController that handles XBox 360 controllers.

Works on all platforms that provide the XINPUT API.

Member Function Documentation

void ezInputDeviceXBox360::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 ezInputDevice.

void ezInputDeviceXBox360::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 ezInputManager::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 ezInputDevice.


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