Gainput  v1.0.0
Classes | Typedefs | Enumerations | Functions | Variables
gainput Namespace Reference

Contains all Gainput related classes, types, and functions. More...


class  Allocator
 Interface used to pass custom allocators to the library. More...
class  Array
 A std::vector-like data container for POD-types. More...
class  DebugRenderer
 Interface for debug rendering of input device states. More...
class  DefaultAllocator
 The default allocator used by the library. More...
struct  DeviceButtonSpec
 Describes a device button on a specific device. More...
class  DeviceStateModifier
 Interface for modifiers that change device input states after they have been updated. More...
class  DoubleClickGesture
 A double-click gesture. More...
class  HashMap
 A hash table mapping keys to POD-type values. More...
class  HoldGesture
 A hold-to-trigger gesture. More...
class  InputDeltaState
 Stores a list of input state changes. More...
class  InputDevice
 Interface for anything that provides device inputs. More...
class  InputDeviceBuiltIn
 An input device for inputs that are directly built into the executing device (for example, sensors in a phone). More...
class  InputDeviceKeyboard
 A keyboard input device. More...
class  InputDeviceMouse
 A mouse input device. More...
class  InputDevicePad
 A pad input device. More...
class  InputDeviceTouch
 A touch input device. More...
class  InputGesture
 Base class for all input gestures. More...
class  InputListener
 Listener interface that allows to receive notifications when device button states change. More...
class  InputManager
 Manages all input devices and some other helpful stuff. More...
class  InputMap
 Maps user buttons to device buttons. More...
class  InputPlayer
 Plays back a previously recorded sequence of device state changes. More...
class  InputRecorder
 Records a sequence of button state changes. More...
class  InputRecording
 A recorded sequence of input changes. More...
class  InputState
 State of an input device. More...
class  MappedInputListener
 Listener interface that allows to receive notifications when user button states change. More...
class  PinchGesture
 A multi-touch pinch-to-scale gesture. More...
struct  RecordedDeviceButtonChange
 A single recorded change for a device button. More...
class  RingBuffer
 A ring buffer. More...
class  RotateGesture
 A multi-touch rotate gesture. More...
class  SimultaneouslyDownGesture
 A gesture that tracks if a number of buttons is down simultaneously. More...
class  TapGesture
 A tap-to-trigger gesture. More...
class  TrackingAllocator
 An allocator that tracks an allocations that were done. More...


typedef unsigned int DeviceId
 ID of an input device.
typedef unsigned int DeviceButtonId
 ID of a specific button unique to an input device.
typedef unsigned int UserButtonId
 ID of a user-defined, mapped button.
typedef unsigned int ListenerId
 ID of an input listener.
typedef unsigned int ModifierId
 ID of a device state modifier.
typedef float(* FilterFunc_T) (float const value, void *userData)
 Type for filter functions that can be used to filter mapped float inputs.


enum  ButtonType { BT_BOOL, BT_FLOAT, BT_COUNT }
 Type of an input device button. More...
enum  BuiltInButton {
  BuiltInButtonAccelerationX, BuiltInButtonAccelerationY, BuiltInButtonAccelerationZ, BuiltInButtonGravityX,
  BuiltInButtonGravityY, BuiltInButtonGravityZ, BuiltInButtonGyroscopeX, BuiltInButtonGyroscopeY,
  BuiltInButtonGyroscopeZ, BuiltInButtonMagneticFieldX, BuiltInButtonMagneticFieldY, BuiltInButtonMagneticFieldZ,
 All valid device buttons for InputDeviceBuiltIn.
enum  Key {
  KeyEscape, KeyF1, KeyF2, KeyF3,
  KeyF4, KeyF5, KeyF6, KeyF7,
  KeyF8, KeyF9, KeyF10, KeyF11,
  KeyF12, KeyF13, KeyF14, KeyF15,
  KeyF16, KeyF17, KeyF18, KeyF19,
  KeyPrint, KeyScrollLock, KeyBreak, KeySpace = 0x0020,
  KeyApostrophe = 0x0027, KeyComma = 0x002c, KeyMinus = 0x002d, KeyPeriod = 0x002e,
  KeySlash = 0x002f, Key0 = 0x0030, Key1 = 0x0031, Key2 = 0x0032,
  Key3 = 0x0033, Key4 = 0x0034, Key5 = 0x0035, Key6 = 0x0036,
  Key7 = 0x0037, Key8 = 0x0038, Key9 = 0x0039, KeySemicolon = 0x003b,
  KeyLess = 0x003c, KeyEqual = 0x003d, KeyA = 0x0041, KeyB = 0x0042,
  KeyC = 0x0043, KeyD = 0x0044, KeyE = 0x0045, KeyF = 0x0046,
  KeyG = 0x0047, KeyH = 0x0048, KeyI = 0x0049, KeyJ = 0x004a,
  KeyK = 0x004b, KeyL = 0x004c, KeyM = 0x004d, KeyN = 0x004e,
  KeyO = 0x004f, KeyP = 0x0050, KeyQ = 0x0051, KeyR = 0x0052,
  KeyS = 0x0053, KeyT = 0x0054, KeyU = 0x0055, KeyV = 0x0056,
  KeyW = 0x0057, KeyX = 0x0058, KeyY = 0x0059, KeyZ = 0x005a,
  KeyBracketLeft = 0x005b, KeyBackslash = 0x005c, KeyBracketRight = 0x005d, KeyGrave = 0x0060,
  KeyLeft, KeyRight, KeyUp, KeyDown,
  KeyInsert, KeyHome, KeyDelete, KeyEnd,
  KeyPageUp, KeyPageDown, KeyNumLock, KeyKpEqual,
  KeyKpDivide, KeyKpMultiply, KeyKpSubtract, KeyKpAdd,
  KeyKpEnter, KeyKpInsert, KeyKpEnd, KeyKpDown,
  KeyKpPageDown, KeyKpLeft, KeyKpBegin, KeyKpRight,
  KeyKpHome, KeyKpUp, KeyKpPageUp, KeyKpDelete,
  KeyBackSpace, KeyTab, KeyReturn, KeyCapsLock,
  KeyShiftL, KeyCtrlL, KeySuperL, KeyAltL,
  KeyAltR, KeySuperR, KeyMenu, KeyCtrlR,
  KeyShiftR, KeyBack, KeySoftLeft, KeySoftRight,
  KeyCall, KeyEndcall, KeyStar, KeyPound,
  KeyDpadCenter, KeyVolumeUp, KeyVolumeDown, KeyPower,
  KeyCamera, KeyClear, KeySymbol, KeyExplorer,
  KeyEnvelope, KeyEquals, KeyAt, KeyHeadsethook,
  KeyFocus, KeyPlus, KeyNotification, KeySearch,
  KeyMediaPlayPause, KeyMediaStop, KeyMediaNext, KeyMediaPrevious,
  KeyMediaRewind, KeyMediaFastForward, KeyMute, KeyPictsymbols,
  KeySwitchCharset, KeyForward, KeyExtra1, KeyExtra2,
  KeyExtra3, KeyExtra4, KeyExtra5, KeyExtra6,
  KeyFn, KeyCircumflex, KeySsharp, KeyAcute,
  KeyAltGr, KeyNumbersign, KeyUdiaeresis, KeyAdiaeresis,
  KeyOdiaeresis, KeySection, KeyAring, KeyDiaeresis,
  KeyTwosuperior, KeyRightParenthesis, KeyDollar, KeyUgrave,
  KeyAsterisk, KeyColon, KeyExclam, KeyBraceLeft,
  KeyBraceRight, KeySysRq, KeyCount_
 All valid device buttons for InputDeviceKeyboard.
enum  MouseButton {
  MouseButton0 = 0, MouseButtonLeft = MouseButton0, MouseButton1, MouseButtonMiddle = MouseButton1,
  MouseButton2, MouseButtonRight = MouseButton2, MouseButton3, MouseButtonWheelUp = MouseButton3,
  MouseButton4, MouseButtonWheelDown = MouseButton4, MouseButton5, MouseButton6,
  MouseButton7, MouseButton8, MouseButton9, MouseButton10,
  MouseButton11, MouseButton12, MouseButton13, MouseButton14,
  MouseButton15, MouseButton16, MouseButton17, MouseButton18,
  MouseButton19, MouseButton20, MouseButtonMax = MouseButton20, MouseButtonCount,
  MouseAxisX = MouseButtonCount, MouseAxisY, MouseButtonCount_, MouseAxisCount = MouseButtonCount_ - MouseAxisX
 All valid device buttons for InputDeviceMouse.
enum  { MaxPadCount = 10 }
 The maximum number of pads supported.
enum  PadButton {
  PadButtonLeftStickX, PadButtonLeftStickY, PadButtonRightStickX, PadButtonRightStickY,
  PadButtonAxis4, PadButtonAxis5, PadButtonAxis6, PadButtonAxis7,
  PadButtonAxis8, PadButtonAxis9, PadButtonAxis10, PadButtonAxis11,
  PadButtonAxis12, PadButtonAxis13, PadButtonAxis14, PadButtonAxis15,
  PadButtonAxis16, PadButtonAxis17, PadButtonAxis18, PadButtonAxis19,
  PadButtonAxis20, PadButtonAxis21, PadButtonAxis22, PadButtonAxis23,
  PadButtonAxis24, PadButtonAxis25, PadButtonAxis26, PadButtonAxis27,
  PadButtonAxis28, PadButtonAxis29, PadButtonAxis30, PadButtonAxis31,
  PadButtonAccelerationX, PadButtonAccelerationY, PadButtonAccelerationZ, PadButtonGravityX,
  PadButtonGravityY, PadButtonGravityZ, PadButtonGyroscopeX, PadButtonGyroscopeY,
  PadButtonGyroscopeZ, PadButtonMagneticFieldX, PadButtonMagneticFieldY, PadButtonMagneticFieldZ,
  PadButtonStart, PadButtonAxisCount_ = PadButtonStart, PadButtonSelect, PadButtonLeft,
  PadButtonRight, PadButtonUp, PadButtonDown, PadButtonA,
  PadButtonB, PadButtonX, PadButtonY, PadButtonL1,
  PadButtonR1, PadButtonL2, PadButtonR2, PadButtonL3,
  PadButtonR3, PadButtonHome, PadButton17, PadButton18,
  PadButton19, PadButton20, PadButton21, PadButton22,
  PadButton23, PadButton24, PadButton25, PadButton26,
  PadButton27, PadButton28, PadButton29, PadButton30,
  PadButton31, PadButtonMax_, PadButtonCount_ = PadButtonMax_ - PadButtonAxisCount_
 All valid device buttons for InputDevicePad.
enum  TouchButton {
  Touch0Down, Touch0X, Touch0Y, Touch0Pressure,
  Touch1Down, Touch1X, Touch1Y, Touch1Pressure,
  Touch2Down, Touch2X, Touch2Y, Touch2Pressure,
  Touch3Down, Touch3X, Touch3Y, Touch3Pressure,
  Touch4Down, Touch4X, Touch4Y, Touch4Pressure,
  Touch5Down, Touch5X, Touch5Y, Touch5Pressure,
  Touch6Down, Touch6X, Touch6Y, Touch6Pressure,
  Touch7Down, Touch7X, Touch7Y, Touch7Pressure,
 All valid device inputs for InputDeviceTouch.
enum  DoubleClickAction { DoubleClickTriggered }
 Buttons provided by the DoubleClickGesture. More...
enum  HoldAction { HoldTriggered }
 Buttons provided by the HoldGesture. More...
enum  PinchAction { PinchTriggered, PinchScale }
 Buttons provided by the PinchGesture. More...
enum  RotateAction { RotateTriggered, RotateAngle }
 Buttons provided by the RotateGesture. More...
enum  SimultaneouslyDownAction { SimultaneouslyDownTriggered }
 Buttons provided by the SimultaneouslyDownGesture. More...
enum  TapAction { TapTriggered }
 Buttons provided by the TapGesture. More...


const char * GetLibName ()
 Returns the name of the library, should be "Gainput".
uint32_t GetLibVersion ()
 Returns the version number of the library.
const char * GetLibVersionString ()
 Returns the version number of the library as a printable string.
template<class T >
Abs (T a)
void DevSetHttp (bool enable)
 Switches the library's internal development server to HTTP mode. More...
GAINPUT_LIBEXPORT DefaultAllocatorGetDefaultAllocator ()
 Returns the default instance of the default allocator. More...
uint32_t rotl32 (uint32_t x, int8_t r)
uint32_t getblock (const uint32_t *p, int i)
uint32_t fmix (uint32_t h)
void MurmurHash3_x86_32 (const void *key, int len, uint32_t seed, void *out)
 Calculates MurmurHash3 for the given key. More...
void HandleButton (InputDevice &device, InputState &state, InputDeltaState *delta, DeviceButtonId buttonId, bool value)
void HandleAxis (InputDevice &device, InputState &state, InputDeltaState *delta, DeviceButtonId buttonId, float value)
GAINPUT_LIBEXPORT float InvertSymmetricInput (float const value, void *)
 Inverts the given input value in the range [-1.0f, 1.0f].
GAINPUT_LIBEXPORT float InvertInput (float const value, void *)
 Inverts the given input value in the range [0.0f, 1.0f].


template<class K , class V >

Detailed Description

Contains all Gainput related classes, types, and functions.

Enumeration Type Documentation

◆ ButtonType

Type of an input device button.


A boolean value button, either down (true) or up (false).


A floating-point value button, between -1.0f and 1.0f or 0.0f and 1.0f.


The number of different button types.

◆ DoubleClickAction

Buttons provided by the DoubleClickGesture.


The button triggered by double-clicking.

◆ HoldAction

Buttons provided by the HoldGesture.


The button that triggers after holding for the given time.

◆ PinchAction

Buttons provided by the PinchGesture.


The button that triggers when both pinch buttons are down.


The current pinch scale value if pinching is active.

◆ RotateAction

Buttons provided by the RotateGesture.


The button that triggers when both rotate buttons are down.


The current rotation angle in radians if rotation is triggered (RotateTriggered).

◆ SimultaneouslyDownAction

Buttons provided by the SimultaneouslyDownGesture.


The button triggered by double-clicking.

◆ TapAction

Buttons provided by the TapGesture.


The button that is triggered by tapping.

Function Documentation

◆ DevSetHttp()

void gainput::DevSetHttp ( bool  enable)

Switches the library's internal development server to HTTP mode.

When the server is in HTTP mode, it is possible to control touch input using an external HTML page that connects to the library via HTTP.

The HTML page(s) can be found under tools/html5client/ and should be placed on an HTTP server that can be reached from the touch device that should send touch events to the library. The touch device then in turn connects to the library's internal HTTP server and periodically sends touch input information.

The pages can also be found hosted here:


◆ GetDefaultAllocator()

GAINPUT_LIBEXPORT DefaultAllocator& gainput::GetDefaultAllocator ( )

Returns the default instance of the default allocator.

See also

◆ MurmurHash3_x86_32()

void gainput::MurmurHash3_x86_32 ( const void *  key,
int  len,
uint32_t  seed,
void *  out 

Calculates MurmurHash3 for the given key.

keyThe key to calculate the hash of.
lenLength of the key in bytes.
seedSeed for the hash.
[out]outThe hash value, a uint32_t in this case.