Gainput  v1.0.0
Public Member Functions | Protected Member Functions | List of all members
gainput::InputGesture Class Reference

Base class for all input gestures. More...

#include <GainputGestures.h>

Inheritance diagram for gainput::InputGesture:
gainput::InputDevice gainput::DoubleClickGesture gainput::HoldGesture gainput::PinchGesture gainput::RotateGesture gainput::SimultaneouslyDownGesture gainput::TapGesture

Public Member Functions

DeviceType GetType () const
 Returns DT_GESTURE.
 
const char * GetTypeName () const
 Returns the device type's name.
 
bool IsLateUpdate () const
 Returns if this device should be updated after other devices.
 
- Public Member Functions inherited from gainput::InputDevice
 InputDevice (InputManager &manager, DeviceId device, unsigned index)
 Initializes the input device. More...
 
virtual ~InputDevice ()
 Empty virtual destructor.
 
void Update (InputDeltaState *delta)
 Update this device, internally called by InputManager. More...
 
DeviceId GetDeviceId () const
 Returns this device's ID.
 
unsigned GetIndex () const
 Returns the device's index among devices of the same type.
 
virtual DeviceVariant GetVariant () const
 Returns the device variant.
 
DeviceState GetState () const
 Returns the device state.
 
virtual bool IsAvailable () const
 Returns if this device is available.
 
virtual bool IsValidButtonId (DeviceButtonId deviceButton) const =0
 Returns if the given button is valid for this device.
 
bool GetBool (DeviceButtonId deviceButton) const
 Returns the current state of the given button.
 
bool GetBoolPrevious (DeviceButtonId deviceButton) const
 Returns the previous state of the given button.
 
float GetFloat (DeviceButtonId deviceButton) const
 Returns the current state of the given button.
 
float GetFloatPrevious (DeviceButtonId deviceButton) const
 Returns the previous state of the given button.
 
virtual size_t GetAnyButtonDown (DeviceButtonSpec *outButtons, size_t maxButtonCount) const
 Checks if any button on this device is down. More...
 
virtual size_t GetButtonName (DeviceButtonId deviceButton, char *buffer, size_t bufferLength) const
 Gets the name of the given button. More...
 
virtual ButtonType GetButtonType (DeviceButtonId deviceButton) const =0
 Returns the type of the given button.
 
virtual DeviceButtonId GetButtonByName (const char *name) const
 Returns the button's ID if the name is of this device's buttons. More...
 
InputStateGetInputState ()
 Returns the device's state, probably best if only used internally.
 
const InputStateGetInputState () const
 Returns the device's state, probably best if only used internally.
 
InputStateGetPreviousInputState ()
 Returns the device's previous state, probably best if only used internally.
 
virtual InputStateGetNextInputState ()
 Returns the device's state that is currently being determined, may be 0 if not available.
 
float GetDeadZone (DeviceButtonId buttonId) const
 Returns the previously set dead zone for the given button or 0.0f if none was set yet.
 
void SetDeadZone (DeviceButtonId buttonId, float value)
 Sets the dead zone for the given button.
 
void SetDebugRenderingEnabled (bool enabled)
 Enable/disable debug rendering of this device.
 
bool IsDebugRenderingEnabled () const
 Returns true if debug rendering is enabled, false otherwise.
 
bool IsSynced () const
 
void SetSynced (bool synced)
 Sets if this device is being controlled remotely or from a recording. More...
 

Protected Member Functions

 InputGesture (InputManager &manager, DeviceId device, unsigned index)
 Gesture base constructor.
 
DeviceState InternalGetState () const
 Implementation of the device's GetState function. More...
 
- Protected Member Functions inherited from gainput::InputDevice
virtual void InternalUpdate (InputDeltaState *delta)=0
 Implementation of the device's Update function. More...
 
size_t CheckAllButtonsDown (DeviceButtonSpec *outButtons, size_t maxButtonCount, unsigned start, unsigned end) const
 Checks which buttons are down. More...
 

Additional Inherited Members

- Public Types inherited from gainput::InputDevice
enum  DeviceType {
  DT_MOUSE, DT_KEYBOARD, DT_PAD, DT_TOUCH,
  DT_BUILTIN, DT_REMOTE, DT_GESTURE, DT_CUSTOM,
  DT_COUNT
}
 Type of an input device. More...
 
enum  DeviceVariant { DV_STANDARD, DV_RAW, DV_NULL }
 Variant of an input device type. More...
 
enum  DeviceState { DS_OK, DS_LOW_BATTERY, DS_UNAVAILABLE }
 State of an input device. More...
 
- Static Public Attributes inherited from gainput::InputDevice
static const unsigned AutoIndex = unsigned(-1)
 
- Protected Attributes inherited from gainput::InputDevice
InputManagermanager_
 The manager this device belongs to.
 
DeviceId deviceId_
 The ID of this device.
 
unsigned index_
 Index of this device among devices of the same type.
 
InputStatestate_
 The current state of this device.
 
InputStatepreviousState_
 The previous state of this device.
 
float * deadZones_
 
bool debugRenderingEnabled_
 Specifies if this device is currently rendering debug information.
 
bool synced_
 

Detailed Description

Base class for all input gestures.

Input gestures are a way to process basic input data into more complex input data. For example, multiple buttons may be interpreted over time to form a new button. A very simple gesture would the ubiquitous double-click.

Mainly for consistency and convenience reasons, all gestures should derive from this class though it's not strictly necessary (deriving from InputDevice would suffice).

Input gestures are basically just input devices that don't get their data from some hardware device but from other input devices instead. Therefore gestures must also be created by calling InputManager::CreateDevice() or InputManager::CreateAndGetDevice(). Most gestures require further initialization which is done by calling one of their Initialize() member functions. After that, they should be good to go and their buttons can be used like any other input device button, i.e. they can be mapped to some user button.

Gestures can be excluded from compilation if they are not required. In order to include all gestures GAINPUT_ENABLE_ALL_GESTURES should be defined in gainput.h . This define must be present when the library is built, otherwise the actual functionality won't be present. Similarly, there is one define for each gesture. The names of these are documented in the descriptions of the individual gesture classes. If no such define is defined, no gesture will be included.

Member Function Documentation

◆ InternalGetState()

DeviceState gainput::InputGesture::InternalGetState ( ) const
inlineprotectedvirtual

Implementation of the device's GetState function.

Returns
The device's state.

Implements gainput::InputDevice.


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