KROYSDOCS
HomeWhat's newv0.1.0
C/C++ SDK / C ABI · UI (editor; valid only inside draw callbacks) / KroysUiApi

KroysUiApi

Colors are packed RGBA8: r | g << 8 | b << 16 | a << 24. Icons are Lucide names ("plug", "play", "folder", "box", "settings", ...); unknown names draw the plug icon. Labels may use "##id" suffixes to keep ids unique. Every function returns a "changed/clicked" flag where it has one.

Kindstruct
Headerkroys/kroys_plugin.h
Members46
Functions44
DECLARATION

Declaration

Declared in kroys/kroys_plugin.h.

kroys_plugin.h
typedef struct KroysUiApi { ... } KroysUiApi;
REFERENCE

Members

Fields
#uint32_t structSize;

Size of this struct as the writer compiled it (sizeof); the reader uses it to detect members appended by later minor versions.

field
#uint32_t reserved;

Padding reserved for later use; leave it 0.

field
Functions
#void (KROYS_CALL* Text)(KroysContext context, const char* text);

A line of text.

function pointer
#void (KROYS_CALL* TextWrapped)(KroysContext context, const char* text);

Text wrapped at the panel width.

function pointer
#void (KROYS_CALL* TextColored)(KroysContext context, int32_t color, const char* text);

Text in a theme colour (KroysThemeColor).

function pointer
#void (KROYS_CALL* Heading)(KroysContext context, const char* text);

A heading (larger, bold).

function pointer
#void (KROYS_CALL* Icon)(KroysContext context, const char* iconName);

A Lucide icon by name.

function pointer
#int32_t (KROYS_CALL* Button)(KroysContext context, const char* label, uint32_t flags);

A button (KROYS_UI_BUTTON_* flags); nonzero when clicked.

function pointer
#int32_t (KROYS_CALL* IconButton)(KroysContext context, const char* id, const char* iconName, const char* tooltip);

An icon button with a tooltip; nonzero when clicked.

function pointer
#int32_t (KROYS_CALL* Checkbox)(KroysContext context, const char* label, int32_t* value);

A checkbox editing *value (0 or 1); nonzero when toggled.

function pointer
#int32_t (KROYS_CALL* InputText)(KroysContext context, const char* label, char* buffer, uint32_t capacity, uint32_t flags);

A text field editing the plugin's buffer (capacity bytes including the terminator; KROYS_UI_INPUT_* flags); nonzero when changed.

function pointer
#int32_t (KROYS_CALL* InputInt)(KroysContext context, const char* label, int32_t* value);

An integer field; nonzero when changed.

function pointer
#int32_t (KROYS_CALL* InputFloat)(KroysContext context, const char* label, float* value);

A float field; nonzero when changed.

function pointer
#int32_t (KROYS_CALL* SliderFloat)(KroysContext context, const char* label, float* value, float minimum, float maximum);

A slider from minimum to maximum; nonzero when changed.

function pointer
#int32_t (KROYS_CALL* DragFloat3)(KroysContext context, const char* label, float* values, float speed);

Three drag fields editing values[3] (a vector); nonzero when changed.

function pointer
#int32_t (KROYS_CALL* Combo)(KroysContext context, const char* label, int32_t* index, const char* const* items, uint32_t itemCount);

A dropdown over items editing *index; nonzero when the selection changed.

function pointer
#int32_t (KROYS_CALL* Selectable)(KroysContext context, const char* label, int32_t selected);

A selectable row; nonzero when clicked.

function pointer
#void (KROYS_CALL* SameLine)(KroysContext context);

The next item stays on this line.

function pointer
#void (KROYS_CALL* Spacing)(KroysContext context);

Vertical space.

function pointer
#void (KROYS_CALL* Separator)(KroysContext context);

A horizontal line.

function pointer
#void (KROYS_CALL* SeparatorText)(KroysContext context, const char* text);

A horizontal line with a caption.

function pointer
#void (KROYS_CALL* Indent)(KroysContext context);

Indents the following items.

function pointer
#void (KROYS_CALL* Unindent)(KroysContext context);

Ends an Indent.

function pointer
#void (KROYS_CALL* SetNextItemWidth)(KroysContext context, float width);

Width of the next item, in pixels.

function pointer
#float (KROYS_CALL* AvailableWidth)(KroysContext context);

Remaining width on the current line, in pixels.

function pointer
#void (KROYS_CALL* BeginDisabled)(KroysContext context, int32_t disabled);

Starts a block drawn disabled when disabled is nonzero; always end it with EndDisabled.

function pointer
#void (KROYS_CALL* EndDisabled)(KroysContext context);

Ends a BeginDisabled block.

function pointer
#void (KROYS_CALL* PushId)(KroysContext context, const char* id);

Pushes an id scope (repeated widgets with the same labels).

function pointer
#void (KROYS_CALL* PopId)(KroysContext context);

Pops an id scope.

function pointer
#int32_t (KROYS_CALL* BeginSection)(KroysContext context, const char* label, uint32_t flags);

Collapsible section; call EndSection only when it returned nonzero.

function pointer
#void (KROYS_CALL* EndSection)(KroysContext context);

Ends a section.

function pointer
#int32_t (KROYS_CALL* BeginTable)(KroysContext context, const char* id, uint32_t columns, uint32_t flags);

Call EndTable only when BeginTable returned nonzero.

function pointer
#void (KROYS_CALL* TableSetupColumn)(KroysContext context, const char* label, float width);

Declares the next column (width 0: stretch).

function pointer
#void (KROYS_CALL* TableHeadersRow)(KroysContext context);

Draws the header row of the declared columns.

function pointer
#void (KROYS_CALL* TableNextRow)(KroysContext context);

Starts a row.

function pointer
#int32_t (KROYS_CALL* TableNextColumn)(KroysContext context);

Moves to the next cell; nonzero when it is visible.

function pointer
#void (KROYS_CALL* EndTable)(KroysContext context);

Ends a table.

function pointer
#int32_t (KROYS_CALL* TreeNode)(KroysContext context, const char* label, uint32_t flags);

Call TreePop only when TreeNode returned nonzero (and the node is not a leaf).

function pointer
#void (KROYS_CALL* TreePop)(KroysContext context);

Closes a tree node.

function pointer
#void (KROYS_CALL* Tooltip)(KroysContext context, const char* text);

Tooltip of the previous item (shown while hovered).

function pointer
#int32_t (KROYS_CALL* IsItemHovered)(KroysContext context);

Nonzero when the previous item is hovered.

function pointer
#int32_t (KROYS_CALL* IsItemClicked)(KroysContext context);

Nonzero when the previous item was clicked.

function pointer
#uint32_t (KROYS_CALL* ThemeColor)(KroysContext context, int32_t color);

A theme colour (KroysThemeColor), packed RGBA8.

function pointer
#float (KROYS_CALL* ThemeMetric)(KroysContext context, int32_t metric);

A theme metric (KroysThemeMetric) in pixels (KROYS_METRIC_UI_SCALE: a factor).

function pointer
#void (KROYS_CALL* ProgressBar)(KroysContext context, float fraction, const char* overlay);

A progress bar (fraction 0..1) with an optional overlay text.

function pointersince 2.1
#int32_t (KROYS_CALL* ColorEdit4)(KroysContext context, const char* label, float* rgba);

An RGBA colour editor (rgba[4], 0..1); nonzero when changed.

function pointersince 2.1
Members
uint32_t structSize;
uint32_t reserved;
void (KROYS_CALL* Text)(KroysContext context, const char* text);
void (KROYS_CALL* TextWrapped)(KroysContext context, const char* text);
void (KROYS_CALL* TextColored)(KroysContext context, int32_t color, const char* text);
void (KROYS_CALL* Heading)(KroysContext context, const char* text);
void (KROYS_CALL* Icon)(KroysContext context, const char* iconName);
int32_t (KROYS_CALL* Button)(KroysContext context, const char* label, uint32_t flags);
int32_t (KROYS_CALL* IconButton)(KroysContext context, const char* id, const char* iconName, const char* tooltip);
int32_t (KROYS_CALL* Checkbox)(KroysContext context, const char* label, int32_t* value);
int32_t (KROYS_CALL* InputText)(KroysContext context, const char* label, char* buffer, uint32_t capacity, uint32_t flags);
int32_t (KROYS_CALL* InputInt)(KroysContext context, const char* label, int32_t* value);
int32_t (KROYS_CALL* InputFloat)(KroysContext context, const char* label, float* value);
int32_t (KROYS_CALL* SliderFloat)(KroysContext context, const char* label, float* value, float minimum, float maximum);
int32_t (KROYS_CALL* DragFloat3)(KroysContext context, const char* label, float* values, float speed);
int32_t (KROYS_CALL* Combo)(KroysContext context, const char* label, int32_t* index, const char* const* items, uint32_t itemCount);
int32_t (KROYS_CALL* Selectable)(KroysContext context, const char* label, int32_t selected);
void (KROYS_CALL* SameLine)(KroysContext context);
void (KROYS_CALL* Spacing)(KroysContext context);
void (KROYS_CALL* Separator)(KroysContext context);
void (KROYS_CALL* SeparatorText)(KroysContext context, const char* text);
void (KROYS_CALL* Indent)(KroysContext context);
void (KROYS_CALL* Unindent)(KroysContext context);
void (KROYS_CALL* SetNextItemWidth)(KroysContext context, float width);
float (KROYS_CALL* AvailableWidth)(KroysContext context);
void (KROYS_CALL* BeginDisabled)(KroysContext context, int32_t disabled);
void (KROYS_CALL* EndDisabled)(KroysContext context);
void (KROYS_CALL* PushId)(KroysContext context, const char* id);
void (KROYS_CALL* PopId)(KroysContext context);
int32_t (KROYS_CALL* BeginSection)(KroysContext context, const char* label, uint32_t flags);
void (KROYS_CALL* EndSection)(KroysContext context);
int32_t (KROYS_CALL* BeginTable)(KroysContext context, const char* id, uint32_t columns, uint32_t flags);
void (KROYS_CALL* TableSetupColumn)(KroysContext context, const char* label, float width);
void (KROYS_CALL* TableHeadersRow)(KroysContext context);
void (KROYS_CALL* TableNextRow)(KroysContext context);
int32_t (KROYS_CALL* TableNextColumn)(KroysContext context);
void (KROYS_CALL* EndTable)(KroysContext context);
int32_t (KROYS_CALL* TreeNode)(KroysContext context, const char* label, uint32_t flags);
void (KROYS_CALL* TreePop)(KroysContext context);
void (KROYS_CALL* Tooltip)(KroysContext context, const char* text);
int32_t (KROYS_CALL* IsItemHovered)(KroysContext context);
int32_t (KROYS_CALL* IsItemClicked)(KroysContext context);
uint32_t (KROYS_CALL* ThemeColor)(KroysContext context, int32_t color);
float (KROYS_CALL* ThemeMetric)(KroysContext context, int32_t metric);
void (KROYS_CALL* ProgressBar)(KroysContext context, float fraction, const char* overlay);
int32_t (KROYS_CALL* ColorEdit4)(KroysContext context, const char* label, float* rgba);

KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.