kroys::Ui
The editor's immediate-mode UI (valid inside panel, settings page and tool draw callbacks).
Declaration
Declared in kroys/plugin.hpp.
plugin.hpp
class Ui
Members
#explicit Ui(const KroysHost* host);Wraps the host's UI table (Host::UiApi() makes one; valid inside draw callbacks).
#[[nodiscard]] bool Available() const;False on a host without UI (the runtime target).
#[[nodiscard]] const KroysUiApi* Raw() const;The raw C table.
#void Text(const std::string& text) const;A line of text.
#void TextWrapped(const std::string& text) const;Text wrapped at the panel width.
#void TextColored(KroysThemeColor color, const std::string& text) const;Text in a theme colour (KroysThemeColor).
#void Heading(const std::string& text) const;A heading (larger, bold).
#void Icon(const char* name) const;A Lucide icon by name.
#bool Button(const std::string& label, uint32_t flags = 0u) const;A button (KROYS_UI_BUTTON_* flags); nonzero when clicked.
#bool IconButton(const std::string& id, const char* icon, const std::string& tooltip = {}) const;An icon button with a tooltip; nonzero when clicked.
#bool Checkbox(const std::string& label, bool& value) const;A checkbox editing *value (0 or 1); nonzero when toggled.
#bool InputText(const std::string& label, std::string& value, std::size_t capacity = 256u, uint32_t flags = 0u) const;Edits a std::string through a fixed buffer (capacity bytes including the terminator).
#bool InputInt(const std::string& label, int32_t& value) const;An integer field; nonzero when changed.
#bool InputFloat(const std::string& label, float& value) const;A float field; nonzero when changed.
#bool SliderFloat(const std::string& label, float& value, float minimum, float maximum) const;A slider from minimum to maximum; nonzero when changed.
#bool DragFloat3(const std::string& label, float* values, float speed = 0.1f) const;Three drag fields editing values[3] (a vector); nonzero when changed.
#bool Combo(const std::string& label, int32_t& index, const std::vector<std::string>& items) const;A dropdown over items editing *index; nonzero when the selection changed.
#bool Selectable(const std::string& label, bool selected) const;A selectable row; nonzero when clicked.
#void SameLine() const;The next item stays on this line.
#void Spacing() const;Vertical space.
#void Separator() const;A horizontal line.
#void SeparatorText(const std::string& text) const;A horizontal line with a caption.
#void Indent() const;Indents the following items.
#void Unindent() const;Ends an Indent.
#void SetNextItemWidth(float width) const;Width of the next item, in pixels.
#[[nodiscard]] float AvailableWidth() const;Remaining width on the current line, in pixels.
#void Tooltip(const std::string& text) const;Tooltip of the previous item (shown while hovered).
#[[nodiscard]] bool IsItemHovered() const;Nonzero when the previous item is hovered.
#[[nodiscard]] bool IsItemClicked() const;Nonzero when the previous item was clicked.
#[[nodiscard]] uint32_t ThemeColor(KroysThemeColor color) const;A theme colour (KroysThemeColor), packed RGBA8.
#[[nodiscard]] float ThemeMetric(KroysThemeMetric metric) const;A theme metric (KroysThemeMetric) in pixels (KROYS_METRIC_UI_SCALE: a factor).
#void ProgressBar(float fraction, const std::string& overlay = {}) const;2.1: falls back to text on an older engine.
#bool ColorEdit4(const std::string& label, float* rgba) const;An RGBA colour editor (rgba[4], 0..1); nonzero when changed.
Signatures
explicit Ui(const KroysHost* host); [[nodiscard]] bool Available() const; [[nodiscard]] const KroysUiApi* Raw() const; void Text(const std::string& text) const; void TextWrapped(const std::string& text) const; void TextColored(KroysThemeColor color, const std::string& text) const; void Heading(const std::string& text) const; void Icon(const char* name) const; bool Button(const std::string& label, uint32_t flags = 0u) const; bool IconButton(const std::string& id, const char* icon, const std::string& tooltip = {}) const; bool Checkbox(const std::string& label, bool& value) const; bool InputText(const std::string& label, std::string& value, std::size_t capacity = 256u, uint32_t flags = 0u) const; bool InputInt(const std::string& label, int32_t& value) const; bool InputFloat(const std::string& label, float& value) const; bool SliderFloat(const std::string& label, float& value, float minimum, float maximum) const; bool DragFloat3(const std::string& label, float* values, float speed = 0.1f) const; bool Combo(const std::string& label, int32_t& index, const std::vector<std::string>& items) const; bool Selectable(const std::string& label, bool selected) const; void SameLine() const; void Spacing() const; void Separator() const; void SeparatorText(const std::string& text) const; void Indent() const; void Unindent() const; void SetNextItemWidth(float width) const; [[nodiscard]] float AvailableWidth() const; void Tooltip(const std::string& text) const; [[nodiscard]] bool IsItemHovered() const; [[nodiscard]] bool IsItemClicked() const; [[nodiscard]] uint32_t ThemeColor(KroysThemeColor color) const; [[nodiscard]] float ThemeMetric(KroysThemeMetric metric) const; void ProgressBar(float fraction, const std::string& overlay = {}) const; bool ColorEdit4(const std::string& label, float* rgba) const;
KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.