Skip to content
modkitv0.2

input.h

#include <modkit/input.h>138 functions · 7 structs · 11 enums · 21 typedefs · 10 macros

Input abstraction for keyboard, mouse, touch, and gamepad.

Provides three layers of input handling:Raw state polling (keyboard, mouse, touch, gamepad)State tracking (pressed, released, held)Action mapping (configurable named actions) Example:

Functions

mk_action_atfunction

mk_action mk_action_at(uint32_t index)

Get action handle by zero-based index, or MK_ACTION_INVALID if out of range.

ParameterTypeDescription
indexuint32_tZero-based index.

Returns The resulting value.

mk_action_axis1function

float mk_action_axis1(mk_action negative, mk_action positive)

Axis helpers.

axis1 returns positive minus negative. axis2 returns x = positive_x - negative_x, y = positive_y - negative_y.

ParameterTypeDescription
negativemk_actionValue for negative.
positivemk_actionValue for positive.

Returns The resulting value.

mk_action_axis2function

void mk_action_axis2(mk_action negative_x, mk_action positive_x, mk_action negative_y, mk_action positive_y, float *x, float *y)

Perform the action axis2 operation.

ParameterTypeDescription
negative_xmk_actionValue for negative x.
positive_xmk_actionValue for positive x.
negative_ymk_actionValue for negative y.
positive_ymk_actionValue for positive y.
xfloat *Value for x.
yfloat *Value for y.

mk_action_bind_gamepad_axisfunction

void mk_action_bind_gamepad_axis(mk_action action, mk_gamepad_axis gaxis, float threshold)

Bind a gamepad axis to an action.

The action becomes active when the axis exceeds the threshold. Use negative threshold for negative axis direction (e.g., -0.5 for left on stick).

ParameterTypeDescription
actionmk_actionValue for action.
gaxismk_gamepad_axisValue for gaxis.
thresholdfloatValue for threshold.

mk_action_bind_gamepad_axis_forfunction

void mk_action_bind_gamepad_axis_for(mk_action action, int gamepad, mk_gamepad_axis gaxis, float threshold)

Bind gamepad axis for for the action.

ParameterTypeDescription
actionmk_actionValue for action.
gamepadintValue for gamepad.
gaxismk_gamepad_axisValue for gaxis.
thresholdfloatValue for threshold.

mk_action_bind_gamepad_axis_valuefunction

void mk_action_bind_gamepad_axis_value(mk_action action, mk_gamepad_axis gaxis, float deadzone, float scale)

Bind gamepad axis value for the action.

ParameterTypeDescription
actionmk_actionValue for action.
gaxismk_gamepad_axisValue for gaxis.
deadzonefloatValue for deadzone.
scalefloatValue for scale.

mk_action_bind_gamepad_axis_value_forfunction

void mk_action_bind_gamepad_axis_value_for(mk_action action, int gamepad, mk_gamepad_axis gaxis, float deadzone, float scale)

Bind gamepad axis value for for the action.

ParameterTypeDescription
actionmk_actionValue for action.
gamepadintValue for gamepad.
gaxismk_gamepad_axisValue for gaxis.
deadzonefloatValue for deadzone.
scalefloatValue for scale.

mk_action_bind_gamepad_buttonfunction

void mk_action_bind_gamepad_button(mk_action action, mk_gamepad_button button)

Bind a gamepad button to an action.

Binds for all gamepads (any connected gamepad can trigger the action).

ParameterTypeDescription
actionmk_actionValue for action.
buttonmk_gamepad_buttonValue for button.

mk_action_bind_gamepad_button_forfunction

void mk_action_bind_gamepad_button_for(mk_action action, int gamepad, mk_gamepad_button button)

Gamepad-specific convenience bindings on the default action map.

ParameterTypeDescription
actionmk_actionValue for action.
gamepadintValue for gamepad.
buttonmk_gamepad_buttonValue for button.

mk_action_bind_keyfunction

void mk_action_bind_key(mk_action action, mk_keycode key)

Bind a keyboard key to an action.

Multiple keys can be bound to the same action.

ParameterTypeDescription
actionmk_actionValue for action.
keymk_keycodeValue for key.

mk_action_bind_mousefunction

void mk_action_bind_mouse(mk_action action, mk_mouse_button button)

Bind a mouse button to an action.

ParameterTypeDescription
actionmk_actionValue for action.
buttonmk_mouse_buttonValue for button.

mk_action_bind_touch_regionfunction

void mk_action_bind_touch_region(mk_action action, mk_rectf region)

Bind a touch region to an action.

Region is in normalized coordinates (0-1), where (0,0) is top-left.

ParameterTypeDescription
actionmk_actionValue for action.
regionmk_rectfValue for region.

mk_action_countfunction

uint32_t mk_action_count(void)

Get number of registered actions.

Returns The resulting value.

mk_action_default_mapfunction

mk_action_map mk_action_default_map(void)

Get the built-in default action map used by the legacy mk_action_bind_* APIs.

Returns The resulting value.

mk_action_downfunction

bool mk_action_down(mk_action action)

Check if an action is currently active (any bound input is down).

ParameterTypeDescription
actionmk_actionValue for action.

Returns True when the operation succeeds.

mk_action_down_for_gamepadfunction

bool mk_action_down_for_gamepad(mk_action action, int gamepad)

Query only gamepad bindings for a specific pad/player.

ParameterTypeDescription
actionmk_actionValue for action.
gamepadintValue for gamepad.

Returns True when the operation succeeds.

mk_action_findfunction

mk_action mk_action_find(const char *name)

Find an action by name.

Returns MK_ACTION_INVALID if not found.

ParameterTypeDescription
nameconst char *Stable name.

Returns The resulting value.

mk_action_map_activefunction

bool mk_action_map_active(mk_action_map map)

Perform the action map active operation.

ParameterTypeDescription
mapmk_action_mapValue for map.

Returns True when the operation succeeds.

mk_action_map_atfunction

mk_action_map mk_action_map_at(uint32_t index)

Perform the action map at operation.

ParameterTypeDescription
indexuint32_tZero-based index.

Returns The resulting value.

mk_action_map_axis1function

float mk_action_map_axis1(mk_action_map map, mk_action negative, mk_action positive)

Perform the action map axis1 operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
negativemk_actionValue for negative.
positivemk_actionValue for positive.

Returns The resulting value.

mk_action_map_axis2function

void mk_action_map_axis2(mk_action_map map, mk_action negative_x, mk_action positive_x, mk_action negative_y, mk_action positive_y, float *x, float *y)

Perform the action map axis2 operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
negative_xmk_actionValue for negative x.
positive_xmk_actionValue for positive x.
negative_ymk_actionValue for negative y.
positive_ymk_actionValue for positive y.
xfloat *Value for x.
yfloat *Value for y.

mk_action_map_bindfunction

bool mk_action_map_bind(mk_action_map map, mk_action action, const mk_action_binding *binding)

Bind/unbind action-map inputs.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
bindingconst mk_action_binding *Value for binding.

Returns True when the operation succeeds.

mk_action_map_bind_gamepad_axisfunction

bool mk_action_map_bind_gamepad_axis(mk_action_map map, mk_action action, mk_gamepad_axis gaxis, float threshold)

Bind gamepad axis for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
gaxismk_gamepad_axisValue for gaxis.
thresholdfloatValue for threshold.

Returns True when the operation succeeds.

mk_action_map_bind_gamepad_axis_forfunction

bool mk_action_map_bind_gamepad_axis_for(mk_action_map map, mk_action action, int gamepad, mk_gamepad_axis gaxis, float threshold)

Bind gamepad axis for for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
gamepadintValue for gamepad.
gaxismk_gamepad_axisValue for gaxis.
thresholdfloatValue for threshold.

Returns True when the condition holds.

mk_action_map_bind_gamepad_axis_valuefunction

bool mk_action_map_bind_gamepad_axis_value(mk_action_map map, mk_action action, mk_gamepad_axis gaxis, float deadzone, float scale)

Bind gamepad axis value for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
gaxismk_gamepad_axisValue for gaxis.
deadzonefloatValue for deadzone.
scalefloatValue for scale.

Returns True when the condition holds.

mk_action_map_bind_gamepad_axis_value_forfunction

bool mk_action_map_bind_gamepad_axis_value_for(mk_action_map map, mk_action action, int gamepad, mk_gamepad_axis gaxis, float deadzone, float scale)

Bind gamepad axis value for for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
gamepadintValue for gamepad.
gaxismk_gamepad_axisValue for gaxis.
deadzonefloatValue for deadzone.
scalefloatValue for scale.

Returns True when the condition holds.

mk_action_map_bind_gamepad_buttonfunction

bool mk_action_map_bind_gamepad_button(mk_action_map map, mk_action action, mk_gamepad_button button)

Bind gamepad button for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
buttonmk_gamepad_buttonValue for button.

Returns True when the operation succeeds.

mk_action_map_bind_gamepad_button_forfunction

bool mk_action_map_bind_gamepad_button_for(mk_action_map map, mk_action action, int gamepad, mk_gamepad_button button)

Bind gamepad button for for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
gamepadintValue for gamepad.
buttonmk_gamepad_buttonValue for button.

Returns True when the operation succeeds.

mk_action_map_bind_keyfunction

bool mk_action_map_bind_key(mk_action_map map, mk_action action, mk_keycode key)

Bind key for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
keymk_keycodeValue for key.

Returns True when the operation succeeds.

mk_action_map_bind_mousefunction

bool mk_action_map_bind_mouse(mk_action_map map, mk_action action, mk_mouse_button button)

Bind mouse for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
buttonmk_mouse_buttonValue for button.

Returns True when the operation succeeds.

mk_action_map_bind_touch_regionfunction

bool mk_action_map_bind_touch_region(mk_action_map map, mk_action action, mk_rectf region)

Bind touch region for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
regionmk_rectfValue for region.

Returns True when the operation succeeds.

mk_action_map_binding_atfunction

bool mk_action_map_binding_at(mk_action_map map, mk_action action, uint32_t index, mk_action_binding *out_binding)

Perform the action map binding at operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
indexuint32_tZero-based index.
out_bindingmk_action_binding *Receives the binding.

Returns True when the operation succeeds.

mk_action_map_binding_countfunction

uint32_t mk_action_map_binding_count(mk_action_map map, mk_action action)

Enumerate bindings for rebinding UIs or app-level serialization.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.

Returns The resulting value.

mk_action_map_consumes_inputfunction

bool mk_action_map_consumes_input(mk_action_map map)

Perform the action map consumes input operation.

ParameterTypeDescription
mapmk_action_mapValue for map.

Returns True when the operation succeeds.

mk_action_map_countfunction

uint32_t mk_action_map_count(void)

Enumerate action maps.

Returns The resulting value.

mk_action_map_createfunction

mk_action_map mk_action_map_create(const char *name)

Create/find/destroy named action maps.

Creating a map with an existing name returns the existing handle.

ParameterTypeDescription
nameconst char *Stable name.

Returns The resulting value.

mk_action_map_destroyfunction

void mk_action_map_destroy(mk_action_map map)

Destroy the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.

mk_action_map_downfunction

bool mk_action_map_down(mk_action_map map, mk_action action)

Explicit map queries ignore stack consumption and priority.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.

Returns True when the operation succeeds.

mk_action_map_down_for_gamepadfunction

bool mk_action_map_down_for_gamepad(mk_action_map map, mk_action action, int gamepad)

Perform the action map down for gamepad operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
gamepadintValue for gamepad.

Returns True when the operation succeeds.

mk_action_map_findfunction

mk_action_map mk_action_map_find(const char *name)

Find action map.

ParameterTypeDescription
nameconst char *Stable name.

Returns The resulting value.

mk_action_map_namefunction

const char * mk_action_map_name(mk_action_map map)

Perform the action map name operation.

ParameterTypeDescription
mapmk_action_mapValue for map.

Returns A borrowed pointer, or NULL when unavailable.

mk_action_map_pressedfunction

bool mk_action_map_pressed(mk_action_map map, mk_action action)

Perform the action map pressed operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.

Returns True when the operation succeeds.

mk_action_map_priorityfunction

int mk_action_map_priority(mk_action_map map)

Perform the action map priority operation.

ParameterTypeDescription
mapmk_action_mapValue for map.

Returns The resulting value.

mk_action_map_releasedfunction

bool mk_action_map_released(mk_action_map map, mk_action action)

Perform the action map released operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.

Returns True when the operation succeeds.

mk_action_map_set_activefunction

void mk_action_map_set_active(mk_action_map map, bool active)

Configure map participation in stack-aware global action queries.

ParameterTypeDescription
mapmk_action_mapValue for map.
activeboolValue for active.

mk_action_map_set_consumes_inputfunction

void mk_action_map_set_consumes_input(mk_action_map map, bool consumes_input)

Set consumes input on the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
consumes_inputboolValue for consumes input.

mk_action_map_set_priorityfunction

void mk_action_map_set_priority(mk_action_map map, int priority)

Set priority on the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
priorityintValue for priority.

mk_action_map_unbindfunction

bool mk_action_map_unbind(mk_action_map map, mk_action action, const mk_action_binding *binding)

Unbind action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
bindingconst mk_action_binding *Value for binding.

Returns True when the operation succeeds.

mk_action_map_unbind_allfunction

void mk_action_map_unbind_all(mk_action_map map, mk_action action)

Unbind all for the action map.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.

mk_action_map_valuefunction

float mk_action_map_value(mk_action_map map, mk_action action)

Perform the action map value operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.

Returns The resulting value.

mk_action_map_value_for_gamepadfunction

float mk_action_map_value_for_gamepad(mk_action_map map, mk_action action, int gamepad)

Perform the action map value for gamepad operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
actionmk_actionValue for action.
gamepadintValue for gamepad.

Returns The resulting value.

mk_action_map_value2function

void mk_action_map_value2(mk_action_map map, mk_action x_action, mk_action y_action, float *x, float *y)

Perform the action map value2 operation.

ParameterTypeDescription
mapmk_action_mapValue for map.
x_actionmk_actionValue for x action.
y_actionmk_actionValue for y action.
xfloat *Value for x.
yfloat *Value for y.

mk_action_namefunction

const char * mk_action_name(mk_action action)

Get action name.

Returns NULL if action is invalid.

ParameterTypeDescription
actionmk_actionValue for action.

Returns A borrowed pointer, or NULL when unavailable.

mk_action_pressedfunction

bool mk_action_pressed(mk_action action)

Check if an action was just activated this frame.

ParameterTypeDescription
actionmk_actionValue for action.

Returns True when the operation succeeds.

mk_action_registerfunction

mk_action mk_action_register(const char *name)

Register a named action.

Returns the action handle, or MK_ACTION_INVALID if max actions reached. If an action with the same name exists, returns the existing handle.

ParameterTypeDescription
nameconst char *Stable name.

Returns The resulting value.

mk_action_releasedfunction

bool mk_action_released(mk_action action)

Check if an action was just deactivated this frame.

ParameterTypeDescription
actionmk_actionValue for action.

Returns True when the operation succeeds.

mk_action_unbind_allfunction

void mk_action_unbind_all(mk_action action)

Unbind all inputs from an action.

ParameterTypeDescription
actionmk_actionValue for action.

mk_action_unbind_gamepad_buttonfunction

void mk_action_unbind_gamepad_button(mk_action action, mk_gamepad_button button)

Unbind a specific gamepad button from an action.

ParameterTypeDescription
actionmk_actionValue for action.
buttonmk_gamepad_buttonValue for button.

mk_action_unbind_keyfunction

void mk_action_unbind_key(mk_action action, mk_keycode key)

Unbind a specific key from an action.

ParameterTypeDescription
actionmk_actionValue for action.
keymk_keycodeValue for key.

mk_action_unbind_mousefunction

void mk_action_unbind_mouse(mk_action action, mk_mouse_button button)

Unbind a specific mouse button from an action.

ParameterTypeDescription
actionmk_actionValue for action.
buttonmk_mouse_buttonValue for button.

mk_action_valuefunction

float mk_action_value(mk_action action)

Get action value (0.0 or 1.0 for digital inputs).

Useful for future analog input support.

ParameterTypeDescription
actionmk_actionValue for action.

Returns The resulting value.

mk_action_value_for_gamepadfunction

float mk_action_value_for_gamepad(mk_action action, int gamepad)

Perform the action value for gamepad operation.

ParameterTypeDescription
actionmk_actionValue for action.
gamepadintValue for gamepad.

Returns The resulting value.

mk_action_value2function

void mk_action_value2(mk_action x_action, mk_action y_action, float *x, float *y)

Perform the action value2 operation.

ParameterTypeDescription
x_actionmk_actionValue for x action.
y_actionmk_actionValue for y action.
xfloat *Value for x.
yfloat *Value for y.

mk_clipboard_clearfunction

bool mk_clipboard_clear(void)

Clear the clipboard.

Returns True when the operation succeeds.

mk_clipboard_get_datafunction

const void * mk_clipboard_get_data(const char *mime_type, size_t *size)

Return clipboard bytes owned by modkit.

The pointer remains valid until the next clipboard data/count/mutation call or input shutdown.

ParameterTypeDescription
mime_typeconst char *Value for mime type.
sizesize_t *Size in bytes.

Returns A borrowed pointer, or NULL when unavailable.

mk_clipboard_get_textfunction

const char * mk_clipboard_get_text(void)

Get text from the system clipboard.

Returns NULL if clipboard is empty or doesn't contain text. The returned string is owned by modkit and valid until the next call to mk_clipboard_get_text() or mk_clipboard_set_text(). Platform notes:Linux: Uses X11/Wayland clipboard via SDL3Windows: Uses Windows clipboard API via SDL3macOS: Uses NSPasteboard via SDL3Web: Uses JavaScript Clipboard API (async, may require user gesture)iOS/Android: Uses system clipboard via SDL3

Returns A borrowed pointer, or NULL when unavailable.

mk_clipboard_has_datafunction

bool mk_clipboard_has_data(const char *mime_type)

Test whether the clipboard has data.

ParameterTypeDescription
mime_typeconst char *Value for mime type.

Returns True when the condition holds.

mk_clipboard_has_textfunction

bool mk_clipboard_has_text(void)

Check if the system clipboard contains text.

Returns True when the condition holds.

mk_clipboard_mime_countfunction

uint32_t mk_clipboard_mime_count(void)

Refresh and return the number of MIME types currently advertised.

Returns The resulting value.

mk_clipboard_mime_typefunction

const char * mk_clipboard_mime_type(uint32_t index)

MIME strings remain valid until the next clipboard data/count/mutation call.

ParameterTypeDescription
indexuint32_tZero-based index.

Returns A borrowed pointer, or NULL when unavailable.

mk_clipboard_set_itemsfunction

mk_result mk_clipboard_set_items(const mk_clipboard_item_t *items, uint32_t item_count)

Replace the clipboard with one or more MIME representations.

ParameterTypeDescription
itemsconst mk_clipboard_item_t *Value for items.
item_countuint32_tNumber of item entries.

Returns MK_SUCCESS or an error result.

mk_clipboard_set_textfunction

bool mk_clipboard_set_text(const char *text)

Set text to the system clipboard.

Platform notes:Web: May require user gesture (click) due to browser security

ParameterTypeDescription
textconst char *UTF-8 encoded text to copy (NULL clears clipboard)

Returns true on success, false on failure

mk_cursor_createfunction

mk_cursor_t mk_cursor_create(const void *rgba_pixels, int width, int height, int hot_x, int hot_y)

Create a custom cursor from a 32-bit RGBA pixel buffer (8 bits/channel, row-major, top-left origin, no padding).

(hot_x, hot_y) is the click point in pixels. Returns NULL on failure. Destroy with mk_cursor_destroy().

ParameterTypeDescription
rgba_pixelsconst void *Value for RGBA pixels.
widthintValue for width.
heightintValue for height.
hot_xintValue for hot x.
hot_yintValue for hot y.

Returns The resulting handle or value.

mk_cursor_destroyfunction

void mk_cursor_destroy(mk_cursor_t cursor)

Destroy a custom cursor created by mk_cursor_create().

ParameterTypeDescription
cursormk_cursor_tValue for cursor.

mk_cursor_resetfunction

void mk_cursor_reset(void)

Restore the default system arrow cursor.

mk_cursor_setfunction

void mk_cursor_set(mk_cursor_t cursor)

Set the active cursor to a previously created custom cursor.

ParameterTypeDescription
cursormk_cursor_tValue for cursor.

mk_cursor_set_shapefunction

void mk_cursor_set_shape(mk_cursor_shape shape)

Set the active cursor to a standard system shape.

System cursors are created lazily and cached for the process lifetime.

ParameterTypeDescription
shapemk_cursor_shapeValue for shape.

mk_dropped_filefunction

const char * mk_dropped_file(int index)

Path (UTF-8) of the i-th file dropped this frame, or NULL if out of range.

The returned pointer is owned by modkit and valid until the next frame.

ParameterTypeDescription
indexintZero-based index.

Returns A borrowed pointer, or NULL when unavailable.

mk_dropped_file_countfunction

int mk_dropped_file_count(void)

Number of files dropped onto the window during the current frame.

Resets at the start of every frame; query it inside your frame callback.

Returns The resulting value.

mk_gamepad_button_namefunction

const char * mk_gamepad_button_name(mk_gamepad_button button)

Get name of a gamepad button (for debugging/display).

ParameterTypeDescription
buttonmk_gamepad_buttonValue for button.

Returns A borrowed pointer, or NULL when unavailable.

mk_gamepad_connectedfunction

bool mk_gamepad_connected(int index)

Check if a gamepad is connected.

ParameterTypeDescription
indexintZero-based index.

Returns True when the operation succeeds.

mk_gamepad_countfunction

int mk_gamepad_count(void)

Get number of connected gamepads.

Returns The resulting value.

mk_gamepad_downfunction

bool mk_gamepad_down(int index, mk_gamepad_button button)

Check if a gamepad button is currently held down.

ParameterTypeDescription
indexintZero-based index.
buttonmk_gamepad_buttonValue for button.

Returns True when the operation succeeds.

mk_gamepad_getfunction

mk_gamepad mk_gamepad_get(int index)

Get gamepad info by index (0 to MK_MAX_GAMEPADS-1).

Returns info struct; check 'connected' field.

ParameterTypeDescription
indexintZero-based index.

Returns The resulting value.

mk_gamepad_get_axisfunction

float mk_gamepad_get_axis(int index, mk_gamepad_axis axis)

Get gamepad axis value.

Sticks return -1 to +1, triggers return 0 to +1.

ParameterTypeDescription
indexintZero-based index.
axismk_gamepad_axisValue for axis.

Returns The resulting value.

mk_gamepad_get_axis_deadzonefunction

float mk_gamepad_get_axis_deadzone(int index, mk_gamepad_axis axis, float deadzone)

Get deadzone-adjusted axis value.

Values within deadzone return 0, outside are scaled from deadzone to 1.

ParameterTypeDescription
indexintZero-based index.
axismk_gamepad_axisValue for axis.
deadzonefloatValue for deadzone.

Returns The resulting value.

mk_gamepad_get_axis_namefunction

const char * mk_gamepad_get_axis_name(mk_gamepad_axis axis)

Get name of a gamepad axis (for debugging/display).

ParameterTypeDescription
axismk_gamepad_axisValue for axis.

Returns A borrowed pointer, or NULL when unavailable.

mk_gamepad_namefunction

const char * mk_gamepad_name(int index)

Get gamepad name (NULL if not connected).

ParameterTypeDescription
indexintZero-based index.

Returns A borrowed pointer, or NULL when unavailable.

mk_gamepad_pressedfunction

bool mk_gamepad_pressed(int index, mk_gamepad_button button)

Check if a gamepad button was just pressed this frame.

ParameterTypeDescription
indexintZero-based index.
buttonmk_gamepad_buttonValue for button.

Returns True when the operation succeeds.

mk_gamepad_releasedfunction

bool mk_gamepad_released(int index, mk_gamepad_button button)

Check if a gamepad button was just released this frame.

ParameterTypeDescription
indexintZero-based index.
buttonmk_gamepad_buttonValue for button.

Returns True when the operation succeeds.

mk_gamepad_rumblefunction

void mk_gamepad_rumble(int index, float low_freq, float high_freq, uint32_t duration_ms)

Set gamepad rumble/vibration.

Both intensities are 0.0 (off) to 1.0 (max). Duration is in milliseconds (0 = infinite until stopped).

ParameterTypeDescription
indexintZero-based index.
low_freqfloatValue for low freq.
high_freqfloatValue for high freq.
duration_msuint32_tValue for duration ms.

mk_input_begin_framefunction

void mk_input_begin_frame(void)

Begin frame - reset per-frame states.

Must be called before processing events.

mk_input_defer_callbackfunction

void mk_input_defer_callback(bool defer)

Perform the input defer callback operation.

ParameterTypeDescription
deferboolValue for defer.

mk_input_flush_callbackfunction

void mk_input_flush_callback(bool deliver)

Flush the callback for the input.

ParameterTypeDescription
deliverboolValue for deliver.

mk_input_initfunction

void mk_input_init(void)

Initialize input system.

Called once at startup.

mk_input_inject_gamepad_axisfunction

void mk_input_inject_gamepad_axis(int pad, mk_gamepad_axis axis, float value)

Inject a virtual gamepad axis value.

Used by the remote control system to simulate gamepad input. Auto-connects a "Remote Gamepad" if the slot is empty.

ParameterTypeDescription
padintValue for pad.
axismk_gamepad_axisValue for axis.
valuefloatValue to use.

mk_input_inject_gamepad_buttonfunction

void mk_input_inject_gamepad_button(int pad, mk_gamepad_button button, bool pressed)

Inject a virtual gamepad button press/release.

Used by the remote control system to simulate gamepad input (SDL events require real device handles, so we inject directly). Auto-connects a "Remote Gamepad" if the slot is empty.

ParameterTypeDescription
padintValue for pad.
buttonmk_gamepad_buttonValue for button.
pressedboolValue for pressed.

mk_input_process_eventfunction

void mk_input_process_event(const union SDL_Event *event)

Perform the input process event operation.

ParameterTypeDescription
eventconst union SDL_Event *Value for event.

mk_input_set_callbackfunction

void mk_input_set_callback(void(*callback)(const mk_input_event *, void *), void *user_data)

Set input callback.

Called by platform.c from mk_app_desc.

ParameterTypeDescription
callbackvoid(*)(const mk_input_event *, void *)Completion callback.
user_datavoid *Caller-provided context.

mk_input_shutdownfunction

void mk_input_shutdown(void)

Shutdown input system.

Called once at cleanup.

mk_key_downfunction

bool mk_key_down(mk_keycode key)

Check if a key is currently held down.

ParameterTypeDescription
keymk_keycodeValue for key.

Returns True when the operation succeeds.

mk_key_last_pressedfunction

mk_keycode mk_key_last_pressed(void)

Get the last key that was pressed this frame.

Returns MK_KEY_UNKNOWN if no key was pressed.

Returns The resulting value.

mk_key_mod_altfunction

bool mk_key_mod_alt(void)

Check if Alt modifier is held (either left or right).

Returns True when the operation succeeds.

mk_key_mod_ctrlfunction

bool mk_key_mod_ctrl(void)

Check if Ctrl modifier is held (either left or right).

Returns True when the operation succeeds.

mk_key_mod_shiftfunction

bool mk_key_mod_shift(void)

Check if Shift modifier is held (either left or right).

Returns True when the operation succeeds.

mk_key_mod_superfunction

bool mk_key_mod_super(void)

Check if Super modifier is held (Cmd on Mac, Win on Windows).

Returns True when the operation succeeds.

mk_key_namefunction

const char * mk_key_name(mk_keycode key)

Get the name of a key code (for debugging/display).

Returns "UNKNOWN" for invalid keys.

ParameterTypeDescription
keymk_keycodeValue for key.

Returns A borrowed pointer, or NULL when unavailable.

mk_key_pressedfunction

bool mk_key_pressed(mk_keycode key)

Check if a key was just pressed this frame.

ParameterTypeDescription
keymk_keycodeValue for key.

Returns True when the operation succeeds.

mk_key_releasedfunction

bool mk_key_released(mk_keycode key)

Check if a key was just released this frame.

ParameterTypeDescription
keymk_keycodeValue for key.

Returns True when the operation succeeds.

mk_mouse_deltafunction

void mk_mouse_delta(float *dx, float *dy)

Get mouse movement since last frame.

ParameterTypeDescription
dxfloat *Value for dx.
dyfloat *Value for dy.

mk_mouse_downfunction

bool mk_mouse_down(mk_mouse_button button)

Check if a mouse button is currently held down.

ParameterTypeDescription
buttonmk_mouse_buttonValue for button.

Returns True when the operation succeeds.

mk_mouse_is_capturedfunction

bool mk_mouse_is_captured(void)

Check if mouse is currently captured.

Returns True when the condition holds.

mk_mouse_is_visiblefunction

bool mk_mouse_is_visible(void)

Check if mouse cursor is visible.

Returns True when the condition holds.

mk_mouse_positionfunction

void mk_mouse_position(float *x, float *y)

Get current mouse position in window coordinates (pixels).

Origin is top-left of the window.

ParameterTypeDescription
xfloat *Value for x.
yfloat *Value for y.

mk_mouse_pressedfunction

bool mk_mouse_pressed(mk_mouse_button button)

Check if a mouse button was just pressed this frame.

ParameterTypeDescription
buttonmk_mouse_buttonValue for button.

Returns True when the operation succeeds.

mk_mouse_releasedfunction

bool mk_mouse_released(mk_mouse_button button)

Check if a mouse button was just released this frame.

ParameterTypeDescription
buttonmk_mouse_buttonValue for button.

Returns True when the operation succeeds.

mk_mouse_scrollfunction

void mk_mouse_scroll(float *x, float *y)

Get scroll wheel movement this frame.

Positive y = scroll up, positive x = scroll right.

ParameterTypeDescription
xfloat *Value for x.
yfloat *Value for y.

mk_mouse_set_capturedfunction

void mk_mouse_set_captured(bool captured)

Lock mouse cursor to window and hide it (FPS-style controls).

ParameterTypeDescription
capturedboolValue for captured.

mk_mouse_set_visiblefunction

void mk_mouse_set_visible(bool visible)

Show or hide the mouse cursor.

ParameterTypeDescription
visibleboolValue for visible.

mk_text_input_getfunction

const char * mk_text_input_get(void)

Get text input received this frame (UTF-8).

Returns empty string if no text was entered. The returned pointer is valid until the next frame.

Returns A borrowed pointer, or NULL when unavailable.

mk_text_input_get_areafunction

bool mk_text_input_get_area(mk_rect *area, int *cursor_offset)

Get the logical text field area and cursor offset.

ParameterTypeDescription
areamk_rect *Value for area.
cursor_offsetint *Value for cursor offset.

Returns True when the operation succeeds.

mk_text_input_get_compositionfunction

bool mk_text_input_get_composition(mk_text_composition *composition)

Get the current UTF-8 IME composition and selection.

The text pointer remains valid until the next composition event or stop.

ParameterTypeDescription
compositionmk_text_composition *Value for composition.

Returns True when the operation succeeds.

mk_text_input_hasfunction

bool mk_text_input_has(void)

Check if any text input was received this frame.

Returns True when the operation succeeds.

mk_text_input_has_screen_keyboardfunction

bool mk_text_input_has_screen_keyboard(void)

Check whether the platform provides an on-screen keyboard.

Returns True when the condition holds.

mk_text_input_is_activefunction

bool mk_text_input_is_active(void)

Check whether SDL text input is active on the main window.

Returns True when the condition holds.

mk_text_input_is_screen_keyboard_shownfunction

bool mk_text_input_is_screen_keyboard_shown(void)

Check whether the on-screen keyboard is visible for the main window.

Returns True when the condition holds.

mk_text_input_set_areafunction

bool mk_text_input_set_area(const mk_rect *area, int cursor_offset)

Set the logical text field area and cursor offset used to position the IME.

Pass NULL to clear the area.

ParameterTypeDescription
areaconst mk_rect *Value for area.
cursor_offsetintValue for cursor offset.

Returns True when the operation succeeds.

mk_text_input_startfunction

bool mk_text_input_start(const mk_text_input_desc *desc)

Start text input on the main window.

A NULL or zero-initialized descriptor selects normal single-line input.

ParameterTypeDescription
descconst mk_text_input_desc *Configuration descriptor.

Returns True when the operation succeeds.

mk_text_input_stopfunction

bool mk_text_input_stop(void)

Release the application's text-input request.

Returns True when the operation succeeds.

mk_touch_beganfunction

bool mk_touch_began(void)

Check if any touch began this frame.

Returns True when the operation succeeds.

mk_touch_countfunction

int mk_touch_count(void)

Get number of active touches.

Returns The resulting value.

mk_touch_endedfunction

bool mk_touch_ended(void)

Check if any touch ended this frame.

Returns True when the operation succeeds.

mk_touch_findfunction

const mk_touch * mk_touch_find(uint64_t finger_id)

Find touch by finger ID.

Returns NULL if not found.

ParameterTypeDescription
finger_iduint64_tValue for finger ID.

Returns A borrowed pointer, or NULL when unavailable.

mk_touch_getfunction

const mk_touch * mk_touch_get(int index)

Get touch by index (0 to mk_touch_count()-1).

Returns NULL if index is out of range.

ParameterTypeDescription
indexintZero-based index.

Returns A borrowed pointer, or NULL when unavailable.

mk_touch_get_dragfunction

bool mk_touch_get_drag(float *dx, float *dy)

Get drag delta from single-finger touch.

Only returns meaningful values when exactly one touch is active.

ParameterTypeDescription
dxfloat *Output: horizontal drag delta in pixels (can be NULL)
dyfloat *Output: vertical drag delta in pixels (can be NULL)

Returns true if single touch is active and dragging

mk_touch_get_pinchfunction

bool mk_touch_get_pinch(float *scale, float *center_x, float *center_y)

Get pinch gesture info from two-finger touch.

ParameterTypeDescription
scalefloat *Output: pinch scale factor (>1 = spread apart, <1 = pinch together)
center_xfloat *Output: center X between the two fingers (can be NULL)
center_yfloat *Output: center Y between the two fingers (can be NULL)

Returns true if exactly two touches are active

mk_touch_get_tapfunction

bool mk_touch_get_tap(float *x, float *y)

Get the last tap completed this frame.

A tap is a short touch that ends close to where it began. This filters out drags and long presses while leaving the raw touch API unchanged.

ParameterTypeDescription
xfloat *Output: tap X position in pixels (can be NULL)
yfloat *Output: tap Y position in pixels (can be NULL)

Returns true if a tap completed this frame

mk_touch_get_two_finger_panfunction

bool mk_touch_get_two_finger_pan(float *dx, float *dy)

Get two-finger pan gesture delta.

Returns the average movement of two fingers.

ParameterTypeDescription
dxfloat *Output: horizontal pan delta in pixels (can be NULL)
dyfloat *Output: vertical pan delta in pixels (can be NULL)

Returns true if exactly two touches are active

Structs

mk_action_bindingstruct

Binding metadata for action maps.

gamepad is MK_ACTION_GAMEPAD_ANY for any connected pad, or 0..MK_MAX_GAMEPADS-1. GAMEPAD_AXIS is thresholded and reports directional magnitude. GAMEPAD_AXIS_VALUE is continuous and reports a signed axis value after deadzone.

FieldTypeDescription
typemk_action_binding_typeThe type.
gamepadintThe gamepad.
thresholdfloatThe threshold.
deadzonefloatThe deadzone.
scalefloatThe scale.
keymk_keycodeThe key.
mousemk_mouse_buttonThe mouse.
touch_regionmk_rectfThe touch region.
gamepad_buttonmk_gamepad_buttonThe gamepad button.
gamepad_axismk_gamepad_axisThe gamepad axis.

mk_clipboard_itemstruct

Data for clipboard item.

FieldTypeDescription
mime_typeconst char *The mime type.
dataconst void *The data.
sizesize_tThe size.

mk_gamepadstruct

Information about a connected gamepad.

FieldTypeDescription
connectedboolWhether gamepad is connected.
nameconst char *Gamepad name (NULL if not connected).
iduint32_tInternal SDL instance ID.

mk_input_eventstruct

Unified input event structure.

Check 'type' to determine which union member to use.

FieldTypeDescription
typemk_input_typeThe type.
window_iduint32_tSDL window ID that received this event (0 if N/A).
gamepad_axis.gamepadintGamepad index (0-3).
gamepad_axis.axismk_gamepad_axisThe axis.
gamepad_axis.valuefloatAxis value (-1 to 1, or 0 to 1 for triggers).
gamepad_button.gamepadintGamepad index (0-3).
gamepad_button.buttonmk_gamepad_buttonThe button.
gamepad_button.pressedbooltrue = pressed, false = released
gamepad_connect.gamepadintGamepad index (0-3).
gamepad_connect.connectedbooltrue = connected, false = disconnected
gamepad_connect.nameconst char *Gamepad name (only valid on connect).
key.keymk_keycodeThe key.
key.pressedbooltrue = pressed, false = released
mouse_button.buttonmk_mouse_buttonThe button.
mouse_button.pressedbooltrue = pressed, false = released
mouse_button.xfloatHorizontal pointer position at the click.
mouse_button.yfloatVertical pointer position at the click.
mouse_move.xfloatCurrent horizontal position.
mouse_move.yfloatCurrent vertical position.
mouse_move.dxfloatHorizontal delta from the previous position.
mouse_move.dyfloatVertical delta from the previous position.
scroll.xfloatHorizontal scroll amount; positive is right.
scroll.yfloatVertical scroll amount; positive is up.
keystruct mk_input_event::@124106166015076033155123122324024175035241240174::@310240333143360344206024325227201255336100237122The key.
mouse_buttonstruct mk_input_event::@124106166015076033155123122324024175035241240174::@163136152360120240206336103126127221343373306352The mouse button.
mouse_movestruct mk_input_event::@124106166015076033155123122324024175035241240174::@300271126163360356356071070041044034275347103010The mouse move.
scrollstruct mk_input_event::@124106166015076033155123122324024175035241240174::@343207026364257126051227200047064135210170142206The scroll.
touchmk_touchThe touch.
gamepad_buttonstruct mk_input_event::@124106166015076033155123122324024175035241240174::@072110206375215230126271112112355366030072200066The gamepad button.
gamepad_axisstruct mk_input_event::@124106166015076033155123122324024175035241240174::@262011062373077113226316030110325265042125264176The gamepad axis.
gamepad_connectstruct mk_input_event::@124106166015076033155123122324024175035241240174::@134201141242023171131311165321022173276304051354The gamepad connect.

mk_text_compositionstruct

Data for text composition.

FieldTypeDescription
textconst char *The text.
startintThe start.
lengthintThe length.

mk_text_input_descstruct

Data for text input desc.

FieldTypeDescription
typemk_text_input_typeThe type.
capitalizationmk_text_capitalizationThe capitalization.
autocorrectmk_text_autocorrectThe autocorrect.
multilineboolThe multiline.

mk_touchstruct

Information about a single touch point.

FieldTypeDescription
iduint64_tUnique finger identifier.
xfloatCurrent horizontal position in pixels.
yfloatCurrent vertical position in pixels.
start_xfloatHorizontal position where the touch began.
start_yfloatVertical position where the touch began.
pressurefloatPressure 0.0-1.0 (1.0 if unavailable).
phasemk_touch_phaseCurrent touch phase.

Enums

mk_action_binding_typeenum

Public binding type used for action-map rebinding and enumeration.

ValueDescription
MK_ACTION_BINDING_INVALIDSelects invalid.
MK_ACTION_BINDING_KEYSelects key.
MK_ACTION_BINDING_MOUSESelects mouse.
MK_ACTION_BINDING_TOUCH_REGIONSelects touch region.
MK_ACTION_BINDING_GAMEPAD_BUTTONSelects gamepad button.
MK_ACTION_BINDING_GAMEPAD_AXISSelects gamepad axis.
MK_ACTION_BINDING_GAMEPAD_AXIS_VALUESelects gamepad axis value.

mk_cursor_shapeenum

Standard system cursor shapes (map to native OS cursors).

ValueDescription
MK_CURSOR_DEFAULTArrow.
MK_CURSOR_TEXTI-beam (text selection).
MK_CURSOR_WAITBusy / hourglass.
MK_CURSOR_CROSSHAIRCrosshair.
MK_CURSOR_PROGRESSArrow + small busy indicator.
MK_CURSOR_RESIZE_NWSEDiagonal resize ↖↘
MK_CURSOR_RESIZE_NESWDiagonal resize ↗↙
MK_CURSOR_RESIZE_EWHorizontal resize ↔
MK_CURSOR_RESIZE_NSVertical resize ↕
MK_CURSOR_MOVEMove (4-way arrows).
MK_CURSOR_NOT_ALLOWEDForbidden / no-drop.
MK_CURSOR_POINTERHand (clickable).
MK_CURSOR_COUNTSelects count.

mk_gamepad_axisenum

Gamepad axis identifiers.

ValueDescription
MK_GAMEPAD_AXIS_INVALIDSelects invalid.
MK_GAMEPAD_AXIS_LEFT_XLeft stick horizontal (-1 left, +1 right).
MK_GAMEPAD_AXIS_LEFT_YLeft stick vertical (-1 up, +1 down).
MK_GAMEPAD_AXIS_RIGHT_XRight stick horizontal.
MK_GAMEPAD_AXIS_RIGHT_YRight stick vertical.
MK_GAMEPAD_AXIS_LEFT_TRIGGERLeft trigger (0 to 1).
MK_GAMEPAD_AXIS_RIGHT_TRIGGERRight trigger (0 to 1).
MK_GAMEPAD_AXIS_COUNTSelects count.

mk_gamepad_buttonenum

Gamepad button identifiers.

Uses compass directions for face buttons (South=A, East=B, etc. on Xbox).

ValueDescription
MK_GAMEPAD_INVALIDSelects invalid.
MK_GAMEPAD_ASouth face button (Xbox A, PS Cross).
MK_GAMEPAD_BEast face button (Xbox B, PS Circle).
MK_GAMEPAD_XWest face button (Xbox X, PS Square).
MK_GAMEPAD_YNorth face button (Xbox Y, PS Triangle).
MK_GAMEPAD_BACKBack/Select/Share button.
MK_GAMEPAD_GUIDEGuide/Home/PS button.
MK_GAMEPAD_STARTStart/Options button.
MK_GAMEPAD_LEFT_STICKLeft stick click (L3).
MK_GAMEPAD_RIGHT_STICKRight stick click (R3).
MK_GAMEPAD_LEFT_SHOULDERLeft bumper (LB/L1).
MK_GAMEPAD_RIGHT_SHOULDERRight bumper (RB/R1).
MK_GAMEPAD_DPAD_UPSelects dpad up.
MK_GAMEPAD_DPAD_DOWNSelects dpad down.
MK_GAMEPAD_DPAD_LEFTSelects dpad left.
MK_GAMEPAD_DPAD_RIGHTSelects dpad right.
MK_GAMEPAD_BUTTON_COUNTSelects button count.

mk_input_typeenum

Input event types.

ValueDescription
MK_INPUT_KEYKeyboard key press/release.
MK_INPUT_MOUSE_BUTTONMouse button press/release.
MK_INPUT_MOUSE_MOVEMouse movement.
MK_INPUT_MOUSE_SCROLLMouse scroll wheel.
MK_INPUT_TOUCHTouch began/moved/ended.
MK_INPUT_GAMEPAD_BUTTONGamepad button press/release.
MK_INPUT_GAMEPAD_AXISGamepad axis movement.
MK_INPUT_GAMEPAD_CONNECTGamepad connected/disconnected.

mk_keycodeenum

Keyboard key codes.

Values are designed to map efficiently to SDL3 scancodes.

ValueDescription
MK_KEY_UNKNOWNSelects unknown.
MK_KEY_ASelects a.
MK_KEY_BSelects b.
MK_KEY_CSelects c.
MK_KEY_DSelects d.
MK_KEY_ESelects e.
MK_KEY_FSelects f.
MK_KEY_GSelects g.
MK_KEY_HSelects h.
MK_KEY_ISelects i.
MK_KEY_JSelects j.
MK_KEY_KSelects k.
MK_KEY_LSelects l.
MK_KEY_MSelects m.
MK_KEY_NSelects n.
MK_KEY_OSelects o.
MK_KEY_PSelects p.
MK_KEY_QSelects q.
MK_KEY_RSelects r.
MK_KEY_SSelects s.
MK_KEY_TSelects t.
MK_KEY_USelects u.
MK_KEY_VSelects v.
MK_KEY_WSelects w.
MK_KEY_XSelects x.
MK_KEY_YSelects y.
MK_KEY_ZSelects z.
MK_KEY_1Selects 1.
MK_KEY_2Selects 2.
MK_KEY_3Selects 3.
MK_KEY_4Selects 4.
MK_KEY_5Selects 5.
MK_KEY_6Selects 6.
MK_KEY_7Selects 7.
MK_KEY_8Selects 8.
MK_KEY_9Selects 9.
MK_KEY_0Selects 0.
MK_KEY_ENTERSelects enter.
MK_KEY_ESCAPESelects escape.
MK_KEY_BACKSPACESelects backspace.
MK_KEY_TABSelects tab.
MK_KEY_SPACESelects space.
MK_KEY_MINUSSelects minus.
MK_KEY_EQUALSSelects equals.
MK_KEY_LEFTBRACKETSelects leftbracket.
MK_KEY_RIGHTBRACKETSelects rightbracket.
MK_KEY_BACKSLASHSelects backslash.
MK_KEY_SEMICOLONSelects semicolon.
MK_KEY_APOSTROPHESelects apostrophe.
MK_KEY_GRAVESelects grave.
MK_KEY_COMMASelects comma.
MK_KEY_PERIODSelects period.
MK_KEY_SLASHSelects slash.
MK_KEY_CAPSLOCKSelects capslock.
MK_KEY_F1Selects f1.
MK_KEY_F2Selects f2.
MK_KEY_F3Selects f3.
MK_KEY_F4Selects f4.
MK_KEY_F5Selects f5.
MK_KEY_F6Selects f6.
MK_KEY_F7Selects f7.
MK_KEY_F8Selects f8.
MK_KEY_F9Selects f9.
MK_KEY_F10Selects f10.
MK_KEY_F11Selects f11.
MK_KEY_F12Selects f12.
MK_KEY_PRINTSCREENSelects printscreen.
MK_KEY_SCROLLLOCKSelects scrolllock.
MK_KEY_PAUSESelects pause.
MK_KEY_INSERTSelects insert.
MK_KEY_HOMESelects home.
MK_KEY_PAGEUPSelects pageup.
MK_KEY_DELETESelects delete.
MK_KEY_ENDSelects end.
MK_KEY_PAGEDOWNSelects pagedown.
MK_KEY_RIGHTSelects right.
MK_KEY_LEFTSelects left.
MK_KEY_DOWNSelects down.
MK_KEY_UPSelects up.
MK_KEY_NUMLOCKSelects numlock.
MK_KEY_KP_DIVIDESelects kp divide.
MK_KEY_KP_MULTIPLYSelects kp multiply.
MK_KEY_KP_MINUSSelects kp minus.
MK_KEY_KP_PLUSSelects kp plus.
MK_KEY_KP_ENTERSelects kp enter.
MK_KEY_KP_1Selects kp 1.
MK_KEY_KP_2Selects kp 2.
MK_KEY_KP_3Selects kp 3.
MK_KEY_KP_4Selects kp 4.
MK_KEY_KP_5Selects kp 5.
MK_KEY_KP_6Selects kp 6.
MK_KEY_KP_7Selects kp 7.
MK_KEY_KP_8Selects kp 8.
MK_KEY_KP_9Selects kp 9.
MK_KEY_KP_0Selects kp 0.
MK_KEY_KP_PERIODSelects kp period.
MK_KEY_LCTRLSelects lctrl.
MK_KEY_LSHIFTSelects lshift.
MK_KEY_LALTSelects lalt.
MK_KEY_LSUPERLeft Cmd (Mac) / Left Win (Windows).
MK_KEY_RCTRLSelects rctrl.
MK_KEY_RSHIFTSelects rshift.
MK_KEY_RALTSelects ralt.
MK_KEY_RSUPERRight Cmd (Mac) / Right Win (Windows).
MK_KEY_COUNTSelects count.

mk_mouse_buttonenum

Mouse button identifiers.

ValueDescription
MK_MOUSE_LEFTSelects left.
MK_MOUSE_MIDDLESelects middle.
MK_MOUSE_RIGHTSelects right.
MK_MOUSE_X1Selects x1.
MK_MOUSE_X2Selects x2.
MK_MOUSE_COUNTSelects count.

mk_text_autocorrectenum

Values for text autocorrect.

ValueDescription
MK_TEXT_AUTOCORRECT_DEFAULTSelects default.
MK_TEXT_AUTOCORRECT_ENABLEDSelects enabled.
MK_TEXT_AUTOCORRECT_DISABLEDSelects disabled.

mk_text_capitalizationenum

Values for text capitalization.

ValueDescription
MK_TEXT_CAPITALIZATION_DEFAULTSelects default.
MK_TEXT_CAPITALIZATION_NONESelects none.
MK_TEXT_CAPITALIZATION_SENTENCESSelects sentences.
MK_TEXT_CAPITALIZATION_WORDSSelects words.
MK_TEXT_CAPITALIZATION_LETTERSSelects letters.

mk_text_input_typeenum

Values for text input type.

ValueDescription
MK_TEXT_INPUT_TYPE_TEXTSelects text.
MK_TEXT_INPUT_TYPE_NAMESelects name.
MK_TEXT_INPUT_TYPE_EMAILSelects email.
MK_TEXT_INPUT_TYPE_USERNAMESelects username.
MK_TEXT_INPUT_TYPE_PASSWORDSelects password.
MK_TEXT_INPUT_TYPE_NUMBERSelects number.
MK_TEXT_INPUT_TYPE_PINSelects pin.

mk_touch_phaseenum

Touch phase (lifecycle state).

ValueDescription
MK_TOUCH_BEGANFinger just touched screen.
MK_TOUCH_MOVEDFinger moved while touching.
MK_TOUCH_STATIONARYFinger touching but not moving.
MK_TOUCH_ENDEDFinger lifted from screen.
MK_TOUCH_CANCELLEDTouch cancelled (e.g., phone call).

Typedefs

mk_actiontypedef

typedef uint32_t mk_action

Action handle (returned by mk_action_register).

MK_ACTION_INVALID (0) represents an invalid/unregistered action.

mk_action_bindingtypedef

typedef struct mk_action_binding mk_action_binding

Binding metadata for action maps.

gamepad is MK_ACTION_GAMEPAD_ANY for any connected pad, or 0..MK_MAX_GAMEPADS-1. GAMEPAD_AXIS is thresholded and reports directional magnitude. GAMEPAD_AXIS_VALUE is continuous and reports a signed axis value after deadzone.

mk_action_binding_typetypedef

typedef enum mk_action_binding_type mk_action_binding_type

Public binding type used for action-map rebinding and enumeration.

mk_action_maptypedef

typedef uint32_t mk_action_map

Action map handle.

MK_ACTION_MAP_INVALID (0) represents an invalid map. The built-in default map is available through mk_action_default_map().

mk_clipboard_item_ttypedef

typedef struct mk_clipboard_item mk_clipboard_item_t

Data for clipboard item.

mk_cursor_shapetypedef

typedef enum mk_cursor_shape mk_cursor_shape

Standard system cursor shapes (map to native OS cursors).

mk_cursor_ttypedef

typedef struct mk_cursor_s* mk_cursor_t

Opaque handle to a custom cursor created from pixels.

mk_gamepadtypedef

typedef struct mk_gamepad mk_gamepad

Information about a connected gamepad.

mk_gamepad_axistypedef

typedef enum mk_gamepad_axis mk_gamepad_axis

Gamepad axis identifiers.

mk_gamepad_buttontypedef

typedef enum mk_gamepad_button mk_gamepad_button

Gamepad button identifiers.

Uses compass directions for face buttons (South=A, East=B, etc. on Xbox).

mk_input_eventtypedef

typedef struct mk_input_event mk_input_event

Unified input event structure.

Check 'type' to determine which union member to use.

mk_input_typetypedef

typedef enum mk_input_type mk_input_type

Input event types.

mk_keycodetypedef

typedef enum mk_keycode mk_keycode

Keyboard key codes.

Values are designed to map efficiently to SDL3 scancodes.

mk_mouse_buttontypedef

typedef enum mk_mouse_button mk_mouse_button

Mouse button identifiers.

mk_text_autocorrecttypedef

typedef enum mk_text_autocorrect mk_text_autocorrect

Values for text autocorrect.

mk_text_capitalizationtypedef

typedef enum mk_text_capitalization mk_text_capitalization

Values for text capitalization.

mk_text_compositiontypedef

typedef struct mk_text_composition mk_text_composition

Data for text composition.

mk_text_input_desctypedef

typedef struct mk_text_input_desc mk_text_input_desc

Data for text input desc.

mk_text_input_typetypedef

typedef enum mk_text_input_type mk_text_input_type

Values for text input type.

mk_touchtypedef

typedef struct mk_touch mk_touch

Information about a single touch point.

mk_touch_phasetypedef

typedef enum mk_touch_phase mk_touch_phase

Touch phase (lifecycle state).

Macros

MK_ACTION_GAMEPAD_ANYdefine

MK_ACTION_GAMEPAD_ANY

Constant for action gamepad any.

MK_ACTION_INVALIDdefine

MK_ACTION_INVALID

Invalid sentinel for action.

MK_ACTION_MAP_INVALIDdefine

MK_ACTION_MAP_INVALID

Invalid sentinel for action map.

MK_MAX_ACTION_MAPSdefine

MK_MAX_ACTION_MAPS

Maximum number of action maps that can be registered.

MK_MAX_ACTIONSdefine

MK_MAX_ACTIONS

Maximum number of actions that can be registered.

MK_MAX_BINDINGS_PER_ACTIONdefine

MK_MAX_BINDINGS_PER_ACTION

Maximum number of bindings per action.

MK_MAX_GAMEPADSdefine

MK_MAX_GAMEPADS

Maximum number of gamepads supported simultaneously.

MK_MAX_TOUCHESdefine

MK_MAX_TOUCHES

Maximum number of simultaneous touches tracked.

MK_TEXT_COMPOSITION_MAXdefine

MK_TEXT_COMPOSITION_MAX

Maximum size of the current UTF-8 IME composition.

MK_TEXT_INPUT_MAXdefine

MK_TEXT_INPUT_MAX

Maximum size of text input buffer per frame.