Kemena3D
Loading...
Searching...
No Matches
kguimanager.h
Go to the documentation of this file.
1
5
6#ifndef KGUIMANAGER_H
7#define KGUIMANAGER_H
8
9#include "kexport.h"
10
11#include "kdatatype.h"
12#include "krenderer.h"
13#include "kwindow.h"
14
15#include <SDL3/SDL.h>
16
17#include "imgui.h"
18#include "imgui_internal.h"
19#include "backends/imgui_impl_sdl3.h"
20#include "backends/imgui_impl_opengl3.h"
21
22namespace kemena
23{
45 {
46 public:
49
51 virtual ~kGuiManager();
52
57 void init(kRenderer *newRenderer);
58
64
70
73
75 void canvasEnd();
76
77 // ---- Window ----
78
85 void windowStart(kString title, bool *open = nullptr, ImGuiWindowFlags flags = 0);
86
88 void windowEnd();
89
92
95
101 void setNextWindowSize(kVec2 size, ImGuiCond cond = 0);
102
109 void setNextWindowPos(kVec2 pos, ImGuiCond cond = 0, kVec2 pivot = kVec2(0, 0));
110
116
122 void setNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0);
123
126
131 void setNextWindowBgAlpha(float alpha);
132
138 bool isWindowFocused(ImGuiFocusedFlags flags = 0);
139
145 bool isWindowHovered(ImGuiHoveredFlags flags = 0);
146
152
158
161
162 // ---- Child Window ----
163
172 bool childStart(kString id, kVec2 size = kVec2(0, 0), ImGuiChildFlags childFlags = 0, ImGuiWindowFlags windowFlags = 0);
173
175 void childEnd();
176
177 // ---- Dockspace ----
178
184
187
188 // ---- Menu ----
189
191 bool menuBar();
194
202 void menuEnd();
203
212 bool menuItem(kString text, kString shortcut = "", bool selected = false, bool enabled = true);
213
222 bool menuItem(kString text, kString shortcut, bool *selected, bool enabled = true);
223
224 // ---- Layout ----
225
229 void groupEnd();
230
235 void beginDisabled(bool disabled = true);
236
239
245 void sameLine(float offsetFromStartX = 0.0f, float spacing = -1.0f);
246
248 void spacing();
250 void separator();
251
257
259 void newLine();
260
265 void indent(float indentW = 0.0f);
266
271 void unindent(float indentW = 0.0f);
272
277 void dummy(kVec2 size);
278
284
286 void setCursorPosX(float x);
288 void setCursorPosY(float y);
289
298
304
307
312 void setNextItemWidth(float itemWidth);
313
318 void pushItemWidth(float itemWidth);
323
328 void pushTextWrapPos(float wrapLocalPosX = 0.0f);
331
334
337
338 // ---- ID Stack ----
339
341 void pushId(kString id);
343 void pushId(int id);
345 void pushId(const void *ptr);
347 void popId();
348
349 // ---- Style ----
350
356 void pushStyleColor(ImGuiCol idx, kVec4 color);
357
363 void pushStyleColor(ImGuiCol idx, ImU32 color);
364
369 void popStyleColor(int count = 1);
370
376 void pushStyleVar(ImGuiStyleVar idx, float val);
377
383 void pushStyleVar(ImGuiStyleVar idx, kVec2 val);
384
389 void popStyleVar(int count = 1);
390
395 void pushFont(ImFont *font);
397 void popFont();
398
400 float getFontSize();
401
402 // ---- Text ----
403
406
413
416
421
428
432 void bullet();
433
441 kVec2 calcTextSize(kString text, bool hideTextAfterDoubleHash = false, float wrapWidth = -1.0f);
442
443 // ---- Buttons ----
444
451 bool button(kString text, kIvec2 size = kIvec2(0, 0));
452
459
467 bool invisibleButton(kString id, kVec2 size, ImGuiButtonFlags flags = 0);
468
475 bool arrowButton(kString id, ImGuiDir dir);
476
483 bool radioButton(kString label, bool active);
484
492 bool radioButton(kString label, int *v, int vButton);
493
494 // ---- Checkbox ----
495
502 bool checkbox(kString text, bool *output);
503
511 bool checkboxFlags(kString label, int *flags, int flagsValue);
512
520 bool checkboxFlags(kString label, unsigned int *flags, unsigned int flagsValue);
521
522 // ---- Input Text ----
523
532 bool inputText(kString label, kString &value, size_t maxLength = 256, ImGuiInputTextFlags flags = 0);
533
543 bool inputTextMultiline(kString label, kString &value, size_t maxLength = 1024, kVec2 size = kVec2(0, 0), ImGuiInputTextFlags flags = 0);
544
554 bool inputTextWithHint(kString label, kString hint, kString &value, size_t maxLength = 256, ImGuiInputTextFlags flags = 0);
555
556 // ---- Input Scalar ----
557
559 bool inputFloat(kString label, float *v, float step = 0.0f, float stepFast = 0.0f, kString format = "%.3f", ImGuiInputTextFlags flags = 0);
561 bool inputFloat2(kString label, float v[2], kString format = "%.3f", ImGuiInputTextFlags flags = 0);
563 bool inputFloat3(kString label, float v[3], kString format = "%.3f", ImGuiInputTextFlags flags = 0);
565 bool inputFloat4(kString label, float v[4], kString format = "%.3f", ImGuiInputTextFlags flags = 0);
567 bool inputInt(kString label, int *v, int step = 1, int stepFast = 100, ImGuiInputTextFlags flags = 0);
569 bool inputInt2(kString label, int v[2], ImGuiInputTextFlags flags = 0);
571 bool inputInt3(kString label, int v[3], ImGuiInputTextFlags flags = 0);
573 bool inputInt4(kString label, int v[4], ImGuiInputTextFlags flags = 0);
575 bool inputDouble(kString label, double *v, double step = 0.0, double stepFast = 0.0, kString format = "%.6f", ImGuiInputTextFlags flags = 0);
576
577 // ---- Drag ----
578
580 bool dragFloat(kString label, float *v, float speed = 1.0f, float min = 0.0f, float max = 0.0f, kString format = "%.3f", ImGuiSliderFlags flags = 0);
582 bool dragFloat2(kString label, float v[2], float speed = 1.0f, float min = 0.0f, float max = 0.0f, kString format = "%.3f", ImGuiSliderFlags flags = 0);
584 bool dragFloat3(kString label, float v[3], float speed = 1.0f, float min = 0.0f, float max = 0.0f, kString format = "%.3f", ImGuiSliderFlags flags = 0);
586 bool dragFloat4(kString label, float v[4], float speed = 1.0f, float min = 0.0f, float max = 0.0f, kString format = "%.3f", ImGuiSliderFlags flags = 0);
588 bool dragInt(kString label, int *v, float speed = 1.0f, int min = 0, int max = 0, kString format = "%d", ImGuiSliderFlags flags = 0);
590 bool dragInt2(kString label, int v[2], float speed = 1.0f, int min = 0, int max = 0, kString format = "%d", ImGuiSliderFlags flags = 0);
592 bool dragInt3(kString label, int v[3], float speed = 1.0f, int min = 0, int max = 0, kString format = "%d", ImGuiSliderFlags flags = 0);
594 bool dragInt4(kString label, int v[4], float speed = 1.0f, int min = 0, int max = 0, kString format = "%d", ImGuiSliderFlags flags = 0);
595
600 bool dragFloatRange2(kString label, float *vCurrentMin, float *vCurrentMax, float speed = 1.0f, float min = 0.0f, float max = 0.0f, kString format = "%.3f", kString formatMax = "", ImGuiSliderFlags flags = 0);
601
606 bool dragIntRange2(kString label, int *vCurrentMin, int *vCurrentMax, float speed = 1.0f, int min = 0, int max = 0, kString format = "%d", kString formatMax = "", ImGuiSliderFlags flags = 0);
607
608 // ---- Slider ----
609
611 bool sliderFloat(kString label, float *v, float min, float max, kString format = "%.3f", ImGuiSliderFlags flags = 0);
613 bool sliderFloat2(kString label, float v[2], float min, float max, kString format = "%.3f", ImGuiSliderFlags flags = 0);
615 bool sliderFloat3(kString label, float v[3], float min, float max, kString format = "%.3f", ImGuiSliderFlags flags = 0);
617 bool sliderFloat4(kString label, float v[4], float min, float max, kString format = "%.3f", ImGuiSliderFlags flags = 0);
618
623 bool sliderAngle(kString label, float *vRad, float vDegreesMin = -360.0f, float vDegreesMax = 360.0f, kString format = "%.0f deg", ImGuiSliderFlags flags = 0);
624
626 bool sliderInt(kString label, int *v, int min, int max, kString format = "%d", ImGuiSliderFlags flags = 0);
628 bool sliderInt2(kString label, int v[2], int min, int max, kString format = "%d", ImGuiSliderFlags flags = 0);
630 bool sliderInt3(kString label, int v[3], int min, int max, kString format = "%d", ImGuiSliderFlags flags = 0);
632 bool sliderInt4(kString label, int v[4], int min, int max, kString format = "%d", ImGuiSliderFlags flags = 0);
633
634 // ---- Color ----
635
637 bool colorEdit3(kString label, float col[3], ImGuiColorEditFlags flags = 0);
639 bool colorEdit4(kString label, float col[4], ImGuiColorEditFlags flags = 0);
641 bool colorPicker3(kString label, float col[3], ImGuiColorEditFlags flags = 0);
643 bool colorPicker4(kString label, float col[4], ImGuiColorEditFlags flags = 0);
644
653 bool colorButton(kString descId, kVec4 col, ImGuiColorEditFlags flags = 0, kVec2 size = kVec2(0, 0));
654
659 void setColorEditOptions(ImGuiColorEditFlags flags);
660
661 // ---- Combo / List / Selectable ----
662
671 bool combo(kString label, int *currentItem, std::vector<kString> items, int popupMaxHeightInItems = -1);
672
681 bool listBox(kString label, int *currentItem, std::vector<kString> items, int heightInItems = -1);
682
691 bool selectable(kString label, bool selected = false, ImGuiSelectableFlags flags = 0, kVec2 size = kVec2(0, 0));
692
701 bool selectable(kString label, bool *pSelected, ImGuiSelectableFlags flags = 0, kVec2 size = kVec2(0, 0));
702
703 // ---- Tree / Collapsing ----
704
710 bool treeStart(kString label);
711
719 bool treeStartEx(kString id, kString label = "", ImGuiTreeNodeFlags flags = 0);
720
722 void treeEnd();
724 void treePop();
725
732 bool collapsingHeader(kString label, ImGuiTreeNodeFlags flags = 0);
733
741 bool collapsingHeader(kString label, bool *visible, ImGuiTreeNodeFlags flags = 0);
742
748 void setNextItemOpen(bool isOpen, ImGuiCond cond = 0);
749
750 // ---- Image ----
751
759 void image(GLuint textureId, kVec2 size, kVec2 uv0 = kVec2(0, 0), kVec2 uv1 = kVec2(1, 1));
760
771 bool imageButton(kString id, GLuint textureId, kVec2 size, kVec2 uv0 = kVec2(0, 0), kVec2 uv1 = kVec2(1, 1), kVec4 tint = kVec4(1, 1, 1, 1));
772
773 // ---- Progress ----
774
781 void progressBar(float fraction, kVec2 size = kVec2(-FLT_MIN, 0), kString overlay = "");
782
783 // ---- Tooltip ----
784
790
795
796 // ---- Popup ----
797
803 void openPopup(kString id, ImGuiPopupFlags flags = 0);
804
811 bool popupStart(kString id, ImGuiWindowFlags flags = 0);
812
814 void popupEnd();
815
823 bool popupModal(kString name, bool *open = nullptr, ImGuiWindowFlags flags = 0);
824
831 bool popupContextItemStart(kString id = "", ImGuiPopupFlags flags = ImGuiPopupFlags_MouseButtonRight);
832
839 bool popupContextWindowStart(kString id = "", ImGuiPopupFlags flags = ImGuiPopupFlags_MouseButtonRight);
840
847 bool isPopupOpen(kString id, ImGuiPopupFlags flags = 0);
848
851
852 // ---- Tab Bar ----
853
860 bool tabBarStart(kString id, ImGuiTabBarFlags flags = 0);
862 void tabBarEnd();
863
871 bool tabItemStart(kString label, bool *open = nullptr, ImGuiTabItemFlags flags = 0);
874
879 void setTabItemClosed(kString tabOrDockedWindowLabel);
880
881 // ---- Tables ----
882
892 bool tableStart(kString id, int columns, ImGuiTableFlags flags = 0, kVec2 outerSize = kVec2(0, 0), float innerWidth = 0.0f);
894 void tableEnd();
895
901
907 bool tableSetColumnIndex(int columnN);
908
914 void tableNextRow(ImGuiTableRowFlags rowFlags = 0, float minRowHeight = 0.0f);
915
922 void tableSetupColumn(kString label, ImGuiTableColumnFlags flags = 0, float initWidthOrWeight = 0.0f);
923
929 void tableSetupScrollFreeze(int cols, int rows);
930
933
938 void tableHeader(kString label);
939
940 // ---- Columns ----
941
949 void columnsStart(int count = 1, kString id = "", bool borders = true);
950
953
956
961 float getColumnWidth(int columnIndex = -1);
962
963 // ---- Scroll ----
964
966 float getScrollX();
968 float getScrollY();
970 void setScrollX(float scrollX);
972 void setScrollY(float scrollY);
981 void setScrollHereX(float centerXRatio = 0.5f);
986 void setScrollHereY(float centerYRatio = 0.5f);
987
988 // ---- Item Queries ----
989
991 bool isItemHovered(ImGuiHoveredFlags flags = 0);
997 bool isItemClicked(ImGuiMouseButton mouseButton = 0);
1022
1028
1029 // ---- Mouse ----
1030
1032 bool isMouseDown(ImGuiMouseButton button);
1034 bool isMouseClicked(ImGuiMouseButton button, bool repeat = false);
1036 bool isMouseReleased(ImGuiMouseButton button);
1038 bool isMouseDoubleClicked(ImGuiMouseButton button);
1045 bool isMouseHoveringRect(kVec2 rMin, kVec2 rMax, bool clip = true);
1052
1053 // ---- Keyboard ----
1054
1057
1060
1063
1066
1067 // ---- Draw ----
1068
1078 void drawListAddImage(GLuint textureId, kVec2 pMin, kVec2 pMax, kVec2 uvMin = kVec2(0, 0), kVec2 uvMax = kVec2(1, 1), kVec4 tint = kVec4(1, 1, 1, 1));
1079
1082
1085
1086 // ---- Utility ----
1087
1093
1099
1105
1111 void loadIniSettingsFromMemory(const char *data, size_t size);
1112
1117 void addSettingsHandler(ImGuiSettingsHandler handler);
1118
1122 void destroy();
1123
1124 protected:
1125 private:
1126 float mainScale;
1127 kRenderer *renderer;
1128 };
1129}
1130
1131#endif // KGUIMANAGER_H
kVec2 calcTextSize(kString text, bool hideTextAfterDoubleHash=false, float wrapWidth=-1.0f)
Returns the rendered size of a text kString.
bool imageButton(kString id, GLuint textureId, kVec2 size, kVec2 uv0=kVec2(0, 0), kVec2 uv1=kVec2(1, 1), kVec4 tint=kVec4(1, 1, 1, 1))
Renders a GPU texture as a clickable image button.
float getMouseWheel()
Returns the vertical mouse wheel delta.
void setNextWindowFocus()
Gives input focus to the next window.
bool button(kString text, kIvec2 size=kIvec2(0, 0))
Renders a push-button.
bool combo(kString label, int *currentItem, std::vector< kString > items, int popupMaxHeightInItems=-1)
Drop-down combo box.
void closeCurrentPopup()
Closes the currently open popup.
bool isItemDeactivatedAfterEdit()
Returns whether the last widget became inactive after being edited.
bool sliderInt2(kString label, int v[2], int min, int max, kString format="%d", ImGuiSliderFlags flags=0)
Horizontal slider for two integers.
float getScrollMaxX()
Returns the maximum horizontal scroll position.
void popupEnd()
Ends the current popup.
kVec2 getWindowContentRegionMin()
Returns the content region minimum bound in window-local coordinates.
kVec2 getWindowPos()
Returns the screen-space position of the current window.
bool isMouseDown(ImGuiMouseButton button)
Returns whether a mouse button is held down.
bool inputDouble(kString label, double *v, double step=0.0, double stepFast=0.0, kString format="%.6f", ImGuiInputTextFlags flags=0)
Double-precision float input.
bool dragFloatRange2(kString label, float *vCurrentMin, float *vCurrentMax, float speed=1.0f, float min=0.0f, float max=0.0f, kString format="%.3f", kString formatMax="", ImGuiSliderFlags flags=0)
Drag widget for a float range (min + max pair).
bool dragInt4(kString label, int v[4], float speed=1.0f, int min=0, int max=0, kString format="%d", ImGuiSliderFlags flags=0)
Drag widget for four integers.
void spacing()
Inserts a small vertical space.
void tableSetupColumn(kString label, ImGuiTableColumnFlags flags=0, float initWidthOrWeight=0.0f)
Sets up a table column with optional flags and initial width.
bool sliderInt3(kString label, int v[3], int min, int max, kString format="%d", ImGuiSliderFlags flags=0)
Horizontal slider for three integers.
kVec2 getItemRectSize()
Returns the bounding box size of the last item.
void setScrollHereY(float centerYRatio=0.5f)
Scrolls so the current item is visible vertically.
void separatorText(kString text)
Draws a horizontal separator with a centred text label.
bool dragInt2(kString label, int v[2], float speed=1.0f, int min=0, int max=0, kString format="%d", ImGuiSliderFlags flags=0)
Drag widget for two integers.
void bullet()
Renders a bullet point without text.
bool radioButton(kString label, int *v, int vButton)
Renders a radio button linked to an integer variable.
bool isItemToggledOpen()
Returns whether the last tree node was toggled open.
bool isItemFocused()
Returns whether the last widget has keyboard focus.
bool collapsingHeader(kString label, bool *visible, ImGuiTreeNodeFlags flags=0)
Collapsible section header with a close button.
void tableEnd()
Ends the current table.
bool tabItemStart(kString label, bool *open=nullptr, ImGuiTabItemFlags flags=0)
Begins a tab item inside a tab bar.
float getCursorPosX()
Returns the cursor X position.
kVec2 getItemRectMax()
Returns the bounding box maximum of the last item (screen space).
bool inputText(kString label, kString &value, size_t maxLength=256, ImGuiInputTextFlags flags=0)
Renders a single-line text input field.
bool checkboxFlags(kString label, unsigned int *flags, unsigned int flagsValue)
Renders a checkbox backed by integer flags (unsigned).
bool dragFloat4(kString label, float v[4], float speed=1.0f, float min=0.0f, float max=0.0f, kString format="%.3f", ImGuiSliderFlags flags=0)
Drag widget for four floats.
void setCursorPos(kVec2 pos)
Moves the cursor to an absolute position within the window.
void beginDisabled(bool disabled=true)
Disables all user interaction and dims widgets.
bool tableNextColumn()
Advances to the next column in the current row.
void pushStyleColor(ImGuiCol idx, kVec4 color)
Pushes a colour override for an ImGui style element.
bool menuItem(kString text, kString shortcut, bool *selected, bool enabled=true)
Adds a toggleable menu item backed by a bool.
float getFrameHeightWithSpacing()
Returns the height of a framed widget plus item spacing (distance between two consecutive widget rows...
bool dragFloat(kString label, float *v, float speed=1.0f, float min=0.0f, float max=0.0f, kString format="%.3f", ImGuiSliderFlags flags=0)
Drag widget for a single float.
bool checkboxFlags(kString label, int *flags, int flagsValue)
Renders a checkbox backed by integer flags (signed).
bool invisibleButton(kString id, kVec2 size, ImGuiButtonFlags flags=0)
Renders an invisible hit-area button.
kVec2 getWindowSize()
Returns the inner size of the current window in pixels.
bool tableStart(kString id, int columns, ImGuiTableFlags flags=0, kVec2 outerSize=kVec2(0, 0), float innerWidth=0.0f)
Begins a table layout.
void drawListAddImage(GLuint textureId, kVec2 pMin, kVec2 pMax, kVec2 uvMin=kVec2(0, 0), kVec2 uvMax=kVec2(1, 1), kVec4 tint=kVec4(1, 1, 1, 1))
Draws a textured rectangle directly onto the window draw list.
float getColumnWidth(int columnIndex=-1)
Returns the width of a column in pixels.
bool isMouseHoveringRect(kVec2 rMin, kVec2 rMax, bool clip=true)
Returns whether the mouse is inside the given screen-space rectangle.
void text(kString text)
Renders a plain text kString.
float getTextLineHeight()
Returns the height of a single text line in pixels.
void setNextWindowPos(kVec2 pos, ImGuiCond cond=0, kVec2 pivot=kVec2(0, 0))
Sets the position of the next window before it is created.
bool dragInt(kString label, int *v, float speed=1.0f, int min=0, int max=0, kString format="%d", ImGuiSliderFlags flags=0)
Drag widget for a single integer.
void pushTextWrapPos(float wrapLocalPosX=0.0f)
Pushes a text wrap position onto the stack.
kVec2 getCursorScreenPos()
Returns the cursor position in screen coordinates.
void setNextItemAllowOverlap()
Allows the next item to overlap previously drawn items. Call this before the item that should allow o...
void nextColumn()
Advances to the next column (wraps to the next row when needed).
kVec2 getMousePos()
Returns the current mouse position in screen coordinates.
void setNextWindowContentSize(kVec2 size)
Sets the content size of the next window.
void windowStart(kString title, bool *open=nullptr, ImGuiWindowFlags flags=0)
Begins an ImGui window.
void setNextItemOpen(bool isOpen, ImGuiCond cond=0)
Sets the open state of the next tree node.
bool sliderFloat4(kString label, float v[4], float min, float max, kString format="%.3f", ImGuiSliderFlags flags=0)
Horizontal slider for four floats.
bool sliderInt(kString label, int *v, int min, int max, kString format="%d", ImGuiSliderFlags flags=0)
Horizontal slider for a single integer.
bool listBox(kString label, int *currentItem, std::vector< kString > items, int heightInItems=-1)
Scrollable list box.
void indent(float indentW=0.0f)
Moves the cursor right by indentW pixels.
float getFontSize()
Returns the current scaled font size in pixels.
void dummy(kVec2 size)
Inserts an invisible widget of a given size for layout spacing.
void pushStyleColor(ImGuiCol idx, ImU32 color)
Pushes a packed colour override.
bool isItemDeactivated()
Returns whether the last widget became inactive this frame.
bool isItemActive()
Returns whether the last widget is active (e.g. being dragged).
bool treeStart(kString label)
Begins a tree node (uses label as ID).
bool isItemHovered(ImGuiHoveredFlags flags=0)
Returns whether the last widget is hovered.
bool tabBarStart(kString id, ImGuiTabBarFlags flags=0)
Begins a tab bar container.
bool sliderAngle(kString label, float *vRad, float vDegreesMin=-360.0f, float vDegreesMax=360.0f, kString format="%.0f deg", ImGuiSliderFlags flags=0)
Horizontal slider that displays and edits an angle in degrees.
bool inputInt(kString label, int *v, int step=1, int stepFast=100, ImGuiInputTextFlags flags=0)
Single integer input.
void init(kRenderer *newRenderer)
Initialises ImGui with the given renderer's context and window.
void popId()
Pops the last ID from the ID stack.
bool popupStart(kString id, ImGuiWindowFlags flags=0)
Begins rendering a named popup.
bool isItemVisible()
Returns whether the last widget is visible in the clipping rectangle.
bool selectable(kString label, bool *pSelected, ImGuiSelectableFlags flags=0, kVec2 size=kVec2(0, 0))
Selectable row (state passed by pointer).
bool sliderInt4(kString label, int v[4], int min, int max, kString format="%d", ImGuiSliderFlags flags=0)
Horizontal slider for four integers.
void textDisabled(kString text)
Renders greyed-out (disabled) text.
void tableNextRow(ImGuiTableRowFlags rowFlags=0, float minRowHeight=0.0f)
Begins a new table row.
bool inputInt2(kString label, int v[2], ImGuiInputTextFlags flags=0)
Two-component integer input.
bool checkbox(kString text, bool *output)
Renders a checkbox.
kVec2 getContentRegionAvail()
Returns the available content region size in the current window.
void alignTextToFramePadding()
Vertically aligns the next widget so its baseline lines up with text.
bool sliderFloat(kString label, float *v, float min, float max, kString format="%.3f", ImGuiSliderFlags flags=0)
Horizontal slider for a single float.
void labelText(kString label, kString text)
Renders a label/value pair aligned to the value column.
bool menu(kString text)
Begins a named menu.
virtual ~kGuiManager()
Destroys the GUI manager, releasing any held ImGui resources.
void popStyleColor(int count=1)
Pops colour overrides from the style stack.
void groupEnd()
Ends a layout group.
void tableHeader(kString label)
Renders a single header cell.
void loadIniSettingsFromDisk(kString filename)
Loads ImGui layout state from a .ini file.
void popTextWrapPos()
Pops the last text wrap position.
bool dragIntRange2(kString label, int *vCurrentMin, int *vCurrentMax, float speed=1.0f, int min=0, int max=0, kString format="%d", kString formatMax="", ImGuiSliderFlags flags=0)
Drag widget for an integer range (min + max pair).
bool menuItem(kString text, kString shortcut="", bool selected=false, bool enabled=true)
Adds a clickable menu item.
void menuBarEnd()
Ends the main menu bar.
bool isMouseReleased(ImGuiMouseButton button)
Returns whether a mouse button was released this frame.
void setClipboardText(kString text)
Sets the OS clipboard text.
bool isAnyItemActive()
Returns whether any widget is currently active.
void pushFont(ImFont *font)
Pushes a font onto the font stack.
float getCursorPosY()
Returns the cursor Y position.
void setNextWindowCollapsed(bool collapsed, ImGuiCond cond=0)
Sets the collapsed state of the next window.
bool childStart(kString id, kVec2 size=kVec2(0, 0), ImGuiChildFlags childFlags=0, ImGuiWindowFlags windowFlags=0)
Begins a scrollable child region.
bool inputFloat(kString label, float *v, float step=0.0f, float stepFast=0.0f, kString format="%.3f", ImGuiInputTextFlags flags=0)
Single float input.
kGuiManager()
Constructs an uninitialised GUI manager; call init() before use.
void sameLine(float offsetFromStartX=0.0f, float spacing=-1.0f)
Places the next widget on the same line as the previous one.
void pushItemWidth(float itemWidth)
Pushes a width onto the item-width stack.
void newLine()
Inserts a blank line in the layout.
kVec2 getItemRectMin()
Returns the bounding box minimum of the last item (screen space).
void popStyleVar(int count=1)
Pops style variable overrides from the stack.
bool popupModal(kString name, bool *open=nullptr, ImGuiWindowFlags flags=0)
Begins a modal popup dialog.
void progressBar(float fraction, kVec2 size=kVec2(-FLT_MIN, 0), kString overlay="")
Renders a horizontal progress bar.
bool colorButton(kString descId, kVec4 col, ImGuiColorEditFlags flags=0, kVec2 size=kVec2(0, 0))
Renders a small coloured square button.
void menuEnd()
Ends the current menu.
void addSettingsHandler(ImGuiSettingsHandler handler)
Registers a custom .ini settings handler.
void setNextItemWidth(float itemWidth)
Sets the width of the next widget.
void pushId(int id)
Pushes an integer ID onto the ID stack.
float getScrollMaxY()
Returns the maximum vertical scroll position.
void separator()
Draws a horizontal separator line.
bool colorEdit3(kString label, float col[3], ImGuiColorEditFlags flags=0)
RGB colour editor widget.
void setNextWindowBgAlpha(float alpha)
Sets the background transparency of the next window.
bool tableSetColumnIndex(int columnN)
Sets the current column index explicitly.
void windowEnd()
Ends the current ImGui window.
void setColorEditOptions(ImGuiColorEditFlags flags)
Sets global colour edit display options.
bool isKeyCtrl()
Returns true if the Ctrl modifier key is currently held.
bool isItemActivated()
Returns whether the last widget became active this frame.
bool isItemClicked(ImGuiMouseButton mouseButton=0)
Returns whether the last widget was clicked.
bool inputInt4(kString label, int v[4], ImGuiInputTextFlags flags=0)
Four-component integer input.
bool radioButton(kString label, bool active)
Renders a radio button.
void tabBarEnd()
Ends the current tab bar.
bool isAnyItemHovered()
Returns whether any widget is currently hovered.
void saveIniSettingsToDisk(kString filename)
Saves the current ImGui layout state to a .ini file.
void image(GLuint textureId, kVec2 size, kVec2 uv0=kVec2(0, 0), kVec2 uv1=kVec2(1, 1))
Renders a GPU texture as an image widget.
bool sliderFloat2(kString label, float v[2], float min, float max, kString format="%.3f", ImGuiSliderFlags flags=0)
Horizontal slider for two floats.
bool popupContextWindowStart(kString id="", ImGuiPopupFlags flags=ImGuiPopupFlags_MouseButtonRight)
Begins a context menu popup on right-click of the current window.
bool isWindowFocused(ImGuiFocusedFlags flags=0)
Returns whether the current window has keyboard focus.
void textUnformatted(kString text)
Renders a raw string without label formatting.
void pushId(const void *ptr)
Pushes a pointer ID onto the ID stack.
bool treeStartEx(kString id, kString label="", ImGuiTreeNodeFlags flags=0)
Begins a tree node with explicit ID and label.
bool dragInt3(kString label, int v[3], float speed=1.0f, int min=0, int max=0, kString format="%d", ImGuiSliderFlags flags=0)
Drag widget for three integers.
void beginTooltip()
Begins a custom tooltip popup.
bool colorPicker4(kString label, float col[4], ImGuiColorEditFlags flags=0)
RGBA colour picker widget.
bool isItemEdited()
Returns whether the last widget's value was edited this frame.
void textWrapped(kString text)
Renders text that wraps at the wrap position.
kVec2 getMainViewportCenter()
Returns the center of the main viewport in screen coordinates.
void tabItemEnd()
Ends the current tab item.
void canvasEnd()
Renders all ImGui draw data and ends the frame.
bool sliderFloat3(kString label, float v[3], float min, float max, kString format="%.3f", ImGuiSliderFlags flags=0)
Horizontal slider for three floats.
bool popupContextItemStart(kString id="", ImGuiPopupFlags flags=ImGuiPopupFlags_MouseButtonRight)
Begins a context menu popup on right-click of the last item.
void setCursorPosY(float y)
Sets the cursor Y position.
bool dragFloat3(kString label, float v[3], float speed=1.0f, float min=0.0f, float max=0.0f, kString format="%.3f", ImGuiSliderFlags flags=0)
Drag widget for three floats.
bool isAnyItemFocused()
Returns whether any widget currently has focus.
bool isPopupOpen(kString id, ImGuiPopupFlags flags=0)
Returns whether a named popup is currently open.
void setCursorScreenPos(kVec2 pos)
Moves the cursor to an absolute screen-space position.
kVec2 getCursorPos()
Returns the cursor position relative to the window.
void pushStyleVar(ImGuiStyleVar idx, float val)
Pushes a float style variable override.
void pushStyleVar(ImGuiStyleVar idx, kVec2 val)
Pushes a kVec2 style variable override.
bool getWantTextInput()
Returns true if any ImGui widget currently wants text input.
void pushId(kString id)
Pushes a kString ID onto the ID stack.
void popItemWidth()
Pops the last item width from the stack.
void columnsStart(int count=1, kString id="", bool borders=true)
Begins a legacy multi-column layout.
bool inputInt3(kString label, int v[3], ImGuiInputTextFlags flags=0)
Three-component integer input.
void endDisabled()
Ends a disabled section opened with beginDisabled().
bool inputFloat3(kString label, float v[3], kString format="%.3f", ImGuiInputTextFlags flags=0)
Three-component float input.
bool dragFloat2(kString label, float v[2], float speed=1.0f, float min=0.0f, float max=0.0f, kString format="%.3f", ImGuiSliderFlags flags=0)
Drag widget for two floats.
void setScrollHereX(float centerXRatio=0.5f)
Scrolls so the current item is visible horizontally.
void popFont()
Pops the last font from the font stack.
bool colorPicker3(kString label, float col[3], ImGuiColorEditFlags flags=0)
RGB colour picker widget.
void treePop()
Pops the tree indent regardless of whether the node is open.
void textColored(kVec4 color, kString text)
Renders coloured text.
bool inputTextWithHint(kString label, kString hint, kString &value, size_t maxLength=256, ImGuiInputTextFlags flags=0)
Renders a single-line text input with a placeholder hint.
float getScrollX()
Returns the current horizontal scroll position.
bool selectable(kString label, bool selected=false, ImGuiSelectableFlags flags=0, kVec2 size=kVec2(0, 0))
Selectable row (state passed by value).
bool arrowButton(kString id, ImGuiDir dir)
Renders an arrow-shaped button.
void columnsEnd()
Resets to a single-column layout, ending the columns region.
void setCursorPosX(float x)
Sets the cursor X position.
bool smallButton(kString text)
Renders a small inline push-button.
void tableSetupScrollFreeze(int cols, int rows)
Freezes leading columns/rows so they remain visible while scrolling.
void loadIniSettingsFromMemory(const char *data, size_t size)
Loads ImGui layout state from an in-memory .ini blob.
void endTooltip()
Ends the current tooltip popup.
bool inputTextMultiline(kString label, kString &value, size_t maxLength=1024, kVec2 size=kVec2(0, 0), ImGuiInputTextFlags flags=0)
Renders a multi-line text input field.
kVec2 getMouseDelta()
Returns the mouse position delta since the last frame.
void unindent(float indentW=0.0f)
Moves the cursor left by indentW pixels.
bool inputFloat4(kString label, float v[4], kString format="%.3f", ImGuiInputTextFlags flags=0)
Four-component float input.
void childEnd()
Ends the current child region. Always call this after childStart().
bool colorEdit4(kString label, float col[4], ImGuiColorEditFlags flags=0)
RGBA colour editor widget.
float getScrollY()
Returns the current vertical scroll position.
bool isMouseDoubleClicked(ImGuiMouseButton button)
Returns whether a mouse button was double-clicked this frame.
float getFrameHeight()
Returns the height of a typical framed widget in pixels (FontSize + FramePadding * 2).
bool isKeyShift()
Returns true if the Shift modifier key is currently held.
bool isMouseClicked(ImGuiMouseButton button, bool repeat=false)
Returns whether a mouse button was clicked this frame.
void dockSpaceEnd()
Ends the current dockspace (no-op; kept for symmetry).
void processEvent(kSystemEvent event)
Forwards a system event to ImGui for input processing.
float calcItemWidth()
Returns the current item width calculated by ImGui.
void setItemTooltip(kString text)
Sets a tooltip shown when the last item is hovered.
void setTabItemClosed(kString tabOrDockedWindowLabel)
Marks a tab (or docked window) as closed programmatically.
void treeEnd()
Ends the current tree node (use when treeStart returned true).
bool isWindowHovered(ImGuiHoveredFlags flags=0)
Returns whether the mouse is hovering over the current window.
bool inputFloat2(kString label, float v[2], kString format="%.3f", ImGuiInputTextFlags flags=0)
Two-component float input.
void bulletText(kString text)
Renders text preceded by a bullet point.
void groupStart()
Begins a layout group.
bool menuBar()
Begins the main menu bar.
void canvasStart()
Begins a new ImGui frame (call once per render frame).
void setNextWindowSize(kVec2 size, ImGuiCond cond=0)
Sets the size of the next window before it is created.
void loadDefaultFontFromResource(kString resourceName)
Loads and sets the default ImGui font from a Windows resource.
void openPopup(kString id, ImGuiPopupFlags flags=0)
Opens a named popup on the next frame.
void dockSpaceStart(kString name)
Begins a full-window docking area.
float getDeltaTime()
Returns the time in seconds elapsed since the last frame.
void tableHeadersRow()
Renders the header row using labels set by tableSetupColumn().
void destroy()
Shuts down ImGui and releases backend resources.
void setScrollY(float scrollY)
Sets the vertical scroll position.
bool collapsingHeader(kString label, ImGuiTreeNodeFlags flags=0)
Collapsible section header.
void setScrollX(float scrollX)
Sets the horizontal scroll position.
kVec2 getWindowContentRegionMax()
Returns the content region maximum bound in window-local coordinates.
Orchestrates the full render pipeline for a scene.
Definition krenderer.h:67
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
High-level renderer that orchestrates the render pipeline.
Application window management backed by SDL3.
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
glm::ivec2 kIvec2
2-component integer vector.
Definition kdatatype.h:35
std::string kString
Standard string alias.
Definition kdatatype.h:42
glm::vec2 kVec2
2-component float vector.
Definition kdatatype.h:32
glm::vec4 kVec4
4-component float vector.
Definition kdatatype.h:34
Wraps an SDL_Event and provides helper accessors for input polling.
Definition kdatatype.h:427