Functions
mk_get_main_windowfunction
mk_window_t mk_get_main_window(void)
Get the main application window.
This is the window created by mk_app_run() and uses the main backbuffer.
Returns Main window handle (always valid after mk_app_run starts)
mk_view_get_windowfunction
mk_window_t mk_view_get_window(mk_view_id_t view)
Get the window associated with a view.
Returns NULL if view renders to main backbuffer.
| Parameter | Type | Description |
|---|
view | mk_view_id_t | Value for view. |
Returns The resulting handle or value.
mk_view_set_windowfunction
void mk_view_set_window(mk_view_id_t view, mk_window_t window)
Associate a view with a window.
The view will render to the window's framebuffer. Pass NULL or MK_WINDOW_INVALID to render to the main backbuffer.
| Parameter | Type | Description |
|---|
view | mk_view_id_t | View ID to associate |
window | mk_window_t | Target window (NULL for main window backbuffer) |
mk_window_createfunction
mk_window_t mk_window_create(const mk_window_desc *desc)
Create a new window.
The window will have its own framebuffer for rendering.
| Parameter | Type | Description |
|---|
desc | const mk_window_desc * | Window descriptor |
Returns Window handle or MK_WINDOW_INVALID on failure
mk_window_destroyfunction
void mk_window_destroy(mk_window_t window)
Destroy a window and its associated framebuffer.
Any views associated with this window will revert to the main backbuffer. Cannot be used to destroy the main window.
| Parameter | Type | Description |
|---|
window | mk_window_t | Window to destroy |
mk_window_focusfunction
void mk_window_focus(mk_window_t window)
Focus/raise the window.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
mk_window_get_display_scalefunction
float mk_window_get_display_scale(mk_window_t window)
Get desired physical pixels per portable content unit.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns The resulting value.
mk_window_get_dpi_scalefunction
float mk_window_get_dpi_scale(mk_window_t window)
Get physical backbuffer pixels per native window-coordinate unit.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns The resulting value.
mk_window_get_framebufferfunction
mk_framebuf_t mk_window_get_framebuffer(mk_window_t window)
Get the framebuffer handle for this window.
Returns MK_FRAMEBUF_INVALID for the main window (uses backbuffer).
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns The resulting handle or value.
mk_window_get_positionfunction
void mk_window_get_position(mk_window_t window, int *x, int *y)
Get the window's top-left position in screen coordinates.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
x | int * | Value for x. |
y | int * | Value for y. |
mk_window_get_safe_areafunction
bool mk_window_get_safe_area(mk_window_t window, mk_rect *area)
Get the safe rectangle for interactive content in native window units.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
area | mk_rect * | Value for area. |
Returns True when the operation succeeds.
mk_window_get_safe_insetsfunction
bool mk_window_get_safe_insets(mk_window_t window, mk_insets *insets)
Get safe-area insets from each window edge in native window units.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
insets | mk_insets * | Value for insets. |
Returns True when the operation succeeds.
mk_window_get_sdlfunction
SDL_Window * mk_window_get_sdl(mk_window_t window)
Get underlying SDL window handle for advanced use.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns A borrowed pointer, or NULL when unavailable.
mk_window_get_sizefunction
void mk_window_get_size(mk_window_t window, int *width, int *height)
Get size in SDL's native window-coordinate units.
This is the same coordinate space as mouse input and safe-area rectangles. Use mk_window_get_ui_scale() for portable UI/design dimensions.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
width | int * | Value for width. |
height | int * | Value for height. |
mk_window_get_size_pixelsfunction
void mk_window_get_size_pixels(mk_window_t window, int *width, int *height)
Get window size in physical pixels.
Use this for rendering dimensions.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
width | int * | Value for width. |
height | int * | Value for height. |
mk_window_get_ui_scalefunction
float mk_window_get_ui_scale(mk_window_t window)
Get native window-coordinate units per portable UI/design unit.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns The resulting value.
mk_window_get_user_datafunction
void * mk_window_get_user_data(mk_window_t window)
Get window user data.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns A borrowed pointer, or NULL when unavailable.
mk_window_is_fullscreenfunction
bool mk_window_is_fullscreen(mk_window_t window)
True if the window is currently fullscreen.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns True when the condition holds.
mk_window_is_mainfunction
bool mk_window_is_main(mk_window_t window)
Check if this is the main window.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns True when the condition holds.
mk_window_is_maximizedfunction
bool mk_window_is_maximized(mk_window_t window)
True if the window is currently maximized.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns True when the condition holds.
mk_window_is_minimizedfunction
bool mk_window_is_minimized(mk_window_t window)
True if the window is currently minimized.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns True when the condition holds.
mk_window_is_validfunction
bool mk_window_is_valid(mk_window_t window)
Check if window handle is valid.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns True when the condition holds.
mk_window_is_visiblefunction
bool mk_window_is_visible(mk_window_t window)
Check if window is visible.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
Returns True when the condition holds.
mk_window_maximizefunction
void mk_window_maximize(mk_window_t window)
Maximize the window.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
mk_window_minimizefunction
void mk_window_minimize(mk_window_t window)
Minimize (iconify) the window.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
mk_window_restorefunction
void mk_window_restore(mk_window_t window)
Restore the window from a minimized/maximized state.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
mk_window_set_always_on_topfunction
void mk_window_set_always_on_top(mk_window_t window, bool on_top)
Toggle whether the window stays above others.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
on_top | bool | Value for on top. |
mk_window_set_fullscreenfunction
void mk_window_set_fullscreen(mk_window_t window, bool fullscreen)
Enter or leave borderless (desktop) fullscreen.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
fullscreen | bool | Value for fullscreen. |
mk_window_set_iconfunction
void mk_window_set_icon(mk_window_t window, const void *rgba_pixels, int width, int height)
Set the window icon from a 32-bit RGBA pixel buffer (8 bits/channel, row-major, top-left origin).
No effect on platforms without window icons.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
rgba_pixels | const void * | Value for RGBA pixels. |
width | int | Value for width. |
height | int | Value for height. |
mk_window_set_max_sizefunction
void mk_window_set_max_size(mk_window_t window, int width, int height)
Constrain the largest the window may be resized to (0 to clear).
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
width | int | Value for width. |
height | int | Value for height. |
mk_window_set_min_sizefunction
void mk_window_set_min_size(mk_window_t window, int width, int height)
Constrain the smallest the window may be resized to (0 to clear).
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
width | int | Value for width. |
height | int | Value for height. |
mk_window_set_opacityfunction
void mk_window_set_opacity(mk_window_t window, float opacity)
Set window opacity in [0,1] (1 = opaque).
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
opacity | float | Value for opacity. |
mk_window_set_positionfunction
void mk_window_set_position(mk_window_t window, int x, int y)
Move the window's top-left to a screen coordinate.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
x | int | Value for x. |
y | int | Value for y. |
mk_window_set_resizablefunction
void mk_window_set_resizable(mk_window_t window, bool resizable)
Toggle whether the user can resize the window.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
resizable | bool | Value for resizable. |
mk_window_set_sizefunction
void mk_window_set_size(mk_window_t window, int width, int height)
Resize the window (logical units / points).
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
width | int | Value for width. |
height | int | Value for height. |
mk_window_set_titlefunction
void mk_window_set_title(mk_window_t window, const char *title)
Set window title.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
title | const char * | Value for title. |
mk_window_set_user_datafunction
void mk_window_set_user_data(mk_window_t window, void *user_data)
Set window user data.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
user_data | void * | Caller-provided context. |
mk_window_set_visiblefunction
void mk_window_set_visible(mk_window_t window, bool visible)
Show or hide the window.
| Parameter | Type | Description |
|---|
window | mk_window_t | Value for window. |
visible | bool | Value for visible. |