Used to add input to the engine
Namespace: | dmHid |
Include: | #include <dmsdk/hid/hid.h> |
TYPES | |
---|---|
dmHID::HContext | HID context handle |
dmHID::HGamepad | gamepad context handle |
dmHID::HKeyboard | keyboard context handle |
dmHID::HMouse | mouse context handle |
dmHID::HTouchDevice | touch device context handle |
ENUMS | |
---|---|
Key | keyboard key enumeration |
MouseButton | mouse button enumeration |
Phase | touch phase enumeration |
STRUCTS | |
---|---|
struct GamepadPacket | Contains the current state of a gamepad |
struct KeyboardPacket | Contains the current state of a keyboard |
struct MousePacket | Contains the current state of a mouse |
struct Touch | Data for a single touch, e.g. finger |
void AddKeyboardChar(dmHID::HContext keyboard, int chr)
Add text input
PARAMETERS
dmHID::HContext |
keyboard |
context handle |
int |
chr |
The character (unicode) |
void AddTouch(dmHID::HTouchDevice device, int32_t x, int32_t y, uint32_t id, dmHID::Phase phase)
Adds a touch event touch.
PARAMETERS
dmHID::HTouchDevice |
device |
device handle |
int32_t |
x |
x-coordinate of the position |
int32_t |
y |
y-coordinate of the position |
uint32_t |
id |
identifier of touch |
dmHID::Phase |
phase |
phase of touch |
void dmHID::INVALID_GAMEPAD_HANDLE [type: dmHID::HGamepad]()
invalid gamepad handle
PARAMETERS
void dmHID::INVALID_KEYBOARD_HANDLE [type: dmHID::HKeyboard]()
invalid keyboard handle
PARAMETERS
void dmHID::INVALID_MOUSE_HANDLE [type: dmHID::HMouse]()
invalid mouse handle
PARAMETERS
void dmHID::INVALID_TOUCHDEVICE_HANDLE [type: dmHID::HTouchDevice]()
invalid touch devicehandle
PARAMETERS
void dmHID::MAX_CHAR_COUNT()
max number of characters
PARAMETERS
void dmHID::MAX_GAMEPAD_AXIS_COUNT [type: uint32_t]()
Maximum number of gamepad axis supported
PARAMETERS
void dmHID::MAX_GAMEPAD_BUTTON_COUNT [type: uint32_t]()
Maximum number of gamepad buttons supported
PARAMETERS
void dmHID::MAX_GAMEPAD_COUNT [type: uint32_t]()
Maximum number of gamepads supported
PARAMETERS
void dmHID::MAX_GAMEPAD_HAT_COUNT [type: uint32_t]()
Maximum number of gamepad hats supported
PARAMETERS
void dmHID::MAX_KEYBOARD_COUNT [type: uint32_t]()
Maximum number of keyboards supported
PARAMETERS
void dmHID::MAX_MOUSE_COUNT [type: uint32_t]()
Maximum number of mice supported
PARAMETERS
void dmHID::MAX_TOUCH_COUNT [type: uint32_t]()
Maximum number of simultaneous touches supported
PARAMETERS
void dmHID::MAX_TOUCH_DEVICE_COUNT [type: uint32_t]()
Maximum number of touch devices supported
PARAMETERS
dmHID::HGamepad GetGamePad(dmHID::HContext context, uint8_t index)
gets a gamepad device handle
PARAMETERS
dmHID::HContext |
context |
context in which to find the gamepad |
uint8_t |
index |
device index |
RETURNS
dmHID::HGamepad |
Handle to gamepad. dmHID::INVALID_GAMEPAD_HANDLE if not available |
boolean GetGamePad(dmHID::HGamepad gamepad, void** out)
gets a gamepad device handle
PARAMETERS
dmHID::HGamepad |
gamepad |
Handle to gamepad |
void** |
out |
Platform specific user id data |
RETURNS
boolean |
true if gamepad has a user id data assigned to it |
dmHID::HKeyboard GetKeyboard(dmHID::HContext context, uint8_t index)
gets a keyboard handle
PARAMETERS
dmHID::HContext |
context |
context in which to find the gamepad |
uint8_t |
index |
device index |
RETURNS
dmHID::HKeyboard |
Handle to keyboard. dmHID::INVALID_KEYBOARD_HANDLE if not available |
dmHID::HMouse GetMouse(dmHID::HContext context, uint8_t index)
gets a mouse handle
PARAMETERS
dmHID::HContext |
context |
context in which to find the gamepad |
uint8_t |
index |
device index |
RETURNS
dmHID::HMouse |
Handle to mouse. dmHID::INVALID_MOUSE_HANDLE if not available |
bool GetMouseButton(dmHID::MousePacket* packet, dmHID::MouseButton button)
Convenience function to retrieve the state of a mouse button from a mouse packet.
PARAMETERS
dmHID::MousePacket* |
packet |
Mouse packet |
dmHID::MouseButton |
button |
The requested button |
RETURNS
bool |
If the button was pressed or not |
bool GetMousePacket(dmHID::HMouse mouse, dmHID::MousePacket* out_packet)
Obtain a mouse packet reflecting the current input state of a HID context.
PARAMETERS
dmHID::HMouse |
mouse |
context from which to retrieve the packet |
dmHID::MousePacket* |
out_packet |
Mouse packet out argument |
RETURNS
bool |
If the packet was successfully updated or not. |
dmHID::HTouchDevice GetTouchDevice(dmHID::HContext context, uint8_t index)
gets a touch device handle
PARAMETERS
dmHID::HContext |
context |
context in which to find the gamepad |
uint8_t |
index |
device index |
RETURNS
dmHID::HTouchDevice |
Handle to touch device. dmHID::INVALID_TOUCH_DEVICE_HANDLE if not available |
void SetGamepadAxis(dmHID::HGamepad gamepad, uint32_t axis, float value)
Sets the state of a gamepad axis.
PARAMETERS
dmHID::HGamepad |
gamepad |
device handle |
uint32_t |
axis |
The requested axis [0, dmHID::MAX_GAMEPAD_AXIS_COUNT) |
float |
value |
axis value [-1, 1] |
void SetGamepadButton(dmHID::HGamepad gamepad, uint32_t button, bool value)
Sets the state of a gamepad button.
PARAMETERS
dmHID::HGamepad |
gamepad |
device handle |
uint32_t |
button |
The requested button [0, dmHID::MAX_GAMEPAD_BUTTON_COUNT) |
bool |
value |
Button state |
void SetKey(dmHID::HKeyboard keyboard, dmHID::Key key, bool value)
Sets the state of a key.
PARAMETERS
dmHID::HKeyboard |
keyboard |
context handle |
dmHID::Key |
key |
The requested key |
bool |
value |
Key state |
void SetMouseButton(dmHID::HMouse mouse, dmHID::MouseButton button, bool value)
Sets the state of a mouse button.
PARAMETERS
dmHID::HMouse |
mouse |
device handle |
dmHID::MouseButton |
button |
The requested button |
bool |
value |
Button state |
void SetMousePosition(dmHID::HMouse mouse, int32_t x, int32_t y)
Sets the position of a mouse.
PARAMETERS
dmHID::HMouse |
mouse |
device handle |
int32_t |
x |
x-coordinate of the position |
int32_t |
y |
y-coordinate of the position |
void SetMouseWheel(dmHID::HMouse mouse, int32_t value)
Sets the mouse wheel.
PARAMETERS
dmHID::HMouse |
mouse |
device handle |
int32_t |
value |
wheel value |
TYPE
struct GamepadPacket
Contains the current state of a gamepad
TYPE
struct KeyboardPacket
Contains the current state of a keyboard
TYPE
struct MousePacket
Contains the current state of a mouse
TYPE
struct Touch
Data for a single touch, e.g. finger
MEMBERS
int32_t |
m_TapCount |
Single-click, double, etc |
Phase |
m_Phase |
Begin, end, etc |
int32_t |
m_X |
Current x |
int32_t |
m_Y |
Current y |
int32_t |
m_ScreenX |
Current x, in screen space |
int32_t |
m_ScreenY |
Current y, in screen space |
int32_t |
m_DX |
Current dx |
int32_t |
m_DY |
Current dy |
int32_t |
m_ScreenDX |
Current dx, in screen space |
int32_t |
m_ScreenDY |
Current dy, in screen space |
int32_t |
m_Id |
Touch id |
HID context handle
gamepad context handle
keyboard context handle
mouse context handle
touch device context handle
keyboard key enumeration
dmHID::KEY_SPACE |
|
dmHID::KEY_EXCLAIM |
|
dmHID::KEY_QUOTEDBL |
|
dmHID::KEY_HASH |
|
dmHID::KEY_DOLLAR |
|
dmHID::KEY_AMPERSAND |
|
dmHID::KEY_QUOTE |
|
dmHID::KEY_LPAREN |
|
dmHID::KEY_RPAREN |
|
dmHID::KEY_ASTERISK |
|
dmHID::KEY_PLUS |
|
dmHID::KEY_COMMA |
|
dmHID::KEY_MINUS |
|
dmHID::KEY_PERIOD |
|
dmHID::KEY_SLASH |
|
dmHID::KEY_0 |
|
dmHID::KEY_1 |
|
dmHID::KEY_2 |
|
dmHID::KEY_3 |
|
dmHID::KEY_4 |
|
dmHID::KEY_5 |
|
dmHID::KEY_6 |
|
dmHID::KEY_7 |
|
dmHID::KEY_8 |
|
dmHID::KEY_9 |
|
dmHID::KEY_COLON |
|
dmHID::KEY_SEMICOLON |
|
dmHID::KEY_LESS |
|
dmHID::KEY_EQUALS |
|
dmHID::KEY_GREATER |
|
dmHID::KEY_QUESTION |
|
dmHID::KEY_AT |
|
dmHID::KEY_A |
|
dmHID::KEY_B |
|
dmHID::KEY_C |
|
dmHID::KEY_D |
|
dmHID::KEY_E |
|
dmHID::KEY_F |
|
dmHID::KEY_G |
|
dmHID::KEY_H |
|
dmHID::KEY_I |
|
dmHID::KEY_J |
|
dmHID::KEY_K |
|
dmHID::KEY_L |
|
dmHID::KEY_M |
|
dmHID::KEY_N |
|
dmHID::KEY_O |
|
dmHID::KEY_P |
|
dmHID::KEY_Q |
|
dmHID::KEY_R |
|
dmHID::KEY_S |
|
dmHID::KEY_T |
|
dmHID::KEY_U |
|
dmHID::KEY_V |
|
dmHID::KEY_W |
|
dmHID::KEY_X |
|
dmHID::KEY_Y |
|
dmHID::KEY_Z |
|
dmHID::KEY_LBRACKET |
|
dmHID::KEY_BACKSLASH |
|
dmHID::KEY_RBRACKET |
|
dmHID::KEY_CARET |
|
dmHID::KEY_UNDERSCORE |
|
dmHID::KEY_BACKQUOTE |
|
dmHID::KEY_LBRACE |
|
dmHID::KEY_PIPE |
|
dmHID::KEY_RBRACE |
|
dmHID::KEY_TILDE |
|
dmHID::KEY_ESC |
|
dmHID::KEY_F1 |
|
dmHID::KEY_F2 |
|
dmHID::KEY_F3 |
|
dmHID::KEY_F4 |
|
dmHID::KEY_F5 |
|
dmHID::KEY_F6 |
|
dmHID::KEY_F7 |
|
dmHID::KEY_F8 |
|
dmHID::KEY_F9 |
|
dmHID::KEY_F10 |
|
dmHID::KEY_F11 |
|
dmHID::KEY_F12 |
|
dmHID::KEY_UP |
|
dmHID::KEY_DOWN |
|
dmHID::KEY_LEFT |
|
dmHID::KEY_RIGHT |
|
dmHID::KEY_LSHIFT |
|
dmHID::KEY_RSHIFT |
|
dmHID::KEY_LCTRL |
|
dmHID::KEY_RCTRL |
|
dmHID::KEY_LALT |
|
dmHID::KEY_RALT |
|
dmHID::KEY_TAB |
|
dmHID::KEY_ENTER |
|
dmHID::KEY_BACKSPACE |
|
dmHID::KEY_INSERT |
|
dmHID::KEY_DEL |
|
dmHID::KEY_PAGEUP |
|
dmHID::KEY_PAGEDOWN |
|
dmHID::KEY_HOME |
|
dmHID::KEY_END |
|
dmHID::KEY_KP_0 |
|
dmHID::KEY_KP_1 |
|
dmHID::KEY_KP_2 |
|
dmHID::KEY_KP_3 |
|
dmHID::KEY_KP_4 |
|
dmHID::KEY_KP_5 |
|
dmHID::KEY_KP_6 |
|
dmHID::KEY_KP_7 |
|
dmHID::KEY_KP_8 |
|
dmHID::KEY_KP_9 |
|
dmHID::KEY_KP_DIVIDE |
|
dmHID::KEY_KP_MULTIPLY |
|
dmHID::KEY_KP_SUBTRACT |
|
dmHID::KEY_KP_ADD |
|
dmHID::KEY_KP_DECIMAL |
|
dmHID::KEY_KP_EQUAL |
|
dmHID::KEY_KP_ENTER |
|
dmHID::KEY_KP_NUM_LOCK |
|
dmHID::KEY_CAPS_LOCK |
|
dmHID::KEY_SCROLL_LOCK |
|
dmHID::KEY_PAUSE |
|
dmHID::KEY_LSUPER |
|
dmHID::KEY_RSUPER |
|
dmHID::KEY_MENU |
|
dmHID::KEY_BACK |
|
dmHID::MAX_KEY_COUNT |
mouse button enumeration
dmHID::MOUSE_BUTTON_LEFT |
|
dmHID::MOUSE_BUTTON_MIDDLE |
|
dmHID::MOUSE_BUTTON_RIGHT |
|
dmHID::MOUSE_BUTTON_1 |
|
dmHID::MOUSE_BUTTON_2 |
|
dmHID::MOUSE_BUTTON_3 |
|
dmHID::MOUSE_BUTTON_4 |
|
dmHID::MOUSE_BUTTON_5 |
|
dmHID::MOUSE_BUTTON_6 |
|
dmHID::MOUSE_BUTTON_7 |
|
dmHID::MOUSE_BUTTON_8 |
|
dmHID::MAX_MOUSE_BUTTON_COUNT |
touch phase enumeration
dmHID::PHASE_BEGAN |
|
dmHID::PHASE_MOVED |
|
dmHID::PHASE_STATIONARY |
|
dmHID::PHASE_ENDED |
|
dmHID::PHASE_CANCELLED |