Namespace: dmHid
Language: C++
Type: Defold C++
File: hid.h
Source: engine/hid/src/dmsdk/hid/hid.h
Include: dmsdk/hid/hid.h
Used to add input to the engine
Type: FUNCTION Add text input
Parameters
keyboard (dmHID::HContext) - context handlechr (int) - The character (unicode)Type: FUNCTION Adds a touch event touch.
Parameters
device (dmHID::HTouchDevice) - device handlex (int32_t) - x-coordinate of the positiony (int32_t) - y-coordinate of the positionid (uint32_t) - identifier of touchphase (dmHID::Phase) - phase of touchType: TYPEDEF HID context handle
Type: TYPEDEF gamepad context handle
Type: TYPEDEF keyboard context handle
Type: TYPEDEF mouse context handle
Type: TYPEDEF touch device context handle
Type: CONSTANT invalid gamepad handle
Type: CONSTANT invalid keyboard handle
Type: CONSTANT invalid mouse handle
Type: CONSTANT invalid touch devicehandle
Type: CONSTANT max number of characters
Type: CONSTANT Maximum number of gamepad axis supported
Type: CONSTANT Maximum number of gamepad buttons supported
Type: CONSTANT Maximum number of gamepads supported
Type: CONSTANT Maximum number of gamepad hats supported
Type: CONSTANT Maximum number of keyboards supported
Type: CONSTANT Maximum number of mice supported
Type: CONSTANT Maximum number of simultaneous touches supported
Type: CONSTANT Maximum number of touch devices supported
Type: STRUCT Contains the current state of a gamepad
Notes
Type: FUNCTION gets a gamepad device handle
Parameters
context (dmHID::HContext) - context in which to find the gamepadindex (uint8_t) - device indexReturns
gamepad (dmHID::HGamepad) - Handle to gamepad. dmHID::INVALID_GAMEPAD_HANDLE if not availableType: FUNCTION gets a gamepad device handle
Parameters
gamepad (dmHID::HGamepad) - Handle to gamepadout (void**) - Platform specific user id dataReturns
result (boolean) - true if gamepad has a user id data assigned to itType: FUNCTION Convenience function to retrieve the state of a gamepad button from a gamepad packet.
Parameters
packet (dmHID::GamepadPacket) - Gamepad packetbutton (uint32_t) - The requested buttonReturns
success (bool) - True if the button is currently pressed down.Type: FUNCTION Convenience function to retrieve the state of a gamepad hat from a gamepad packet.
Parameters
packet (dmHID::GamepadPacket) - Gamepad packethat (uint32_t) - The requested hat indexout_hat_value (uint8_t) - Hat value out argumentReturns
success (bool) - True if the hat has data.Type: FUNCTION Obtain a gamepad packet reflecting the current input state of the gamepad in a HID context.
Parameters
gamepad (dmHID::HGamepad) - gamepad handleout_packet (dmHID::GamepadPacket) - Gamepad packet out argumentReturns
success (bool) - True if the packet was successfully updated.Type: FUNCTION gets a keyboard handle
Parameters
context (dmHID::HContext) - context in which to find the gamepadindex (uint8_t) - device indexReturns
keyboard (dmHID::HKeyboard) - Handle to keyboard. dmHID::INVALID_KEYBOARD_HANDLE if not availableType: FUNCTION gets a mouse handle
Parameters
context (dmHID::HContext) - context in which to find the gamepadindex (uint8_t) - device indexReturns
mouse (dmHID::HMouse) - Handle to mouse. dmHID::INVALID_MOUSE_HANDLE if not availableType: FUNCTION Convenience function to retrieve the state of a mouse button from a mouse packet.
Parameters
packet (dmHID::MousePacket*) - Mouse packetbutton (dmHID::MouseButton) - The requested buttonReturns
result (bool) - If the button was pressed or notType: FUNCTION Obtain a mouse packet reflecting the current input state of a HID context.
Parameters
mouse (dmHID::HMouse) - context from which to retrieve the packetout_packet (dmHID::MousePacket*) - Mouse packet out argumentReturns
result (bool) - If the packet was successfully updated or not.Type: FUNCTION gets a touch device handle
Parameters
context (dmHID::HContext) - context in which to find the gamepadindex (uint8_t) - device indexReturns
device (dmHID::HTouchDevice) - Handle to touch device. dmHID::INVALID_TOUCH_DEVICE_HANDLE if not availableType: ENUM keyboard key enumeration
Members
dmHID::KEY_SPACEdmHID::KEY_EXCLAIMdmHID::KEY_QUOTEDBLdmHID::KEY_HASHdmHID::KEY_DOLLARdmHID::KEY_AMPERSANDdmHID::KEY_QUOTEdmHID::KEY_LPARENdmHID::KEY_RPARENdmHID::KEY_ASTERISKdmHID::KEY_PLUSdmHID::KEY_COMMAdmHID::KEY_MINUSdmHID::KEY_PERIODdmHID::KEY_SLASHdmHID::KEY_0dmHID::KEY_1dmHID::KEY_2dmHID::KEY_3dmHID::KEY_4dmHID::KEY_5dmHID::KEY_6dmHID::KEY_7dmHID::KEY_8dmHID::KEY_9dmHID::KEY_COLONdmHID::KEY_SEMICOLONdmHID::KEY_LESSdmHID::KEY_EQUALSdmHID::KEY_GREATERdmHID::KEY_QUESTIONdmHID::KEY_ATdmHID::KEY_AdmHID::KEY_BdmHID::KEY_CdmHID::KEY_DdmHID::KEY_EdmHID::KEY_FdmHID::KEY_GdmHID::KEY_HdmHID::KEY_IdmHID::KEY_JdmHID::KEY_KdmHID::KEY_LdmHID::KEY_MdmHID::KEY_NdmHID::KEY_OdmHID::KEY_PdmHID::KEY_QdmHID::KEY_RdmHID::KEY_SdmHID::KEY_TdmHID::KEY_UdmHID::KEY_VdmHID::KEY_WdmHID::KEY_XdmHID::KEY_YdmHID::KEY_ZdmHID::KEY_LBRACKETdmHID::KEY_BACKSLASHdmHID::KEY_RBRACKETdmHID::KEY_CARETdmHID::KEY_UNDERSCOREdmHID::KEY_BACKQUOTEdmHID::KEY_LBRACEdmHID::KEY_PIPEdmHID::KEY_RBRACEdmHID::KEY_TILDEdmHID::KEY_ESCdmHID::KEY_F1dmHID::KEY_F2dmHID::KEY_F3dmHID::KEY_F4dmHID::KEY_F5dmHID::KEY_F6dmHID::KEY_F7dmHID::KEY_F8dmHID::KEY_F9dmHID::KEY_F10dmHID::KEY_F11dmHID::KEY_F12dmHID::KEY_UPdmHID::KEY_DOWNdmHID::KEY_LEFTdmHID::KEY_RIGHTdmHID::KEY_LSHIFTdmHID::KEY_RSHIFTdmHID::KEY_LCTRLdmHID::KEY_RCTRLdmHID::KEY_LALTdmHID::KEY_RALTdmHID::KEY_TABdmHID::KEY_ENTERdmHID::KEY_BACKSPACEdmHID::KEY_INSERTdmHID::KEY_DELdmHID::KEY_PAGEUPdmHID::KEY_PAGEDOWNdmHID::KEY_HOMEdmHID::KEY_ENDdmHID::KEY_KP_0dmHID::KEY_KP_1dmHID::KEY_KP_2dmHID::KEY_KP_3dmHID::KEY_KP_4dmHID::KEY_KP_5dmHID::KEY_KP_6dmHID::KEY_KP_7dmHID::KEY_KP_8dmHID::KEY_KP_9dmHID::KEY_KP_DIVIDEdmHID::KEY_KP_MULTIPLYdmHID::KEY_KP_SUBTRACTdmHID::KEY_KP_ADDdmHID::KEY_KP_DECIMALdmHID::KEY_KP_EQUALdmHID::KEY_KP_ENTERdmHID::KEY_KP_NUM_LOCKdmHID::KEY_CAPS_LOCKdmHID::KEY_SCROLL_LOCKdmHID::KEY_PAUSEdmHID::KEY_LSUPERdmHID::KEY_RSUPERdmHID::KEY_MENUdmHID::KEY_BACKdmHID::MAX_KEY_COUNTType: STRUCT Contains the current state of a keyboard
Notes
Type: ENUM mouse button enumeration
Members
dmHID::MOUSE_BUTTON_LEFTdmHID::MOUSE_BUTTON_MIDDLEdmHID::MOUSE_BUTTON_RIGHTdmHID::MOUSE_BUTTON_1dmHID::MOUSE_BUTTON_2dmHID::MOUSE_BUTTON_3dmHID::MOUSE_BUTTON_4dmHID::MOUSE_BUTTON_5dmHID::MOUSE_BUTTON_6dmHID::MOUSE_BUTTON_7dmHID::MOUSE_BUTTON_8dmHID::MAX_MOUSE_BUTTON_COUNTType: STRUCT Contains the current state of a mouse
Notes
Type: ENUM touch phase enumeration
Notes
Members
dmHID::PHASE_BEGANdmHID::PHASE_MOVEDdmHID::PHASE_STATIONARYdmHID::PHASE_ENDEDdmHID::PHASE_CANCELLEDType: FUNCTION Sets the state of a gamepad axis.
Parameters
gamepad (dmHID::HGamepad) - device handleaxis (uint32_t) - The requested axis [0, dmHID::MAX_GAMEPAD_AXIS_COUNT)value (float) - axis value [-1, 1]Type: FUNCTION Sets the state of a gamepad button.
Parameters
gamepad (dmHID::HGamepad) - device handlebutton (uint32_t) - The requested button [0, dmHID::MAX_GAMEPAD_BUTTON_COUNT)value (bool) - Button stateType: FUNCTION Sets the state of a key.
Parameters
keyboard (dmHID::HKeyboard) - context handlekey (dmHID::Key) - The requested keyvalue (bool) - Key stateType: FUNCTION Sets the state of a mouse button.
Parameters
mouse (dmHID::HMouse) - device handlebutton (dmHID::MouseButton) - The requested buttonvalue (bool) - Button stateType: FUNCTION Sets the position of a mouse.
Parameters
mouse (dmHID::HMouse) - device handlex (int32_t) - x-coordinate of the positiony (int32_t) - y-coordinate of the positionType: FUNCTION Sets the mouse wheel.
Parameters
mouse (dmHID::HMouse) - device handlevalue (int32_t) - wheel valueType: STRUCT Data for a single touch, e.g. finger
Members
m_TapCount (int32_t) - Single-click, double, etcm_Phase (Phase) - Begin, end, etcm_X (int32_t) - Current xm_Y (int32_t) - Current ym_ScreenX (int32_t) - Current x, in screen spacem_ScreenY (int32_t) - Current y, in screen spacem_DX (int32_t) - Current dxm_DY (int32_t) - Current dym_ScreenDX (int32_t) - Current dx, in screen spacem_ScreenDY (int32_t) - Current dy, in screen spacem_Id (int32_t) - Touch id