Input device handling. More...
Classes | |
struct | KzsEventQueueIterator |
Iterator for event queues. More... | |
Macros | |
#define | KZS_POINTING_DEVICE_BUTTON_PRIMARY |
Primary pointer button, e.g. More... | |
#define | KZS_POINTING_DEVICE_BUTTON_SECONDARY |
Secondary pointer button, e.g. More... | |
#define | KZS_POINTING_DEVICE_BUTTON_TERTIARY |
Tertiary pointer button, e.g. More... | |
#define | kzsEventQueueIteratorIterate(it) |
Iterate an event queue iterator. More... | |
#define | kzsEventQueueIteratorGetValue(it) |
Get the current value of an event queue iterator. More... | |
Typedefs | |
typedef kzsError(* | KzsEventHandleFunction) (const struct KzsEventQueue *queue, void *userData) |
Callback function type for event handling. More... | |
Functions | |
KANZI_API kzsError | kzsEventQueueCreate (struct KzsEventQueue **queue_out) |
Creates a new event queue. More... | |
KANZI_API void | kzsEventQueueDelete (struct KzsEventQueue *queue) |
Frees memory allocated for a input event queue. More... | |
KANZI_API struct KzsEventQueueIterator | kzsEventQueueGetIterator (const struct KzsEventQueue *queue) |
Get an iterator over an event queue. More... | |
KANZI_API kzBool | kzsEventQueueIteratorIterate_private (struct KzsEventQueueIterator *it) |
Internal iteration. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueIteratorGetValue_private (const struct KzsEventQueueIterator *it) |
Internal iteration get value. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueGetEvent (const struct KzsEventQueue *queue, kzUint index) |
Get nth event from an event queue. More... | |
KANZI_API kzUint | kzsEventQueueGetEventCount (const struct KzsEventQueue *queue) |
Get the number of events in an event queue. More... | |
KANZI_API void | kzsEventQueueClear (struct KzsEventQueue *queue) |
Clear all events from an event queue. More... | |
KANZI_API void | kzsEventQueueSwap (struct KzsEventQueue *queue1, struct KzsEventQueue *queue2) |
Swap contents of two queues. More... | |
KANZI_API void | kzsEventInvalidate (struct KzsEvent *event) |
Renders an event idempotent. More... | |
KANZI_API struct KzsEvent * | kzsEventCreateKeyEvent (kzUint button, enum KzsInputKeyDeviceState state) |
Creates a new key event with input values. More... | |
KANZI_API void | kzsEventDeleteKeyEvent (struct KzsEvent *event) |
Frees memory allocated for a input event. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddRawEvent (struct KzsEventQueue *queue, const struct KzsEvent *event) |
Adds a new event into the queue. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddKeyEvent (struct KzsEventQueue *queue, kzUint button, enum KzsInputKeyDeviceState state) |
Adds a new key event into the queue with input values. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddPointerEvent (struct KzsEventQueue *queue, kzInt x, kzInt y, kzU32 buttons, kzInt scroll, enum KzsInputPointingDeviceState state) |
Adds a new pointer event into the queue with input values. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddTouchEvent (struct KzsEventQueue *queue, kzUint numCursors) |
Adds a new touch event. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddTouchEventWithState (struct KzsEventQueue *queue, kzUint numCursors, enum KzsInputTouchState state) |
As add touch event, but with a state already set now. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddTouchEventWithDetails (struct KzsEventQueue *queue, enum KzsInputTouchState state, enum KzsInputCursorState cursorState, kzFloat x, kzFloat y) |
As add touch event with details. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddSimpleWindowEvent (struct KzsEventQueue *queue, enum KzsEventType type, struct KzsWindow *window) |
Adds a new window event into the queue. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddWindowResizeEvent (struct KzsEventQueue *queue, struct KzsWindow *window, kzUint width, kzUint height) |
Adds a new window resize event into the queue. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddWindowResizeRequestedEvent (struct KzsEventQueue *queue, struct KzsWindow *window, kzUint width, kzUint height) |
Adds a new window resize request event into the queue. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddWindowOrientationChangeEvent (struct KzsEventQueue *queue, struct KzsWindow *window, enum KzsWindowOrientation orientation) |
Adds a new orientation change event into the queue. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddApplicationPausedEvent (struct KzsEventQueue *queue) |
Adds a new application paused event. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddApplicationSleepEvent (struct KzsEventQueue *queue) |
Adds a new application sleep event. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddApplicationWakeupEvent (struct KzsEventQueue *queue) |
Adds a new application wakeup event. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddToggleHUDDebugEvent (struct KzsEventQueue *queue) |
Adds a new toggle HUD debug event into the queue. More... | |
KANZI_API struct KzsEvent * | kzsEventQueueAddSetHUDDebugEvent (struct KzsEventQueue *queue, kzInt onoff) |
Adds a new set HUD debug event into the queue. More... | |
KANZI_API const struct KzsInputEventPointer * | kzsInputEventGetPointingDeviceData (const struct KzsEvent *event) |
Get the pointer event from an input event. More... | |
KANZI_API const struct KzsInputEventKey * | kzsInputEventGetKeyDeviceData (const struct KzsEvent *event) |
Get key event from an input event. More... | |
KANZI_API const struct KzsInputEventTouch * | kzsInputEventGetTouchData (const struct KzsEvent *event) |
Get touch event from an input event. More... | |
KANZI_API enum KzsEventType | kzsEventGetType (const struct KzsEvent *event) |
Get the event type. More... | |
KANZI_API kzUint | kzsInputCursorGetId (const struct KzsInputCursor *inputdata) |
Get the identifier of the touch cursor. More... | |
KANZI_API kzFloat | kzsInputCursorGetPressure (const struct KzsInputCursor *inputData) |
Gets the pressure of the touch cursor. More... | |
KANZI_API kzFloat | kzsInputCursorGetRadius (const struct KzsInputCursor *inputData) |
Gets the radius of the touch cursor. More... | |
KANZI_API kzFloat | kzsInputCursorGetX (const struct KzsInputCursor *inputData) |
Get the x coordinate of touch cursor. More... | |
KANZI_API kzFloat | kzsInputCursorGetY (const struct KzsInputCursor *inputData) |
Get the y coordinate of touch cursor. More... | |
KANZI_API enum KzsInputCursorState | kzsInputCursorGetState (const struct KzsInputCursor *inputdata) |
Get the state of the touch cursor. More... | |
KANZI_API kzUint | kzsInputEventKeyGetButtonRaw (const struct KzsInputEventKey *inputData) |
Gets the raw button code of the key device. More... | |
KANZI_API enum KzsInputKey | kzsInputEventKeyGetButton (const struct KzsInputEventKey *inputData) |
Gets the translated button of the key device. More... | |
KANZI_API enum KzsInputKeyDeviceState | kzsInputEventKeyGetState (const struct KzsInputEventKey *inputData) |
Gets the state of the key device. More... | |
KANZI_API kzU32 | kzsInputEventPointerGetButtons (const struct KzsInputEventPointer *inputData) |
Gets the bitfield of the buttons of the active pointing device. More... | |
KANZI_API kzInt | kzsInputEventPointerGetScroll (const struct KzsInputEventPointer *inputData) |
Gets the scroll amount of the active pointing device. More... | |
KANZI_API enum KzsInputPointingDeviceState | kzsInputEventPointerGetState (const struct KzsInputEventPointer *inputData) |
Gets the state of the active pointing device. More... | |
KANZI_API kzInt | kzsInputEventPointerGetX (const struct KzsInputEventPointer *inputData) |
Gets the x coordinate of the active pointing device. More... | |
KANZI_API kzInt | kzsInputEventPointerGetY (const struct KzsInputEventPointer *inputData) |
Gets the y coordinate of the active pointing device. More... | |
KANZI_API struct KzsInputCursor * | kzsInputEventTouchGetCursor (const struct KzsInputEventTouch *inputData, kzUint cursorIdx) |
Get the nth cursor form a touch event. More... | |
KANZI_API kzUint | kzsInputEventTouchGetCursorCount (const struct KzsInputEventTouch *inputData) |
Get the number of cursors in this event. More... | |
KANZI_API enum KzsInputTouchState | kzsInputEventTouchGetState (const struct KzsInputEventTouch *inputData) |
Get the touch state. More... | |
KANZI_API kzBool | kzsInputEventTouchSetCursor (struct KzsEventQueue *queue, struct KzsEvent *event, kzUint cursorIndex, kzUint cursorId, kzFloat x, kzFloat y, kzFloat pressure, kzFloat radius, enum KzsInputCursorState state) |
Add a cursor to a touch event. More... | |
KANZI_API void | kzsInputEventTouchSetState (struct KzsEvent *event, enum KzsInputTouchState state) |
Set the state of touch event. More... | |
KANZI_API struct KzsWindow * | kzsWindowEventGetTarget (const struct KzsEvent *event) |
Get the target window of the event. More... | |
KANZI_API kzUint | kzsWindowEventResizeGetWidth (const struct KzsEvent *event) |
Get the window width of a resize event. More... | |
KANZI_API kzUint | kzsWindowEventResizeGetHeight (const struct KzsEvent *event) |
Get the window height of a resize event. More... | |
KANZI_API enum KzsWindowOrientation | kzsWindowEventOrientationChangeGetOrientation (const struct KzsEvent *event) |
Get the window orientation of a orientation change event. More... | |
KANZI_API enum KzsInputKey | kzsInputNativeGetTranslatedKey (kzUint button) |
Returns the translated key. More... | |
KANZI_API const struct KzsDebugEventSetHUD * | kzsEventGetSetHUDData (const struct KzsEvent *event) |
Get set HUD event data from an event. More... | |
KANZI_API kzInt | kzsSetHUDDebugEventGetOnOff (const struct KzsDebugEventSetHUD *inputData) |
Returns set HUD debug event parameter. More... | |
Input device handling.
Keyboards, mice, touch screens, joysticks and similar devices.
Copyright 2008-2017 by Rightware. All rights reserved.
#define KZS_POINTING_DEVICE_BUTTON_PRIMARY |
Primary pointer button, e.g.
usually mouse left on Windows.
#define KZS_POINTING_DEVICE_BUTTON_SECONDARY |
Secondary pointer button, e.g.
usually mouse right on Windows.
#define KZS_POINTING_DEVICE_BUTTON_TERTIARY |
Tertiary pointer button, e.g.
usually mouse middle on Windows.
#define kzsEventQueueIteratorIterate | ( | it | ) |
Iterate an event queue iterator.
Return true if this value is still valid.
#define kzsEventQueueIteratorGetValue | ( | it | ) |
Get the current value of an event queue iterator.
typedef kzsError(* KzsEventHandleFunction) (const struct KzsEventQueue *queue, void *userData) |
Callback function type for event handling.
enum KzsWindowOrientation |
enum KzsEventType |
Enumeration for different types of events.
enum KzsInputTranslation |
Enumeration to select translation of events.
Enumeration for different states for a pointing device.
enum KzsInputCursorState |
enum KzsInputTouchState |
enum KzsInputKey |
Platform independent key enumeration.
Creates a new event queue.
KANZI_API void kzsEventQueueDelete | ( | struct KzsEventQueue * | queue | ) |
Frees memory allocated for a input event queue.
KANZI_API struct KzsEventQueueIterator kzsEventQueueGetIterator | ( | const struct KzsEventQueue * | queue | ) |
Get an iterator over an event queue.
KANZI_API kzBool kzsEventQueueIteratorIterate_private | ( | struct KzsEventQueueIterator * | it | ) |
Internal iteration.
KANZI_API struct KzsEvent* kzsEventQueueIteratorGetValue_private | ( | const struct KzsEventQueueIterator * | it | ) |
Internal iteration get value.
KANZI_API struct KzsEvent* kzsEventQueueGetEvent | ( | const struct KzsEventQueue * | queue, |
kzUint | index | ||
) |
Get nth event from an event queue.
Get the number of events in an event queue.
KANZI_API void kzsEventQueueClear | ( | struct KzsEventQueue * | queue | ) |
Clear all events from an event queue.
KANZI_API void kzsEventQueueSwap | ( | struct KzsEventQueue * | queue1, |
struct KzsEventQueue * | queue2 | ||
) |
Swap contents of two queues.
KANZI_API void kzsEventInvalidate | ( | struct KzsEvent * | event | ) |
Renders an event idempotent.
KANZI_API struct KzsEvent* kzsEventCreateKeyEvent | ( | kzUint | button, |
enum KzsInputKeyDeviceState | state | ||
) |
Creates a new key event with input values.
KANZI_API void kzsEventDeleteKeyEvent | ( | struct KzsEvent * | event | ) |
Frees memory allocated for a input event.
KANZI_API struct KzsEvent* kzsEventQueueAddRawEvent | ( | struct KzsEventQueue * | queue, |
const struct KzsEvent * | event | ||
) |
Adds a new event into the queue.
KANZI_API struct KzsEvent* kzsEventQueueAddKeyEvent | ( | struct KzsEventQueue * | queue, |
kzUint | button, | ||
enum KzsInputKeyDeviceState | state | ||
) |
Adds a new key event into the queue with input values.
KANZI_API struct KzsEvent* kzsEventQueueAddPointerEvent | ( | struct KzsEventQueue * | queue, |
kzInt | x, | ||
kzInt | y, | ||
kzU32 | buttons, | ||
kzInt | scroll, | ||
enum KzsInputPointingDeviceState | state | ||
) |
Adds a new pointer event into the queue with input values.
If translating to touch events, add a touch event with one cursor instead.
KANZI_API struct KzsEvent* kzsEventQueueAddTouchEvent | ( | struct KzsEventQueue * | queue, |
kzUint | numCursors | ||
) |
Adds a new touch event.
The touch event generated will have a specified number of cursors. The cursors must be filled separately to the event structure returned from this function.
KANZI_API struct KzsEvent* kzsEventQueueAddTouchEventWithState | ( | struct KzsEventQueue * | queue, |
kzUint | numCursors, | ||
enum KzsInputTouchState | state | ||
) |
As add touch event, but with a state already set now.
KANZI_API struct KzsEvent* kzsEventQueueAddTouchEventWithDetails | ( | struct KzsEventQueue * | queue, |
enum KzsInputTouchState | state, | ||
enum KzsInputCursorState | cursorState, | ||
kzFloat | x, | ||
kzFloat | y | ||
) |
As add touch event with details.
Useful in testing.
KANZI_API struct KzsEvent* kzsEventQueueAddSimpleWindowEvent | ( | struct KzsEventQueue * | queue, |
enum KzsEventType | type, | ||
struct KzsWindow * | window | ||
) |
Adds a new window event into the queue.
KANZI_API struct KzsEvent* kzsEventQueueAddWindowResizeEvent | ( | struct KzsEventQueue * | queue, |
struct KzsWindow * | window, | ||
kzUint | width, | ||
kzUint | height | ||
) |
Adds a new window resize event into the queue.
KANZI_API struct KzsEvent* kzsEventQueueAddWindowResizeRequestedEvent | ( | struct KzsEventQueue * | queue, |
struct KzsWindow * | window, | ||
kzUint | width, | ||
kzUint | height | ||
) |
Adds a new window resize request event into the queue.
KANZI_API struct KzsEvent* kzsEventQueueAddWindowOrientationChangeEvent | ( | struct KzsEventQueue * | queue, |
struct KzsWindow * | window, | ||
enum KzsWindowOrientation | orientation | ||
) |
Adds a new orientation change event into the queue.
KANZI_API struct KzsEvent* kzsEventQueueAddApplicationPausedEvent | ( | struct KzsEventQueue * | queue | ) |
Adds a new application paused event.
KANZI_API struct KzsEvent* kzsEventQueueAddApplicationSleepEvent | ( | struct KzsEventQueue * | queue | ) |
Adds a new application sleep event.
KANZI_API struct KzsEvent* kzsEventQueueAddApplicationWakeupEvent | ( | struct KzsEventQueue * | queue | ) |
Adds a new application wakeup event.
KANZI_API struct KzsEvent* kzsEventQueueAddToggleHUDDebugEvent | ( | struct KzsEventQueue * | queue | ) |
Adds a new toggle HUD debug event into the queue.
KANZI_API struct KzsEvent* kzsEventQueueAddSetHUDDebugEvent | ( | struct KzsEventQueue * | queue, |
kzInt | onoff | ||
) |
Adds a new set HUD debug event into the queue.
KANZI_API const struct KzsInputEventPointer* kzsInputEventGetPointingDeviceData | ( | const struct KzsEvent * | event | ) |
Get the pointer event from an input event.
KANZI_API const struct KzsInputEventKey* kzsInputEventGetKeyDeviceData | ( | const struct KzsEvent * | event | ) |
Get key event from an input event.
KANZI_API const struct KzsInputEventTouch* kzsInputEventGetTouchData | ( | const struct KzsEvent * | event | ) |
Get touch event from an input event.
KANZI_API enum KzsEventType kzsEventGetType | ( | const struct KzsEvent * | event | ) |
Get the event type.
Get the identifier of the touch cursor.
Gets the pressure of the touch cursor.
Gets the radius of the touch cursor.
Get the x coordinate of touch cursor.
Get the y coordinate of touch cursor.
KANZI_API enum KzsInputCursorState kzsInputCursorGetState | ( | const struct KzsInputCursor * | inputdata | ) |
Get the state of the touch cursor.
Gets the raw button code of the key device.
KANZI_API enum KzsInputKey kzsInputEventKeyGetButton | ( | const struct KzsInputEventKey * | inputData | ) |
Gets the translated button of the key device.
KANZI_API enum KzsInputKeyDeviceState kzsInputEventKeyGetState | ( | const struct KzsInputEventKey * | inputData | ) |
Gets the state of the key device.
Gets the bitfield of the buttons of the active pointing device.
inputData | Input data pointer. |
Gets the scroll amount of the active pointing device.
KANZI_API enum KzsInputPointingDeviceState kzsInputEventPointerGetState | ( | const struct KzsInputEventPointer * | inputData | ) |
Gets the state of the active pointing device.
Gets the x coordinate of the active pointing device.
Gets the y coordinate of the active pointing device.
KANZI_API struct KzsInputCursor* kzsInputEventTouchGetCursor | ( | const struct KzsInputEventTouch * | inputData, |
kzUint | cursorIdx | ||
) |
Get the nth cursor form a touch event.
Get the number of cursors in this event.
KANZI_API enum KzsInputTouchState kzsInputEventTouchGetState | ( | const struct KzsInputEventTouch * | inputData | ) |
Get the touch state.
Note that touch state goes DOWN when the first finger touches the screen and UP when the last finger leaves. Everything in-between is drag.
KANZI_API kzBool kzsInputEventTouchSetCursor | ( | struct KzsEventQueue * | queue, |
struct KzsEvent * | event, | ||
kzUint | cursorIndex, | ||
kzUint | cursorId, | ||
kzFloat | x, | ||
kzFloat | y, | ||
kzFloat | pressure, | ||
kzFloat | radius, | ||
enum KzsInputCursorState | state | ||
) |
Add a cursor to a touch event.
The queue is needed for potential mirroring of the event.
Returns true if there was space for the cursor, false otherwise.
If translating pointer events, add a pointer event instead and mark the touch event as unusable.
If the event is not a touch event, do nothing unless translating.
KANZI_API void kzsInputEventTouchSetState | ( | struct KzsEvent * | event, |
enum KzsInputTouchState | state | ||
) |
Set the state of touch event.
This function takes a generic event structure for consistency.
If the event is not a touch event, do nothing.
Get the target window of the event.
Get the window width of a resize event.
Get the window height of a resize event.
KANZI_API enum KzsWindowOrientation kzsWindowEventOrientationChangeGetOrientation | ( | const struct KzsEvent * | event | ) |
Get the window orientation of a orientation change event.
KANZI_API enum KzsInputKey kzsInputNativeGetTranslatedKey | ( | kzUint | button | ) |
Returns the translated key.
KANZI_API const struct KzsDebugEventSetHUD* kzsEventGetSetHUDData | ( | const struct KzsEvent * | event | ) |
Get set HUD event data from an event.