Iterate the resolved actions from the most recent binding update. Action storage is private; getters read the iterator's current action. Getters require the last ActionIterateNext call to have returned true. Call only on the engine thread. Iterators and actions are borrowed until the next binding update starts or the context is destroyed. Reloading bindings preserves the completed batch. Iteration is read-only, allocation-free and independent between listeners.
| Namespace: | dmInput |
| Include: | #include <dmsdk/input/input_gen.hpp> |
| TYPES | |
|---|---|
| HContext | input context handle |
| HInputContext | input context handle |
| ENUMS | |
|---|---|
| ActionSource | resolved action source |
| InputActionSource | resolved action source |
| STRUCTS | |
|---|---|
| struct ActionIterator | input action iterator |
| struct InputActionIterator | input action iterator |
bool ActionGetGamepadIndex(const ActionIterator* iterator, uint32_t* out_index)
read the gamepad index
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
uint32_t* |
out_index |
non-null output; unchanged for a non-gamepad action |
RETURNS
bool |
true if the current action belongs to a gamepad |
dmhash_t ActionGetGamepadNameHash(const ActionIterator* iterator)
Hash of the input mapping's device name, retained on disconnect. Identical names have the same hash; use the gamepad index to distinguish devices. The value can be retained; reverse lookup of the name is not guaranteed.
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
dmhash_t |
dmHashString64 of the name, or zero for a non-gamepad action or unavailable name |
dmhash_t ActionGetId(const ActionIterator* iterator)
read the action identifier
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
dmhash_t |
hashed binding name; zero for unnamed pointer or acceleration samples |
ActionSource ActionGetSource(const ActionIterator* iterator)
read the device category
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
ActionSource |
device category, or ACTION_SOURCE_UNKNOWN |
float ActionGetValue(const ActionIterator* iterator)
read the scalar binding value
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
float |
resolved scalar value, including zero on release |
bool ActionIsGamepadConnected(const ActionIterator* iterator)
True only when this action reports a connection transition, not while the device remains connected. Requires a GAMEPAD_CONNECTED input binding.
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
bool |
true for a connection notification; false for other actions |
bool ActionIsGamepadDisconnected(const ActionIterator* iterator)
True only when this action reports a disconnection transition. Requires a GAMEPAD_DISCONNECTED input binding. The gamepad index may later be reused.
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
bool |
true for a disconnection notification; false for other actions |
bool ActionIsPressed(const ActionIterator* iterator)
test the press transition
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
bool |
true if the binding became active this input update |
bool ActionIsReleased(const ActionIterator* iterator)
test the release transition
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
bool |
true if the binding became inactive this input update |
bool ActionIsRepeated(const ActionIterator* iterator)
test binding repeat
PARAMETERS
const ActionIterator* |
iterator |
iterator positioned by a successful ActionIterateNext |
RETURNS
bool |
true if repeat was triggered this input update |
bool ActionIterateNext(ActionIterator* iterator)
A false result invalidates the current action. Further advances remain false.
PARAMETERS
ActionIterator* |
iterator |
iterator initialized by IterateActions |
RETURNS
bool |
true when positioned on an action; false when exhausted or empty |
bool InputActionGetGamepadIndex(const InputActionIterator* iterator, uint32_t* out_index)
read the gamepad index
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
uint32_t* |
out_index |
non-null output; unchanged for a non-gamepad action |
RETURNS
bool |
true if the current action belongs to a gamepad |
dmhash_t InputActionGetGamepadNameHash(const InputActionIterator* iterator)
Hash of the input mapping's device name, retained on disconnect. Identical names have the same hash; use the gamepad index to distinguish devices. The value can be retained; reverse lookup of the name is not guaranteed.
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
dmhash_t |
dmHashString64 of the name, or zero for a non-gamepad action or unavailable name |
dmhash_t InputActionGetId(const InputActionIterator* iterator)
read the action identifier
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
dmhash_t |
hashed binding name; zero for unnamed pointer or acceleration samples |
InputActionSource InputActionGetSource(const InputActionIterator* iterator)
read the device category
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
InputActionSource |
device category, or INPUT_ACTION_SOURCE_UNKNOWN |
float InputActionGetValue(const InputActionIterator* iterator)
read the scalar binding value
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
float |
resolved scalar value, including zero on release |
bool InputActionIsGamepadConnected(const InputActionIterator* iterator)
True only when this action reports a connection transition, not while the device remains connected. Requires a GAMEPAD_CONNECTED input binding.
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
bool |
true for a connection notification; false for other actions |
bool InputActionIsGamepadDisconnected(const InputActionIterator* iterator)
True only when this action reports a disconnection transition. Requires a GAMEPAD_DISCONNECTED input binding. The gamepad index may later be reused.
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
bool |
true for a disconnection notification; false for other actions |
bool InputActionIsPressed(const InputActionIterator* iterator)
test the press transition
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
bool |
true if the binding became active this input update |
bool InputActionIsReleased(const InputActionIterator* iterator)
test the release transition
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
bool |
true if the binding became inactive this input update |
bool InputActionIsRepeated(const InputActionIterator* iterator)
test binding repeat
PARAMETERS
const InputActionIterator* |
iterator |
iterator positioned by a successful InputActionIterateNext |
RETURNS
bool |
true if repeat was triggered this input update |
bool InputActionIterateNext(InputActionIterator* iterator)
A false result invalidates the current action. Further advances remain false.
PARAMETERS
InputActionIterator* |
iterator |
iterator initialized by InputIterateActions |
RETURNS
bool |
true when positioned on an action; false when exhausted or empty |
InputActionIterator InputIterateActions(HInputContext context)
Iterates the latest completed binding update, with text actions last. The iterator starts before the first action. Multiple iterators advance independently. The next binding update invalidates existing iterators and current actions.
PARAMETERS
HInputContext |
context |
live borrowed input context |
RETURNS
InputActionIterator |
cursor positioned before the first action |
ActionIterator IterateActions(HContext context)
Iterates the latest completed binding update, with text actions last. The iterator starts before the first action. Multiple iterators advance independently. The next binding update invalidates existing iterators and current actions.
PARAMETERS
HContext |
context |
live borrowed input context |
RETURNS
ActionIterator |
cursor positioned before the first action |
TYPE
struct ActionIteratorSmall value-type cursor with reserved opaque state. Do not access its members; initialize it with IterateActions and advance with ActionIterateNext. Its ABI occupies two uintptr_t words and requires no allocation or destruction.
TYPE
struct InputActionIteratorSmall value-type cursor with reserved opaque state. Do not access its members; initialize it with InputIterateActions and advance with InputActionIterateNext. Its ABI occupies two uintptr_t words and requires no allocation or destruction.
void HContext()
Borrowed engine-owned input context. Do not destroy it. Actions are empty before the first binding update.
PARAMETERS
void HInputContext()
Borrowed engine-owned input context. Do not destroy it. Actions are empty before the first binding update.
PARAMETERS
resolved action source
ACTION_SOURCE_UNKNOWN |
Unrecognized device category. |
ACTION_SOURCE_KEYBOARD |
Keyboard binding. |
ACTION_SOURCE_TEXT |
Text or marked-text binding. |
ACTION_SOURCE_MOUSE |
Mouse binding or pointer movement. |
ACTION_SOURCE_TOUCH |
Touch binding. |
ACTION_SOURCE_GAMEPAD |
Gamepad binding or connectivity notification. |
ACTION_SOURCE_ACCELEROMETER |
Accelerometer sample. |
resolved action source
INPUT_ACTION_SOURCE_UNKNOWN |
Unrecognized device category. |
INPUT_ACTION_SOURCE_KEYBOARD |
Keyboard binding. |
INPUT_ACTION_SOURCE_TEXT |
Text or marked-text binding. |
INPUT_ACTION_SOURCE_MOUSE |
Mouse binding or pointer movement. |
INPUT_ACTION_SOURCE_TOUCH |
Touch binding. |
INPUT_ACTION_SOURCE_GAMEPAD |
Gamepad binding or connectivity notification. |
INPUT_ACTION_SOURCE_ACCELEROMETER |
Accelerometer sample. |