Skip to content
modkitv0.2

imgui.h

#include <modkit/imgui.h>8 functions · 1 structs · 1 typedefs · 2 macros

Dear ImGui integration for modkit.

Provides a GPU backend for Dear ImGui with HiDPI support. Uses cimgui (C bindings) internally. When this module creates the ImGui context, it automatically uses window pixel density for font raster detail and mk_get_window_ui_scale() for portable font/style dimensions. If the application creates the ImGui context and font atlas first, it owns that sizing and should apply the same split itself. Basic usage:

Functions

mk_imgui_begin_framefunction

void mk_imgui_begin_frame(void)

Begin a new ImGui frame.

Call this at the start of your frame, before any ImGui calls. Automatically handles input from modkit's input system.

mk_imgui_createfunction

mk_result mk_imgui_create(const mk_imgui_desc *desc)

Initialize ImGui with modkit backend.

ParameterTypeDescription
descconst mk_imgui_desc *Configuration options, or NULL for defaults

Returns MK_SUCCESS on success, error code on failure

mk_imgui_destroyfunction

void mk_imgui_destroy(void)

Shutdown ImGui and release resources.

mk_imgui_end_framefunction

void mk_imgui_end_frame(void)

End the ImGui frame and render.

Call this after all your ImGui calls are done.

mk_imgui_set_view_idfunction

void mk_imgui_set_view_id(mk_view_id_t view_id)

Set the view ID for ImGui rendering.

ParameterTypeDescription
view_idmk_view_id_tmodkit view ID

mk_imgui_texture_idfunction

void * mk_imgui_texture_id(mk_texture_t texture)

Create an ImGui texture ID from a modkit texture.

Use this to display textures in ImGui::Image() calls.

ParameterTypeDescription
texturemk_texture_tmodkit texture handle

Returns ImTextureID suitable for ImGui::Image() calls

mk_imgui_want_capture_keyboardfunction

bool mk_imgui_want_capture_keyboard(void)

Check if ImGui wants to capture keyboard input.

Use this to avoid processing keyboard events in your app when ImGui needs them.

Returns true if ImGui wants keyboard input

mk_imgui_want_capture_mousefunction

bool mk_imgui_want_capture_mouse(void)

Check if ImGui wants to capture mouse input.

Use this to avoid processing mouse events in your app when ImGui needs them.

Returns true if ImGui wants mouse input

Structs

mk_imgui_descstruct

ImGui configuration options.

FieldTypeDescription
font_sizefloatBase font size in points (default: 16.0).
font_dataconst void *Optional custom font data (TTF).
font_data_sizeuint32_tSize of font data in bytes.
view_idmk_view_id_tView ID for imgui rendering (default: 255).
enable_dockingboolEnable docking support (default: true).
dark_styleboolUse dark style (default: true).

Typedefs

mk_imgui_desctypedef

typedef struct mk_imgui_desc mk_imgui_desc

ImGui configuration options.

Macros

CIMGUI_DEFINE_ENUMS_AND_STRUCTSdefine

CIMGUI_DEFINE_ENUMS_AND_STRUCTS

Constant for cimgui define enums and structs.

igGetIOdefine

igGetIO

Constant for iggetio.