15#if(defined(__clang__) || defined(__GNUC__))
16#define KG_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
17#define KG_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
19#define KG_FMTARGS(FMT)
20#define KG_FMTLIST(FMT)
23#define KG_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR))))
24#define KG_UNUSED(_VAR) ((void)(_VAR))
25#define KG_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER)
74enum KarmaGuiKey : int;
76typedef int KarmaGuiCol;
77typedef int KarmaGuiCond;
78typedef int KarmaGuiDataType;
79typedef int KarmaGuiDir;
80typedef int KarmaGuiMouseButton;
81typedef int KarmaGuiMouseCursor;
82typedef int KarmaGuiSortDirection;
83typedef int KarmaGuiStyleVar;
84typedef int KarmaGuiTableBgTarget;
87typedef int KGDrawFlags;
88typedef int KGDrawListFlags;
89typedef int KGFontAtlasFlags;
90typedef int KarmaGuiBackendFlags;
91typedef int KarmaGuiButtonFlags;
92typedef int KarmaGuiColorEditFlags;
93typedef int KarmaGuiConfigFlags;
94typedef int KarmaGuiComboFlags;
95typedef int KarmaGuiDockNodeFlags;
96typedef int KarmaGuiDragDropFlags;
97typedef int KarmaGuiFocusedFlags;
98typedef int KarmaGuiHoveredFlags;
99typedef int KarmaGuiInputFlags;
100typedef int KarmaGuiInputTextFlags;
101typedef int KarmaGuiKeyChord;
102typedef int KarmaGuiPopupFlags;
103typedef int KarmaGuiSelectableFlags;
104typedef int KarmaGuiSliderFlags;
105typedef int KarmaGuiTabBarFlags;
106typedef int KarmaGuiTabItemFlags;
107typedef int KarmaGuiTableFlags;
108typedef int KarmaGuiTableColumnFlags;
109typedef int KarmaGuiTableRowFlags;
110typedef int KarmaGuiTreeNodeFlags;
111typedef int KarmaGuiViewportFlags;
112typedef int KarmaGuiWindowFlags;
113typedef void* KGTextureID;
120typedef unsigned short KGDrawIdx;
129typedef unsigned int KGGuiID;
130typedef signed char KGS8;
131typedef unsigned char KGU8;
132typedef signed short KGS16;
133typedef unsigned short KGU16;
134typedef signed int KGS32;
135typedef unsigned int KGU32;
136typedef signed long long KGS64;
137typedef unsigned long long KGU64;
141typedef unsigned short KGWchar16;
142typedef KGWchar16 KGWchar;
147typedef void* (*KarmaGuiMemAllocFunc)(
size_t sz,
void* user_data);
148typedef void (*KarmaGuiMemFreeFunc)(
void* ptr,
void* user_data);
155 constexpr KGVec2() : x(0.0f), y(0.0f) { }
156 constexpr KGVec2(
float _x,
float _y) : x(_x), y(_y) { }
157 float operator[] (
size_t idx)
const { KR_CORE_ASSERT(idx <= 1,
"");
return (&x)[idx]; }
158 float& operator[] (
size_t idx) { KR_CORE_ASSERT(idx <= 1,
"");
return (&x)[idx]; }
165 constexpr KGVec4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) { }
166 constexpr KGVec4(
float _x,
float _y,
float _z,
float _w) : x(_x), y(_y), z(_z), w(_w) { }
167#ifdef KG_VEC4_CLASS_EXTRA
199 static void NewFrame();
200 static void EndFrame();
211 static void ShowDemoWindow(
bool* p_open = NULL);
212 static void ShowMetricsWindow(
bool* p_open = NULL);
213 static void ShowDebugLogWindow(
bool* p_open = NULL);
214 static void ShowStackToolWindow(
bool* p_open = NULL);
215 static void ShowAboutWindow(
bool* p_open = NULL);
217 static bool ShowStyleSelector(
const char* label);
218 static void ShowFontSelector(
const char* label);
219 static void ShowUserGuide();
239 static bool Begin(
const char* name,
bool* p_open = NULL, KarmaGuiWindowFlags flags = 0);
250 static bool BeginChild(
const char* str_id,
const KGVec2& size =
KGVec2(0, 0),
bool border =
false, KarmaGuiWindowFlags flags = 0);
251 static bool BeginChild(KGGuiID
id,
const KGVec2& size =
KGVec2(0, 0),
bool border =
false, KarmaGuiWindowFlags flags = 0);
252 static void EndChild();
256 static bool IsWindowAppearing();
257 static bool IsWindowCollapsed();
258 static bool IsWindowFocused(KarmaGuiFocusedFlags flags=0);
259 static bool IsWindowHovered(KarmaGuiHoveredFlags flags=0);
261 static float GetWindowDpiScale();
262 static KGVec2 GetWindowPos();
263 static KGVec2 GetWindowSize();
264 static float GetWindowWidth();
265 static float GetWindowHeight();
270 static void SetNextWindowPos(
const KGVec2& pos, KarmaGuiCond cond = 0,
const KGVec2& pivot =
KGVec2(0, 0));
271 static void SetNextWindowSize(
const KGVec2& size, KarmaGuiCond cond = 0);
272 static void SetNextWindowSizeConstraints(
const KGVec2& size_min,
const KGVec2& size_max, KarmaGuiSizeCallback custom_callback = NULL,
void* custom_callback_data = NULL);
273 static void SetNextWindowContentSize(
const KGVec2& size);
274 static void SetNextWindowCollapsed(
bool collapsed, KarmaGuiCond cond = 0);
275 static void SetNextWindowFocus();
276 static void SetNextWindowScroll(
const KGVec2& scroll);
277 static void SetNextWindowBgAlpha(
float alpha);
278 static void SetNextWindowViewport(KGGuiID viewport_id);
279 static void SetWindowPos(
const KGVec2& pos, KarmaGuiCond cond = 0);
280 static void SetWindowSize(
const KGVec2& size, KarmaGuiCond cond = 0);
281 static void SetWindowCollapsed(
bool collapsed, KarmaGuiCond cond = 0);
282 static void SetWindowFocus();
283 static void SetWindowFontScale(
float scale);
284 static void SetWindowPos(
const char* name,
const KGVec2& pos, KarmaGuiCond cond = 0);
285 static void SetWindowSize(
const char* name,
const KGVec2& size, KarmaGuiCond cond = 0);
286 static void SetWindowCollapsed(
const char* name,
bool collapsed, KarmaGuiCond cond = 0);
287 static void SetWindowFocus(
const char* name);
292 static KGVec2 GetContentRegionAvail();
293 static KGVec2 GetContentRegionMax();
294 static KGVec2 GetWindowContentRegionMin();
295 static KGVec2 GetWindowContentRegionMax();
300 static float GetScrollX();
301 static float GetScrollY();
302 static void SetScrollX(
float scroll_x);
303 static void SetScrollY(
float scroll_y);
304 static float GetScrollMaxX();
305 static float GetScrollMaxY();
306 static void SetScrollHereX(
float center_x_ratio = 0.5f);
307 static void SetScrollHereY(
float center_y_ratio = 0.5f);
308 static void SetScrollFromPosX(
float local_x,
float center_x_ratio = 0.5f);
309 static void SetScrollFromPosY(
float local_y,
float center_y_ratio = 0.5f);
312 static void PushFont(
KGFont* font);
313 static void PopFont();
314 static void PushStyleColor(KarmaGuiCol idx, KGU32 col);
315 static void PushStyleColor(KarmaGuiCol idx,
const KGVec4& col);
316 static void PopStyleColor(
int count = 1);
317 static void PushStyleVar(KarmaGuiStyleVar idx,
float val);
318 static void PushStyleVar(KarmaGuiStyleVar idx,
const KGVec2& val);
319 static void PopStyleVar(
int count = 1);
320 static void PushAllowKeyboardFocus(
bool allow_keyboard_focus);
321 static void PopAllowKeyboardFocus();
322 static void PushButtonRepeat(
bool repeat);
323 static void PopButtonRepeat();
326 static void PushItemWidth(
float item_width);
327 static void PopItemWidth();
328 static void SetNextItemWidth(
float item_width);
329 static float CalcItemWidth();
330 static void PushTextWrapPos(
float wrap_local_pos_x = 0.0f);
331 static void PopTextWrapPos();
336 static float GetFontSize();
337 static KGVec2 GetFontTexUvWhitePixel();
338 static KGU32 GetColorU32(KarmaGuiCol idx,
float alpha_mul = 1.0f);
339 static KGU32 GetColorU32(
const KGVec4& col);
340 static KGU32 GetColorU32(KGU32 col);
341 static const KGVec4& GetStyleColorVec4(KarmaGuiCol idx);
350 static void Separator();
351 static void SameLine(
float offset_from_start_x=0.0f,
float spacing=-1.0f);
352 static void NewLine();
353 static void Spacing();
354 static void Dummy(
const KGVec2& size);
355 static void Indent(
float indent_w = 0.0f);
356 static void Unindent(
float indent_w = 0.0f);
357 static void BeginGroup();
358 static void EndGroup();
359 static KGVec2 GetCursorPos();
360 static float GetCursorPosX();
361 static float GetCursorPosY();
362 static void SetCursorPos(
const KGVec2& local_pos);
363 static void SetCursorPosX(
float local_x);
364 static void SetCursorPosY(
float local_y);
365 static KGVec2 GetCursorStartPos();
366 static KGVec2 GetCursorScreenPos();
367 static void SetCursorScreenPos(
const KGVec2& pos);
368 static void AlignTextToFramePadding();
369 static float GetTextLineHeight();
370 static float GetTextLineHeightWithSpacing();
371 static float GetFrameHeight();
372 static float GetFrameHeightWithSpacing();
385 static void PushID(
const char* str_id);
386 static void PushID(
const char* str_id_begin,
const char* str_id_end);
387 static void PushID(
const void* ptr_id);
388 static void PushID(
int int_id);
390 static KGGuiID GetID(
const char* str_id);
391 static KGGuiID GetID(
const char* str_id_begin,
const char* str_id_end);
392 static KGGuiID GetID(
const void* ptr_id);
395 static void TextUnformatted(
const char* text,
const char* text_end = NULL);
396 static void Text(
const char* fmt, ...) KG_FMTARGS(1);
397 static void TextV(
const char* fmt, va_list args) KG_FMTLIST(1);
398 static void TextColored(
const KGVec4& col,
const char* fmt, ...) KG_FMTARGS(2);
400 static void TextColoredV(
const KGVec4& col,
const char* fmt, va_list args) KG_FMTLIST(2);
401 static void TextDisabled(
const char* fmt, ...) KG_FMTARGS(1);
402 static void TextDisabledV(
const char* fmt, va_list args) KG_FMTLIST(1);
403 static void TextWrapped(
const char* fmt, ...) KG_FMTARGS(1);
404 static void TextWrappedV(
const char* fmt, va_list args) KG_FMTLIST(1);
405 static void LabelText(
const char* label,
const char* fmt, ...) KG_FMTARGS(2);
406 static void LabelTextV(
const char* label,
const char* fmt, va_list args) KG_FMTLIST(2);
407 static void BulletText(
const char* fmt, ...) KG_FMTARGS(1);
408 static void BulletTextV(
const char* fmt, va_list args) KG_FMTLIST(1);
413 static bool Button(
const char* label,
const KGVec2& size =
KGVec2(0, 0));
414 static bool SmallButton(
const char* label);
415 static bool InvisibleButton(
const char* str_id,
const KGVec2& size, KarmaGuiButtonFlags flags = 0);
416 static bool ArrowButton(
const char* str_id, KarmaGuiDir dir);
417 static bool Checkbox(
const char* label,
bool* v);
418 static bool CheckboxFlags(
const char* label,
int* flags,
int flags_value);
419 static bool CheckboxFlags(
const char* label,
unsigned int* flags,
unsigned int flags_value);
420 static bool RadioButton(
const char* label,
bool active);
421 static bool RadioButton(
const char* label,
int* v,
int v_button);
422 static void ProgressBar(
float fraction,
const KGVec2& size_arg =
KGVec2(-FLT_MIN, 0),
const char* overlay = NULL);
423 static void Bullet();
427 static void Image(KGTextureID user_texture_id,
const KGVec2& size,
const KGVec2& uv0 =
KGVec2(0, 0),
const KGVec2& uv1 =
KGVec2(1, 1),
const KGVec4& tint_col =
KGVec4(1, 1, 1, 1),
const KGVec4& border_col =
KGVec4(0, 0, 0, 0));
433 static bool ImageButton(
const char* str_id, KGTextureID user_texture_id,
const KGVec2& size,
const KGVec2& uv0 =
KGVec2(0, 0),
const KGVec2& uv1 =
KGVec2(1, 1),
const KGVec4& bg_col =
KGVec4(0, 0, 0, 0),
const KGVec4& tint_col =
KGVec4(1, 1, 1, 1));
438 static bool BeginCombo(
const char* label,
const char* preview_value, KarmaGuiComboFlags flags = 0);
439 static void EndCombo();
440 static bool Combo(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int popup_max_height_in_items = -1);
441 static bool Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int popup_max_height_in_items = -1);
442 static bool Combo(
const char* label,
int* current_item,
bool(*items_getter)(
void* data,
int idx,
const char** out_text),
void* data,
int items_count,
int popup_max_height_in_items = -1);
456 static bool DragFloat(
const char* label,
float* v,
float v_speed = 1.0f,
float v_min = 0.0f,
float v_max = 0.0f,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
457 static bool DragFloat2(
const char* label,
float v[2],
float v_speed = 1.0f,
float v_min = 0.0f,
float v_max = 0.0f,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
458 static bool DragFloat3(
const char* label,
float v[3],
float v_speed = 1.0f,
float v_min = 0.0f,
float v_max = 0.0f,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
459 static bool DragFloat4(
const char* label,
float v[4],
float v_speed = 1.0f,
float v_min = 0.0f,
float v_max = 0.0f,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
460 static bool DragFloatRange2(
const char* label,
float* v_current_min,
float* v_current_max,
float v_speed = 1.0f,
float v_min = 0.0f,
float v_max = 0.0f,
const char* format =
"%.3f",
const char* format_max = NULL, KarmaGuiSliderFlags flags = 0);
461 static bool DragInt(
const char* label,
int* v,
float v_speed = 1.0f,
int v_min = 0,
int v_max = 0,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
462 static bool DragInt2(
const char* label,
int v[2],
float v_speed = 1.0f,
int v_min = 0,
int v_max = 0,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
463 static bool DragInt3(
const char* label,
int v[3],
float v_speed = 1.0f,
int v_min = 0,
int v_max = 0,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
464 static bool DragInt4(
const char* label,
int v[4],
float v_speed = 1.0f,
int v_min = 0,
int v_max = 0,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
465 static bool DragIntRange2(
const char* label,
int* v_current_min,
int* v_current_max,
float v_speed = 1.0f,
int v_min = 0,
int v_max = 0,
const char* format =
"%d",
const char* format_max = NULL, KarmaGuiSliderFlags flags = 0);
466 static bool DragScalar(
const char* label, KarmaGuiDataType data_type,
void* p_data,
float v_speed = 1.0f,
const void* p_min = NULL,
const void* p_max = NULL,
const char* format = NULL, KarmaGuiSliderFlags flags = 0);
467 static bool DragScalarN(
const char* label, KarmaGuiDataType data_type,
void* p_data,
int components,
float v_speed = 1.0f,
const void* p_min = NULL,
const void* p_max = NULL,
const char* format = NULL, KarmaGuiSliderFlags flags = 0);
475 static bool SliderFloat(
const char* label,
float* v,
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
476 static bool SliderFloat2(
const char* label,
float v[2],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
477 static bool SliderFloat3(
const char* label,
float v[3],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
478 static bool SliderFloat4(
const char* label,
float v[4],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
479 static bool SliderAngle(
const char* label,
float* v_rad,
float v_degrees_min = -360.0f,
float v_degrees_max = +360.0f,
const char* format =
"%.0f deg", KarmaGuiSliderFlags flags = 0);
480 static bool SliderInt(
const char* label,
int* v,
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
481 static bool SliderInt2(
const char* label,
int v[2],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
482 static bool SliderInt3(
const char* label,
int v[3],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
483 static bool SliderInt4(
const char* label,
int v[4],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
484 static bool SliderScalar(
const char* label, KarmaGuiDataType data_type,
void* p_data,
const void* p_min,
const void* p_max,
const char* format = NULL, KarmaGuiSliderFlags flags = 0);
485 static bool SliderScalarN(
const char* label, KarmaGuiDataType data_type,
void* p_data,
int components,
const void* p_min,
const void* p_max,
const char* format = NULL, KarmaGuiSliderFlags flags = 0);
486 static bool VSliderFloat(
const char* label,
const KGVec2& size,
float* v,
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
487 static bool VSliderInt(
const char* label,
const KGVec2& size,
int* v,
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
488 static bool VSliderScalar(
const char* label,
const KGVec2& size, KarmaGuiDataType data_type,
void* p_data,
const void* p_min,
const void* p_max,
const char* format = NULL, KarmaGuiSliderFlags flags = 0);
493 static bool InputText(
const char* label,
char* buf,
size_t buf_size, KarmaGuiInputTextFlags flags = 0, KarmaGuiInputTextCallback callback = NULL,
void* user_data = NULL);
494 static bool InputTextMultiline(
const char* label,
char* buf,
size_t buf_size,
const KGVec2& size =
KGVec2(0, 0), KarmaGuiInputTextFlags flags = 0, KarmaGuiInputTextCallback callback = NULL,
void* user_data = NULL);
495 static bool InputTextWithHint(
const char* label,
const char* hint,
char* buf,
size_t buf_size, KarmaGuiInputTextFlags flags = 0, KarmaGuiInputTextCallback callback = NULL,
void* user_data = NULL);
496 static bool InputFloat(
const char* label,
float* v,
float step = 0.0f,
float step_fast = 0.0f,
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
497 static bool InputFloat2(
const char* label,
float v[2],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
498 static bool InputFloat3(
const char* label,
float v[3],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
499 static bool InputFloat4(
const char* label,
float v[4],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
500 static bool InputInt(
const char* label,
int* v,
int step = 1,
int step_fast = 100, KarmaGuiInputTextFlags flags = 0);
501 static bool InputInt2(
const char* label,
int v[2], KarmaGuiInputTextFlags flags = 0);
502 static bool InputInt3(
const char* label,
int v[3], KarmaGuiInputTextFlags flags = 0);
503 static bool InputInt4(
const char* label,
int v[4], KarmaGuiInputTextFlags flags = 0);
504 static bool InputDouble(
const char* label,
double* v,
double step = 0.0,
double step_fast = 0.0,
const char* format =
"%.6f", KarmaGuiInputTextFlags flags = 0);
505 static bool InputScalar(
const char* label, KarmaGuiDataType data_type,
void* p_data,
const void* p_step = NULL,
const void* p_step_fast = NULL,
const char* format = NULL, KarmaGuiInputTextFlags flags = 0);
506 static bool InputScalarN(
const char* label, KarmaGuiDataType data_type,
void* p_data,
int components,
const void* p_step = NULL,
const void* p_step_fast = NULL,
const char* format = NULL, KarmaGuiInputTextFlags flags = 0);
511 static bool ColorEdit3(
const char* label,
float col[3], KarmaGuiColorEditFlags flags = 0);
512 static bool ColorEdit4(
const char* label,
float col[4], KarmaGuiColorEditFlags flags = 0);
513 static bool ColorPicker3(
const char* label,
float col[3], KarmaGuiColorEditFlags flags = 0);
514 static bool ColorPicker4(
const char* label,
float col[4], KarmaGuiColorEditFlags flags = 0,
const float* ref_col = NULL);
515 static bool ColorButton(
const char* desc_id,
const KGVec4& col, KarmaGuiColorEditFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
516 static void SetColorEditOptions(KarmaGuiColorEditFlags flags);
520 static bool TreeNode(
const char* label);
521 static bool TreeNode(
const char* str_id,
const char* fmt, ...) KG_FMTARGS(2);
522 static bool TreeNode(
const void* ptr_id,
const char* fmt, ...) KG_FMTARGS(2);
523 static bool TreeNodeV(
const char* str_id,
const char* fmt, va_list args) KG_FMTLIST(2);
524 static bool TreeNodeV(
const void* ptr_id,
const char* fmt, va_list args) KG_FMTLIST(2);
525 static bool TreeNodeEx(
const char* label, KarmaGuiTreeNodeFlags flags = 0);
526 static bool TreeNodeEx(
const char* str_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, ...) KG_FMTARGS(3);
527 static bool TreeNodeEx(
const void* ptr_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, ...) KG_FMTARGS(3);
528 static bool TreeNodeExV(
const char* str_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, va_list args) KG_FMTLIST(3);
529 static bool TreeNodeExV(
const void* ptr_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, va_list args) KG_FMTLIST(3);
530 static void TreePush(
const char* str_id);
531 static void TreePush(
const void* ptr_id);
532 static void TreePop();
533 static float GetTreeNodeToLabelSpacing();
534 static bool CollapsingHeader(
const char* label, KarmaGuiTreeNodeFlags flags = 0);
535 static bool CollapsingHeader(
const char* label,
bool* p_visible, KarmaGuiTreeNodeFlags flags = 0);
536 static void SetNextItemOpen(
bool is_open, KarmaGuiCond cond = 0);
541 static bool Selectable(
const char* label,
bool selected =
false, KarmaGuiSelectableFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
542 static bool Selectable(
const char* label,
bool* p_selected, KarmaGuiSelectableFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
550 static bool BeginListBox(
const char* label,
const KGVec2& size =
KGVec2(0, 0));
551 static void EndListBox();
552 static bool ListBox(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int height_in_items = -1);
553 static bool ListBox(
const char* label,
int* current_item,
bool (*items_getter)(
void* data,
int idx,
const char** out_text),
void* data,
int items_count,
int height_in_items = -1);
557 static void PlotLines(
const char* label,
const float* values,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
KGVec2 graph_size =
KGVec2(0, 0),
int stride =
sizeof(
float));
558 static void PlotLines(
const char* label,
float(*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
KGVec2 graph_size =
KGVec2(0, 0));
559 static void PlotHistogram(
const char* label,
const float* values,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
KGVec2 graph_size =
KGVec2(0, 0),
int stride =
sizeof(
float));
560 static void PlotHistogram(
const char* label,
float(*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
KGVec2 graph_size =
KGVec2(0, 0));
564 static void Value(
const char* prefix,
bool b);
565 static void Value(
const char* prefix,
int v);
566 static void Value(
const char* prefix,
unsigned int v);
567 static void Value(
const char* prefix,
float v,
const char* float_format = NULL);
574 static bool BeginMenuBar();
575 static void EndMenuBar();
576 static bool BeginMainMenuBar();
577 static void EndMainMenuBar();
578 static bool BeginMenu(
const char* label,
bool enabled =
true);
579 static void EndMenu();
580 static bool MenuItem(
const char* label,
const char* shortcut = NULL,
bool selected =
false,
bool enabled =
true);
581 static bool MenuItem(
const char* label,
const char* shortcut,
bool* p_selected,
bool enabled =
true);
585 static void BeginTooltip();
586 static void EndTooltip();
587 static void SetTooltip(
const char* fmt, ...) KG_FMTARGS(1);
588 static void SetTooltipV(
const char* fmt, va_list args) KG_FMTLIST(1);
602 static bool BeginPopup(
const char* str_id, KarmaGuiWindowFlags flags = 0);
603 static bool BeginPopupModal(
const char* name,
bool* p_open = NULL, KarmaGuiWindowFlags flags = 0);
604 static void EndPopup();
614 static void OpenPopup(
const char* str_id, KarmaGuiPopupFlags popup_flags = 0);
615 static void OpenPopup(KGGuiID
id, KarmaGuiPopupFlags popup_flags = 0);
616 static void OpenPopupOnItemClick(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
617 static void CloseCurrentPopup();
624 static bool BeginPopupContextItem(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
625 static bool BeginPopupContextWindow(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
626 static bool BeginPopupContextVoid(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
632 static bool IsPopupOpen(
const char* str_id, KarmaGuiPopupFlags flags = 0);
657 static bool BeginTable(
const char* str_id,
int column, KarmaGuiTableFlags flags = 0,
const KGVec2& outer_size =
KGVec2(0.0f, 0.0f),
float inner_width = 0.0f);
658 static void EndTable();
659 static void TableNextRow(KarmaGuiTableRowFlags row_flags = 0,
float min_row_height = 0.0f);
660 static bool TableNextColumn();
661 static bool TableSetColumnIndex(
int column_n);
671 static void TableSetupColumn(
const char* label, KarmaGuiTableColumnFlags flags = 0,
float init_width_or_weight = 0.0f, KGGuiID user_id = 0);
672 static void TableSetupScrollFreeze(
int cols,
int rows);
673 static void TableHeadersRow();
674 static void TableHeader(
const char* label);
683 static int TableGetColumnCount();
684 static int TableGetColumnIndex();
685 static int TableGetRowIndex();
686 static const char* TableGetColumnName(
int column_n = -1);
687 static KarmaGuiTableColumnFlags TableGetColumnFlags(
int column_n = -1);
688 static void TableSetColumnEnabled(
int column_n,
bool v);
689 static void TableSetBgColor(KarmaGuiTableBgTarget target, KGU32 color,
int column_n = -1);
693 static void Columns(
int count = 1,
const char*
id = NULL,
bool border =
true);
694 static void NextColumn();
695 static int GetColumnIndex();
696 static float GetColumnWidth(
int column_index = -1);
697 static void SetColumnWidth(
int column_index,
float width);
698 static float GetColumnOffset(
int column_index = -1);
699 static void SetColumnOffset(
int column_index,
float offset_x);
700 static int GetColumnsCount();
704 static bool BeginTabBar(
const char* str_id, KarmaGuiTabBarFlags flags = 0);
705 static void EndTabBar();
706 static bool BeginTabItem(
const char* label,
bool* p_open = NULL, KarmaGuiTabItemFlags flags = 0);
707 static void EndTabItem();
708 static bool TabItemButton(
const char* label, KarmaGuiTabItemFlags flags = 0);
709 static void SetTabItemClosed(
const char* tab_or_docked_window_label);
724 static KGGuiID DockSpace(KGGuiID
id,
const KGVec2& size =
KGVec2(0, 0), KarmaGuiDockNodeFlags flags = 0,
const KarmaGuiWindowClass* window_class = NULL);
726 static void SetNextWindowDockID(KGGuiID dock_id, KarmaGuiCond cond = 0);
728 static KGGuiID GetWindowDockID();
729 static bool IsWindowDocked();
733 static void LogToTTY(
int auto_open_depth = -1);
734 static void LogToFile(
int auto_open_depth = -1,
const char* filename = NULL);
735 static void LogToClipboard(
int auto_open_depth = -1);
736 static void LogFinish();
737 static void LogButtons();
738 static void LogText(
const char* fmt, ...) KG_FMTARGS(1);
739 static void LogTextV(
const char* fmt, va_list args) KG_FMTLIST(1);
740 static void LogTextV(
KarmaGuiContext& g,
const char* fmt, va_list args);
747 static bool BeginDragDropSource(KarmaGuiDragDropFlags flags = 0);
748 static bool SetDragDropPayload(
const char* type,
const void* data,
size_t sz, KarmaGuiCond cond = 0);
749 static void EndDragDropSource();
750 static bool BeginDragDropTarget();
751 static const KarmaGuiPayload* AcceptDragDropPayload(
const char* type, KarmaGuiDragDropFlags flags = 0);
752 static void EndDragDropTarget();
759 static void BeginDisabled(
bool disabled =
true);
760 static void EndDisabled();
764 static void PushClipRect(
const KGVec2& clip_rect_min,
const KGVec2& clip_rect_max,
bool intersect_with_current_clip_rect);
765 static void PopClipRect();
769 static void SetItemDefaultFocus();
770 static void SetKeyboardFocusHere(
int offset = 0);
775 static bool IsItemHovered(KarmaGuiHoveredFlags flags = 0);
776 static bool IsItemActive();
777 static bool IsItemFocused();
778 static bool IsItemClicked(KarmaGuiMouseButton mouse_button = 0);
779 static bool IsItemVisible();
780 static bool IsItemEdited();
781 static bool IsItemActivated();
782 static bool IsItemDeactivated();
783 static bool IsItemDeactivatedAfterEdit();
784 static bool IsItemToggledOpen();
785 static bool IsAnyItemHovered();
786 static bool IsAnyItemActive();
787 static bool IsAnyItemFocused();
788 static KGGuiID GetItemID();
789 static KGVec2 GetItemRectMin();
790 static KGVec2 GetItemRectMax();
791 static KGVec2 GetItemRectSize();
792 static void SetItemAllowOverlap();
807 static bool IsRectVisible(
const KGVec2& size);
808 static bool IsRectVisible(
const KGVec2& rect_min,
const KGVec2& rect_max);
809 static double GetTime();
810 static int GetFrameCount();
812 static const char* GetStyleColorName(KarmaGuiCol idx);
815 static bool BeginChildFrame(KGGuiID
id,
const KGVec2& size, KarmaGuiWindowFlags flags = 0);
816 static void EndChildFrame();
819 static KGVec2 CalcTextSize(
const char* text,
const char* text_end = NULL,
bool hide_text_after_double_hash =
false,
float wrap_width = -1.0f);
822 static KGVec4 ColorConvertU32ToFloat4(KGU32 in);
823 static KGU32 ColorConvertFloat4ToU32(
const KGVec4& in);
824 static void ColorConvertRGBtoHSV(
float r,
float g,
float b,
float& out_h,
float& out_s,
float& out_v);
825 static void ColorConvertHSVtoRGB(
float h,
float s,
float v,
float& out_r,
float& out_g,
float& out_b);
832 static bool IsKeyDown(KarmaGuiKey key);
833 static bool IsKeyPressed(KarmaGuiKey key,
bool repeat =
true);
834 static bool IsKeyReleased(KarmaGuiKey key);
835 static int GetKeyPressedAmount(KarmaGuiKey key,
float repeat_delay,
float rate);
836 static const char* GetKeyName(KarmaGuiKey key);
837 static void SetNextFrameWantCaptureKeyboard(
bool want_capture_keyboard);
852 static bool Shortcut(KarmaGuiKeyChord key_chord, KGGuiID owner_id = 0, KarmaGuiInputFlags flags = 0);
858 static bool IsMouseDown(KarmaGuiMouseButton button);
859 static bool IsMouseClicked(KarmaGuiMouseButton button,
bool repeat =
false);
860 static bool IsMouseReleased(KarmaGuiMouseButton button);
861 static bool IsMouseDoubleClicked(KarmaGuiMouseButton button);
862 static int GetMouseClickedCount(KarmaGuiMouseButton button);
863 static bool IsMouseHoveringRect(
const KGVec2& r_min,
const KGVec2& r_max,
bool clip =
true);
864 static bool IsMousePosValid(
const KGVec2* mouse_pos = NULL);
865 static bool IsAnyMouseDown();
866 static KGVec2 GetMousePos();
867 static KGVec2 GetMousePosOnOpeningCurrentPopup();
868 static bool IsMouseDragging(KarmaGuiMouseButton button,
float lock_threshold = -1.0f);
869 static KGVec2 GetMouseDragDelta(KarmaGuiMouseButton button = 0,
float lock_threshold = -1.0f);
870 static void ResetMouseDragDelta(KarmaGuiMouseButton button = 0);
871 static KarmaGuiMouseCursor GetMouseCursor();
872 static void SetMouseCursor(KarmaGuiMouseCursor cursor_type);
873 static void SetNextFrameWantCaptureMouse(
bool want_capture_mouse);
877 static const char* GetClipboardText();
878 static void SetClipboardText(
const char* text);
884 static void LoadIniSettingsFromDisk(
const char* ini_filename);
885 static void LoadIniSettingsFromMemory(
const char* ini_data,
size_t ini_size=0);
886 static void SaveIniSettingsToDisk(
const char* ini_filename);
887 static const char* SaveIniSettingsToMemory(
size_t* out_ini_size = NULL);
890 static void DebugTextEncoding(
const char* text);
891 static bool DebugCheckVersionAndDataLayout(
const char* version_str,
size_t sz_io,
size_t sz_style,
size_t sz_vec2,
size_t sz_vec4,
size_t sz_drawvert,
size_t sz_drawidx);
897 static void SetAllocatorFunctions(KarmaGuiMemAllocFunc alloc_func, KarmaGuiMemFreeFunc free_func,
void* user_data = NULL);
898 static void GetAllocatorFunctions(KarmaGuiMemAllocFunc* p_alloc_func, KarmaGuiMemFreeFunc* p_free_func,
void** p_user_data);
916 static void MemFree(
void* ptr);
922 static void UpdatePlatformWindows();
932 static void DestroyPlatformWindows();
934 static KarmaGuiViewport* FindViewportByPlatformHandle(
void* platform_handle);
935 static KarmaGuiKey GetKeyIndex(KarmaGuiKey key);
938 static const char*
const GKeyNames[];
949enum KGGuiWindowFlags_
951 KGGuiWindowFlags_None = 0,
952 KGGuiWindowFlags_NoTitleBar = 1 << 0,
953 KGGuiWindowFlags_NoResize = 1 << 1,
954 KGGuiWindowFlags_NoMove = 1 << 2,
955 KGGuiWindowFlags_NoScrollbar = 1 << 3,
956 KGGuiWindowFlags_NoScrollWithMouse = 1 << 4,
957 KGGuiWindowFlags_NoCollapse = 1 << 5,
958 KGGuiWindowFlags_AlwaysAutoResize = 1 << 6,
959 KGGuiWindowFlags_NoBackground = 1 << 7,
960 KGGuiWindowFlags_NoSavedSettings = 1 << 8,
961 KGGuiWindowFlags_NoMouseInputs = 1 << 9,
962 KGGuiWindowFlags_MenuBar = 1 << 10,
963 KGGuiWindowFlags_HorizontalScrollbar = 1 << 11,
964 KGGuiWindowFlags_NoFocusOnAppearing = 1 << 12,
965 KGGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13,
966 KGGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14,
967 KGGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15,
968 KGGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16,
969 KGGuiWindowFlags_NoNavInputs = 1 << 18,
970 KGGuiWindowFlags_NoNavFocus = 1 << 19,
971 KGGuiWindowFlags_UnsavedDocument = 1 << 20,
972 KGGuiWindowFlags_NoDocking = 1 << 21,
974 KGGuiWindowFlags_NoNav = KGGuiWindowFlags_NoNavInputs | KGGuiWindowFlags_NoNavFocus,
975 KGGuiWindowFlags_NoDecoration = KGGuiWindowFlags_NoTitleBar | KGGuiWindowFlags_NoResize | KGGuiWindowFlags_NoScrollbar | KGGuiWindowFlags_NoCollapse,
976 KGGuiWindowFlags_NoInputs = KGGuiWindowFlags_NoMouseInputs | KGGuiWindowFlags_NoNavInputs | KGGuiWindowFlags_NoNavFocus,
979 KGGuiWindowFlags_NavFlattened = 1 << 23,
980 KGGuiWindowFlags_ChildWindow = 1 << 24,
981 KGGuiWindowFlags_Tooltip = 1 << 25,
982 KGGuiWindowFlags_Popup = 1 << 26,
983 KGGuiWindowFlags_Modal = 1 << 27,
984 KGGuiWindowFlags_ChildMenu = 1 << 28,
985 KGGuiWindowFlags_DockNodeHost = 1 << 29,
990enum KGGuiInputTextFlags_
992 KGGuiInputTextFlags_None = 0,
993 KGGuiInputTextFlags_CharsDecimal = 1 << 0,
994 KGGuiInputTextFlags_CharsHexadecimal = 1 << 1,
995 KGGuiInputTextFlags_CharsUppercase = 1 << 2,
996 KGGuiInputTextFlags_CharsNoBlank = 1 << 3,
997 KGGuiInputTextFlags_AutoSelectAll = 1 << 4,
998 KGGuiInputTextFlags_EnterReturnsTrue = 1 << 5,
999 KGGuiInputTextFlags_CallbackCompletion = 1 << 6,
1000 KGGuiInputTextFlags_CallbackHistory = 1 << 7,
1001 KGGuiInputTextFlags_CallbackAlways = 1 << 8,
1002 KGGuiInputTextFlags_CallbackCharFilter = 1 << 9,
1003 KGGuiInputTextFlags_AllowTabInput = 1 << 10,
1004 KGGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11,
1005 KGGuiInputTextFlags_NoHorizontalScroll = 1 << 12,
1006 KGGuiInputTextFlags_AlwaysOverwrite = 1 << 13,
1007 KGGuiInputTextFlags_ReadOnly = 1 << 14,
1008 KGGuiInputTextFlags_Password = 1 << 15,
1009 KGGuiInputTextFlags_NoUndoRedo = 1 << 16,
1010 KGGuiInputTextFlags_CharsScientific = 1 << 17,
1011 KGGuiInputTextFlags_CallbackResize = 1 << 18,
1012 KGGuiInputTextFlags_CallbackEdit = 1 << 19,
1013 KGGuiInputTextFlags_EscapeClearsAll = 1 << 20,
1016#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1017 KGGuiInputTextFlags_AlwaysInsertMode = KGGuiInputTextFlags_AlwaysOverwrite
1022enum KGGuiTreeNodeFlags_
1024 KGGuiTreeNodeFlags_None = 0,
1025 KGGuiTreeNodeFlags_Selected = 1 << 0,
1026 KGGuiTreeNodeFlags_Framed = 1 << 1,
1027 KGGuiTreeNodeFlags_AllowItemOverlap = 1 << 2,
1028 KGGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3,
1029 KGGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4,
1030 KGGuiTreeNodeFlags_DefaultOpen = 1 << 5,
1031 KGGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6,
1032 KGGuiTreeNodeFlags_OpenOnArrow = 1 << 7,
1033 KGGuiTreeNodeFlags_Leaf = 1 << 8,
1034 KGGuiTreeNodeFlags_Bullet = 1 << 9,
1035 KGGuiTreeNodeFlags_FramePadding = 1 << 10,
1036 KGGuiTreeNodeFlags_SpanAvailWidth = 1 << 11,
1037 KGGuiTreeNodeFlags_SpanFullWidth = 1 << 12,
1038 KGGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13,
1040 KGGuiTreeNodeFlags_CollapsingHeader = KGGuiTreeNodeFlags_Framed | KGGuiTreeNodeFlags_NoTreePushOnOpen | KGGuiTreeNodeFlags_NoAutoOpenOnLog,
1051enum KGGuiPopupFlags_
1053 KGGuiPopupFlags_None = 0,
1054 KGGuiPopupFlags_MouseButtonLeft = 0,
1055 KGGuiPopupFlags_MouseButtonRight = 1,
1056 KGGuiPopupFlags_MouseButtonMiddle = 2,
1057 KGGuiPopupFlags_MouseButtonMask_ = 0x1F,
1058 KGGuiPopupFlags_MouseButtonDefault_ = 1,
1059 KGGuiPopupFlags_NoOpenOverExistingPopup = 1 << 5,
1060 KGGuiPopupFlags_NoOpenOverItems = 1 << 6,
1061 KGGuiPopupFlags_AnyPopupId = 1 << 7,
1062 KGGuiPopupFlags_AnyPopupLevel = 1 << 8,
1063 KGGuiPopupFlags_AnyPopup = KGGuiPopupFlags_AnyPopupId | KGGuiPopupFlags_AnyPopupLevel,
1067enum KGGuiSelectableFlags_
1069 KGGuiSelectableFlags_None = 0,
1070 KGGuiSelectableFlags_DontClosePopups = 1 << 0,
1071 KGGuiSelectableFlags_SpanAllColumns = 1 << 1,
1072 KGGuiSelectableFlags_AllowDoubleClick = 1 << 2,
1073 KGGuiSelectableFlags_Disabled = 1 << 3,
1074 KGGuiSelectableFlags_AllowItemOverlap = 1 << 4,
1078enum KGGuiComboFlags_
1080 KGGuiComboFlags_None = 0,
1081 KGGuiComboFlags_PopupAlignLeft = 1 << 0,
1082 KGGuiComboFlags_HeightSmall = 1 << 1,
1083 KGGuiComboFlags_HeightRegular = 1 << 2,
1084 KGGuiComboFlags_HeightLarge = 1 << 3,
1085 KGGuiComboFlags_HeightLargest = 1 << 4,
1086 KGGuiComboFlags_NoArrowButton = 1 << 5,
1087 KGGuiComboFlags_NoPreview = 1 << 6,
1088 KGGuiComboFlags_HeightMask_ = KGGuiComboFlags_HeightSmall | KGGuiComboFlags_HeightRegular | KGGuiComboFlags_HeightLarge | KGGuiComboFlags_HeightLargest,
1092enum KGGuiTabBarFlags_
1094 KGGuiTabBarFlags_None = 0,
1095 KGGuiTabBarFlags_Reorderable = 1 << 0,
1096 KGGuiTabBarFlags_AutoSelectNewTabs = 1 << 1,
1097 KGGuiTabBarFlags_TabListPopupButton = 1 << 2,
1098 KGGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3,
1099 KGGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4,
1100 KGGuiTabBarFlags_NoTooltip = 1 << 5,
1101 KGGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6,
1102 KGGuiTabBarFlags_FittingPolicyScroll = 1 << 7,
1103 KGGuiTabBarFlags_FittingPolicyMask_ = KGGuiTabBarFlags_FittingPolicyResizeDown | KGGuiTabBarFlags_FittingPolicyScroll,
1104 KGGuiTabBarFlags_FittingPolicyDefault_ = KGGuiTabBarFlags_FittingPolicyResizeDown,
1108enum KGGuiTabItemFlags_
1110 KGGuiTabItemFlags_None = 0,
1111 KGGuiTabItemFlags_UnsavedDocument = 1 << 0,
1112 KGGuiTabItemFlags_SetSelected = 1 << 1,
1113 KGGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2,
1114 KGGuiTabItemFlags_NoPushId = 1 << 3,
1115 KGGuiTabItemFlags_NoTooltip = 1 << 4,
1116 KGGuiTabItemFlags_NoReorder = 1 << 5,
1117 KGGuiTabItemFlags_Leading = 1 << 6,
1118 KGGuiTabItemFlags_Trailing = 1 << 7,
1143enum KGGuiTableFlags_
1146 KGGuiTableFlags_None = 0,
1147 KGGuiTableFlags_Resizable = 1 << 0,
1148 KGGuiTableFlags_Reorderable = 1 << 1,
1149 KGGuiTableFlags_Hideable = 1 << 2,
1150 KGGuiTableFlags_Sortable = 1 << 3,
1151 KGGuiTableFlags_NoSavedSettings = 1 << 4,
1152 KGGuiTableFlags_ContextMenuInBody = 1 << 5,
1154 KGGuiTableFlags_RowBg = 1 << 6,
1155 KGGuiTableFlags_BordersInnerH = 1 << 7,
1156 KGGuiTableFlags_BordersOuterH = 1 << 8,
1157 KGGuiTableFlags_BordersInnerV = 1 << 9,
1158 KGGuiTableFlags_BordersOuterV = 1 << 10,
1159 KGGuiTableFlags_BordersH = KGGuiTableFlags_BordersInnerH | KGGuiTableFlags_BordersOuterH,
1160 KGGuiTableFlags_BordersV = KGGuiTableFlags_BordersInnerV | KGGuiTableFlags_BordersOuterV,
1161 KGGuiTableFlags_BordersInner = KGGuiTableFlags_BordersInnerV | KGGuiTableFlags_BordersInnerH,
1162 KGGuiTableFlags_BordersOuter = KGGuiTableFlags_BordersOuterV | KGGuiTableFlags_BordersOuterH,
1163 KGGuiTableFlags_Borders = KGGuiTableFlags_BordersInner | KGGuiTableFlags_BordersOuter,
1164 KGGuiTableFlags_NoBordersInBody = 1 << 11,
1165 KGGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12,
1167 KGGuiTableFlags_SizingFixedFit = 1 << 13,
1168 KGGuiTableFlags_SizingFixedSame = 2 << 13,
1169 KGGuiTableFlags_SizingStretchProp = 3 << 13,
1170 KGGuiTableFlags_SizingStretchSame = 4 << 13,
1172 KGGuiTableFlags_NoHostExtendX = 1 << 16,
1173 KGGuiTableFlags_NoHostExtendY = 1 << 17,
1174 KGGuiTableFlags_NoKeepColumnsVisible = 1 << 18,
1175 KGGuiTableFlags_PreciseWidths = 1 << 19,
1177 KGGuiTableFlags_NoClip = 1 << 20,
1179 KGGuiTableFlags_PadOuterX = 1 << 21,
1180 KGGuiTableFlags_NoPadOuterX = 1 << 22,
1181 KGGuiTableFlags_NoPadInnerX = 1 << 23,
1183 KGGuiTableFlags_ScrollX = 1 << 24,
1184 KGGuiTableFlags_ScrollY = 1 << 25,
1186 KGGuiTableFlags_SortMulti = 1 << 26,
1187 KGGuiTableFlags_SortTristate = 1 << 27,
1190 KGGuiTableFlags_SizingMask_ = KGGuiTableFlags_SizingFixedFit | KGGuiTableFlags_SizingFixedSame | KGGuiTableFlags_SizingStretchProp | KGGuiTableFlags_SizingStretchSame,
1194enum KGGuiTableColumnFlags_
1197 KGGuiTableColumnFlags_None = 0,
1198 KGGuiTableColumnFlags_Disabled = 1 << 0,
1199 KGGuiTableColumnFlags_DefaultHide = 1 << 1,
1200 KGGuiTableColumnFlags_DefaultSort = 1 << 2,
1201 KGGuiTableColumnFlags_WidthStretch = 1 << 3,
1202 KGGuiTableColumnFlags_WidthFixed = 1 << 4,
1203 KGGuiTableColumnFlags_NoResize = 1 << 5,
1204 KGGuiTableColumnFlags_NoReorder = 1 << 6,
1205 KGGuiTableColumnFlags_NoHide = 1 << 7,
1206 KGGuiTableColumnFlags_NoClip = 1 << 8,
1207 KGGuiTableColumnFlags_NoSort = 1 << 9,
1208 KGGuiTableColumnFlags_NoSortAscending = 1 << 10,
1209 KGGuiTableColumnFlags_NoSortDescending = 1 << 11,
1210 KGGuiTableColumnFlags_NoHeaderLabel = 1 << 12,
1211 KGGuiTableColumnFlags_NoHeaderWidth = 1 << 13,
1212 KGGuiTableColumnFlags_PreferSortAscending = 1 << 14,
1213 KGGuiTableColumnFlags_PreferSortDescending = 1 << 15,
1214 KGGuiTableColumnFlags_IndentEnable = 1 << 16,
1215 KGGuiTableColumnFlags_IndentDisable = 1 << 17,
1218 KGGuiTableColumnFlags_IsEnabled = 1 << 24,
1219 KGGuiTableColumnFlags_IsVisible = 1 << 25,
1220 KGGuiTableColumnFlags_IsSorted = 1 << 26,
1221 KGGuiTableColumnFlags_IsHovered = 1 << 27,
1224 KGGuiTableColumnFlags_WidthMask_ = KGGuiTableColumnFlags_WidthStretch | KGGuiTableColumnFlags_WidthFixed,
1225 KGGuiTableColumnFlags_IndentMask_ = KGGuiTableColumnFlags_IndentEnable | KGGuiTableColumnFlags_IndentDisable,
1226 KGGuiTableColumnFlags_StatusMask_ = KGGuiTableColumnFlags_IsEnabled | KGGuiTableColumnFlags_IsVisible | KGGuiTableColumnFlags_IsSorted | KGGuiTableColumnFlags_IsHovered,
1227 KGGuiTableColumnFlags_NoDirectResize_ = 1 << 30,
1231enum KGGuiTableRowFlags_
1233 KGGuiTableRowFlags_None = 0,
1234 KGGuiTableRowFlags_Headers = 1 << 0,
1246enum KGGuiTableBgTarget_
1248 KGGuiTableBgTarget_None = 0,
1249 KGGuiTableBgTarget_RowBg0 = 1,
1250 KGGuiTableBgTarget_RowBg1 = 2,
1251 KGGuiTableBgTarget_CellBg = 3,
1255enum KGGuiFocusedFlags_
1257 KGGuiFocusedFlags_None = 0,
1258 KGGuiFocusedFlags_ChildWindows = 1 << 0,
1259 KGGuiFocusedFlags_RootWindow = 1 << 1,
1260 KGGuiFocusedFlags_AnyWindow = 1 << 2,
1261 KGGuiFocusedFlags_NoPopupHierarchy = 1 << 3,
1262 KGGuiFocusedFlags_DockHierarchy = 1 << 4,
1263 KGGuiFocusedFlags_RootAndChildWindows = KGGuiFocusedFlags_RootWindow | KGGuiFocusedFlags_ChildWindows,
1269enum KGGuiHoveredFlags_
1271 KGGuiHoveredFlags_None = 0,
1272 KGGuiHoveredFlags_ChildWindows = 1 << 0,
1273 KGGuiHoveredFlags_RootWindow = 1 << 1,
1274 KGGuiHoveredFlags_AnyWindow = 1 << 2,
1275 KGGuiHoveredFlags_NoPopupHierarchy = 1 << 3,
1276 KGGuiHoveredFlags_DockHierarchy = 1 << 4,
1277 KGGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5,
1279 KGGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7,
1280 KGGuiHoveredFlags_AllowWhenOverlapped = 1 << 8,
1281 KGGuiHoveredFlags_AllowWhenDisabled = 1 << 9,
1282 KGGuiHoveredFlags_NoNavOverride = 1 << 10,
1283 KGGuiHoveredFlags_RectOnly = KGGuiHoveredFlags_AllowWhenBlockedByPopup | KGGuiHoveredFlags_AllowWhenBlockedByActiveItem | KGGuiHoveredFlags_AllowWhenOverlapped,
1284 KGGuiHoveredFlags_RootAndChildWindows = KGGuiHoveredFlags_RootWindow | KGGuiHoveredFlags_ChildWindows,
1287 KGGuiHoveredFlags_DelayNormal = 1 << 11,
1288 KGGuiHoveredFlags_DelayShort = 1 << 12,
1289 KGGuiHoveredFlags_NoSharedDelay = 1 << 13,
1295enum KGGuiDockNodeFlags_
1297 KGGuiDockNodeFlags_None = 0,
1298 KGGuiDockNodeFlags_KeepAliveOnly = 1 << 0,
1300 KGGuiDockNodeFlags_NoDockingInCentralNode = 1 << 2,
1301 KGGuiDockNodeFlags_PassthruCentralNode = 1 << 3,
1302 KGGuiDockNodeFlags_NoSplit = 1 << 4,
1303 KGGuiDockNodeFlags_NoResize = 1 << 5,
1304 KGGuiDockNodeFlags_AutoHideTabBar = 1 << 6,
1308enum KGGuiDragDropFlags_
1310 KGGuiDragDropFlags_None = 0,
1312 KGGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0,
1313 KGGuiDragDropFlags_SourceNoDisableHover = 1 << 1,
1314 KGGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2,
1315 KGGuiDragDropFlags_SourceAllowNullID = 1 << 3,
1316 KGGuiDragDropFlags_SourceExtern = 1 << 4,
1317 KGGuiDragDropFlags_SourceAutoExpirePayload = 1 << 5,
1319 KGGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10,
1320 KGGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11,
1321 KGGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12,
1322 KGGuiDragDropFlags_AcceptPeekOnly = KGGuiDragDropFlags_AcceptBeforeDelivery | KGGuiDragDropFlags_AcceptNoDrawDefaultRect,
1326#define KARMAGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F"
1327#define KARMAGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F"
1340 KGGuiDataType_Float,
1341 KGGuiDataType_Double,
1357enum KGGuiSortDirection_
1359 KGGuiSortDirection_None = 0,
1360 KGGuiSortDirection_Ascending = 1,
1361 KGGuiSortDirection_Descending = 2
1368enum KarmaGuiKey :
int
1374 KGGuiKey_RightArrow,
1387 KGGuiKey_LeftCtrl, KGGuiKey_LeftShift, KGGuiKey_LeftAlt, KGGuiKey_LeftSuper,
1388 KGGuiKey_RightCtrl, KGGuiKey_RightShift, KGGuiKey_RightAlt, KGGuiKey_RightSuper,
1390 KGGuiKey_0, KGGuiKey_1, KGGuiKey_2, KGGuiKey_3, KGGuiKey_4, KGGuiKey_5, KGGuiKey_6, KGGuiKey_7, KGGuiKey_8, KGGuiKey_9,
1391 KGGuiKey_A, KGGuiKey_B, KGGuiKey_C, KGGuiKey_D, KGGuiKey_E, KGGuiKey_F, KGGuiKey_G, KGGuiKey_H, KGGuiKey_I, KGGuiKey_J,
1392 KGGuiKey_K, KGGuiKey_L, KGGuiKey_M, KGGuiKey_N, KGGuiKey_O, KGGuiKey_P, KGGuiKey_Q, KGGuiKey_R, KGGuiKey_S, KGGuiKey_T,
1393 KGGuiKey_U, KGGuiKey_V, KGGuiKey_W, KGGuiKey_X, KGGuiKey_Y, KGGuiKey_Z,
1394 KGGuiKey_F1, KGGuiKey_F2, KGGuiKey_F3, KGGuiKey_F4, KGGuiKey_F5, KGGuiKey_F6,
1395 KGGuiKey_F7, KGGuiKey_F8, KGGuiKey_F9, KGGuiKey_F10, KGGuiKey_F11, KGGuiKey_F12,
1396 KGGuiKey_Apostrophe,
1403 KGGuiKey_LeftBracket,
1405 KGGuiKey_RightBracket,
1406 KGGuiKey_GraveAccent,
1408 KGGuiKey_ScrollLock,
1410 KGGuiKey_PrintScreen,
1412 KGGuiKey_Keypad0, KGGuiKey_Keypad1, KGGuiKey_Keypad2, KGGuiKey_Keypad3, KGGuiKey_Keypad4,
1413 KGGuiKey_Keypad5, KGGuiKey_Keypad6, KGGuiKey_Keypad7, KGGuiKey_Keypad8, KGGuiKey_Keypad9,
1414 KGGuiKey_KeypadDecimal,
1415 KGGuiKey_KeypadDivide,
1416 KGGuiKey_KeypadMultiply,
1417 KGGuiKey_KeypadSubtract,
1419 KGGuiKey_KeypadEnter,
1420 KGGuiKey_KeypadEqual,
1424 KGGuiKey_GamepadStart,
1425 KGGuiKey_GamepadBack,
1426 KGGuiKey_GamepadFaceLeft,
1427 KGGuiKey_GamepadFaceRight,
1428 KGGuiKey_GamepadFaceUp,
1429 KGGuiKey_GamepadFaceDown,
1430 KGGuiKey_GamepadDpadLeft,
1431 KGGuiKey_GamepadDpadRight,
1432 KGGuiKey_GamepadDpadUp,
1433 KGGuiKey_GamepadDpadDown,
1440 KGGuiKey_GamepadLStickLeft,
1441 KGGuiKey_GamepadLStickRight,
1442 KGGuiKey_GamepadLStickUp,
1443 KGGuiKey_GamepadLStickDown,
1444 KGGuiKey_GamepadRStickLeft,
1445 KGGuiKey_GamepadRStickRight,
1446 KGGuiKey_GamepadRStickUp,
1447 KGGuiKey_GamepadRStickDown,
1451 KGGuiKey_MouseLeft, KGGuiKey_MouseRight, KGGuiKey_MouseMiddle, KGGuiKey_MouseX1, KGGuiKey_MouseX2, KGGuiKey_MouseWheelX, KGGuiKey_MouseWheelY,
1454 KGGuiKey_ReservedForModCtrl, KGGuiKey_ReservedForModShift, KGGuiKey_ReservedForModAlt, KGGuiKey_ReservedForModSuper,
1466 KGGuiMod_Ctrl = 1 << 12,
1467 KGGuiMod_Shift = 1 << 13,
1468 KGGuiMod_Alt = 1 << 14,
1469 KGGuiMod_Super = 1 << 15,
1470 KGGuiMod_Shortcut = 1 << 11,
1471 KGGuiMod_Mask_ = 0xF800,
1475 KGGuiKey_NamedKey_BEGIN = 512,
1476 KGGuiKey_NamedKey_END = KGGuiKey_COUNT,
1477 KGGuiKey_NamedKey_COUNT = KGGuiKey_NamedKey_END - KGGuiKey_NamedKey_BEGIN,
1478#ifdef KARMAGUI_DISABLE_OBSOLETE_KEYIO
1479 KGGuiKey_KeysData_SIZE = KGGuiKey_NamedKey_COUNT,
1480 KGGuiKey_KeysData_OFFSET = KGGuiKey_NamedKey_BEGIN,
1482 KGGuiKey_KeysData_SIZE = KGGuiKey_COUNT,
1483 KGGuiKey_KeysData_OFFSET = 0,
1486#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1487 KGGuiKey_ModCtrl = KGGuiMod_Ctrl, KGGuiKey_ModShift = KGGuiMod_Shift, KGGuiKey_ModAlt = KGGuiMod_Alt, KGGuiKey_ModSuper = KGGuiMod_Super,
1488 KGGuiKey_KeyPadEnter = KGGuiKey_KeypadEnter,
1494enum KGGuiInputFlags_
1496 KGGuiInputFlags_None = 0,
1497 KGGuiInputFlags_Repeat = 1 << 0,
1510 KGGuiInputFlags_RouteFocused = 1 << 8,
1511 KGGuiInputFlags_RouteGlobalLow = 1 << 9,
1512 KGGuiInputFlags_RouteGlobal = 1 << 10,
1513 KGGuiInputFlags_RouteGlobalHigh = 1 << 11,
1514 KGGuiInputFlags_RouteAlways = 1 << 12,
1517 KGGuiInputFlags_RouteUnlessBgFocused= 1 << 13,
1520#ifndef KARMAGUI_DISABLE_OBSOLETE_KEYIO
1526 KGGuiNavInput_Activate, KGGuiNavInput_Cancel, KGGuiNavInput_Input, KGGuiNavInput_Menu, KGGuiNavInput_DpadLeft, KGGuiNavInput_DpadRight, KGGuiNavInput_DpadUp, KGGuiNavInput_DpadDown,
1527 KGGuiNavInput_LStickLeft, KGGuiNavInput_LStickRight, KGGuiNavInput_LStickUp, KGGuiNavInput_LStickDown, KGGuiNavInput_FocusPrev, KGGuiNavInput_FocusNext, KGGuiNavInput_TweakSlow, KGGuiNavInput_TweakFast,
1528 KGGuiNavInput_COUNT,
1533enum KGGuiConfigFlags_
1535 KGGuiConfigFlags_None = 0,
1536 KGGuiConfigFlags_NavEnableKeyboard = 1 << 0,
1537 KGGuiConfigFlags_NavEnableGamepad = 1 << 1,
1538 KGGuiConfigFlags_NavEnableSetMousePos = 1 << 2,
1539 KGGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3,
1540 KGGuiConfigFlags_NoMouse = 1 << 4,
1541 KGGuiConfigFlags_NoMouseCursorChange = 1 << 5,
1544 KGGuiConfigFlags_DockingEnable = 1 << 6,
1548 KGGuiConfigFlags_ViewportsEnable = 1 << 10,
1549 KGGuiConfigFlags_DpiEnableScaleViewports= 1 << 14,
1550 KGGuiConfigFlags_DpiEnableScaleFonts = 1 << 15,
1553 KGGuiConfigFlags_IsSRGB = 1 << 20,
1554 KGGuiConfigFlags_IsTouchScreen = 1 << 21,
1558enum KGGuiBackendFlags_
1560 KGGuiBackendFlags_None = 0,
1561 KGGuiBackendFlags_HasGamepad = 1 << 0,
1562 KGGuiBackendFlags_HasMouseCursors = 1 << 1,
1563 KGGuiBackendFlags_HasSetMousePos = 1 << 2,
1564 KGGuiBackendFlags_RendererHasVtxOffset = 1 << 3,
1567 KGGuiBackendFlags_PlatformHasViewports = 1 << 10,
1568 KGGuiBackendFlags_HasMouseHoveredViewport=1 << 11,
1569 KGGuiBackendFlags_RendererHasViewports = 1 << 12,
1576 KGGuiCol_TextDisabled,
1581 KGGuiCol_BorderShadow,
1583 KGGuiCol_FrameBgHovered,
1584 KGGuiCol_FrameBgActive,
1586 KGGuiCol_TitleBgActive,
1587 KGGuiCol_TitleBgCollapsed,
1589 KGGuiCol_ScrollbarBg,
1590 KGGuiCol_ScrollbarGrab,
1591 KGGuiCol_ScrollbarGrabHovered,
1592 KGGuiCol_ScrollbarGrabActive,
1594 KGGuiCol_SliderGrab,
1595 KGGuiCol_SliderGrabActive,
1597 KGGuiCol_ButtonHovered,
1598 KGGuiCol_ButtonActive,
1600 KGGuiCol_HeaderHovered,
1601 KGGuiCol_HeaderActive,
1603 KGGuiCol_SeparatorHovered,
1604 KGGuiCol_SeparatorActive,
1605 KGGuiCol_ResizeGrip,
1606 KGGuiCol_ResizeGripHovered,
1607 KGGuiCol_ResizeGripActive,
1609 KGGuiCol_TabHovered,
1611 KGGuiCol_TabUnfocused,
1612 KGGuiCol_TabUnfocusedActive,
1613 KGGuiCol_DockingPreview,
1614 KGGuiCol_DockingEmptyBg,
1616 KGGuiCol_PlotLinesHovered,
1617 KGGuiCol_PlotHistogram,
1618 KGGuiCol_PlotHistogramHovered,
1619 KGGuiCol_TableHeaderBg,
1620 KGGuiCol_TableBorderStrong,
1621 KGGuiCol_TableBorderLight,
1622 KGGuiCol_TableRowBg,
1623 KGGuiCol_TableRowBgAlt,
1624 KGGuiCol_TextSelectedBg,
1625 KGGuiCol_DragDropTarget,
1626 KGGuiCol_NavHighlight,
1627 KGGuiCol_NavWindowingHighlight,
1628 KGGuiCol_NavWindowingDimBg,
1629 KGGuiCol_ModalWindowDimBg,
1643 KGGuiStyleVar_Alpha,
1644 KGGuiStyleVar_DisabledAlpha,
1645 KGGuiStyleVar_WindowPadding,
1646 KGGuiStyleVar_WindowRounding,
1647 KGGuiStyleVar_WindowBorderSize,
1648 KGGuiStyleVar_WindowMinSize,
1649 KGGuiStyleVar_WindowTitleAlign,
1650 KGGuiStyleVar_ChildRounding,
1651 KGGuiStyleVar_ChildBorderSize,
1652 KGGuiStyleVar_PopupRounding,
1653 KGGuiStyleVar_PopupBorderSize,
1654 KGGuiStyleVar_FramePadding,
1655 KGGuiStyleVar_FrameRounding,
1656 KGGuiStyleVar_FrameBorderSize,
1657 KGGuiStyleVar_ItemSpacing,
1658 KGGuiStyleVar_ItemInnerSpacing,
1659 KGGuiStyleVar_IndentSpacing,
1660 KGGuiStyleVar_CellPadding,
1661 KGGuiStyleVar_ScrollbarSize,
1662 KGGuiStyleVar_ScrollbarRounding,
1663 KGGuiStyleVar_GrabMinSize,
1664 KGGuiStyleVar_GrabRounding,
1665 KGGuiStyleVar_TabRounding,
1666 KGGuiStyleVar_ButtonTextAlign,
1667 KGGuiStyleVar_SelectableTextAlign,
1672enum KGGuiButtonFlags_
1674 KGGuiButtonFlags_None = 0,
1675 KGGuiButtonFlags_MouseButtonLeft = 1 << 0,
1676 KGGuiButtonFlags_MouseButtonRight = 1 << 1,
1677 KGGuiButtonFlags_MouseButtonMiddle = 1 << 2,
1680 KGGuiButtonFlags_MouseButtonMask_ = KGGuiButtonFlags_MouseButtonLeft | KGGuiButtonFlags_MouseButtonRight | KGGuiButtonFlags_MouseButtonMiddle,
1681 KGGuiButtonFlags_MouseButtonDefault_ = KGGuiButtonFlags_MouseButtonLeft,
1685enum KGGuiColorEditFlags_
1687 KGGuiColorEditFlags_None = 0,
1688 KGGuiColorEditFlags_NoAlpha = 1 << 1,
1689 KGGuiColorEditFlags_NoPicker = 1 << 2,
1690 KGGuiColorEditFlags_NoOptions = 1 << 3,
1691 KGGuiColorEditFlags_NoSmallPreview = 1 << 4,
1692 KGGuiColorEditFlags_NoInputs = 1 << 5,
1693 KGGuiColorEditFlags_NoTooltip = 1 << 6,
1694 KGGuiColorEditFlags_NoLabel = 1 << 7,
1695 KGGuiColorEditFlags_NoSidePreview = 1 << 8,
1696 KGGuiColorEditFlags_NoDragDrop = 1 << 9,
1697 KGGuiColorEditFlags_NoBorder = 1 << 10,
1700 KGGuiColorEditFlags_AlphaBar = 1 << 16,
1701 KGGuiColorEditFlags_AlphaPreview = 1 << 17,
1702 KGGuiColorEditFlags_AlphaPreviewHalf= 1 << 18,
1703 KGGuiColorEditFlags_HDR = 1 << 19,
1704 KGGuiColorEditFlags_DisplayRGB = 1 << 20,
1705 KGGuiColorEditFlags_DisplayHSV = 1 << 21,
1706 KGGuiColorEditFlags_DisplayHex = 1 << 22,
1707 KGGuiColorEditFlags_Uint8 = 1 << 23,
1708 KGGuiColorEditFlags_Float = 1 << 24,
1709 KGGuiColorEditFlags_PickerHueBar = 1 << 25,
1710 KGGuiColorEditFlags_PickerHueWheel = 1 << 26,
1711 KGGuiColorEditFlags_InputRGB = 1 << 27,
1712 KGGuiColorEditFlags_InputHSV = 1 << 28,
1716 KGGuiColorEditFlags_DefaultOptions_ = KGGuiColorEditFlags_Uint8 | KGGuiColorEditFlags_DisplayRGB | KGGuiColorEditFlags_InputRGB | KGGuiColorEditFlags_PickerHueBar,
1719 KGGuiColorEditFlags_DisplayMask_ = KGGuiColorEditFlags_DisplayRGB | KGGuiColorEditFlags_DisplayHSV | KGGuiColorEditFlags_DisplayHex,
1720 KGGuiColorEditFlags_DataTypeMask_ = KGGuiColorEditFlags_Uint8 | KGGuiColorEditFlags_Float,
1721 KGGuiColorEditFlags_PickerMask_ = KGGuiColorEditFlags_PickerHueWheel | KGGuiColorEditFlags_PickerHueBar,
1722 KGGuiColorEditFlags_InputMask_ = KGGuiColorEditFlags_InputRGB | KGGuiColorEditFlags_InputHSV,
1731enum KGGuiSliderFlags_
1733 KGGuiSliderFlags_None = 0,
1734 KGGuiSliderFlags_AlwaysClamp = 1 << 4,
1735 KGGuiSliderFlags_Logarithmic = 1 << 5,
1736 KGGuiSliderFlags_NoRoundToFormat = 1 << 6,
1737 KGGuiSliderFlags_NoInput = 1 << 7,
1738 KGGuiSliderFlags_InvalidMask_ = 0x7000000F,
1741#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1742 KGGuiSliderFlags_ClampOnInput = KGGuiSliderFlags_AlwaysClamp,
1748enum KGGuiMouseButton_
1750 KGGuiMouseButton_Left = 0,
1751 KGGuiMouseButton_Right = 1,
1752 KGGuiMouseButton_Middle = 2,
1753 KGGuiMouseButton_COUNT = 5
1758enum KGGuiMouseCursor_
1760 KGGuiMouseCursor_None = -1,
1761 KGGuiMouseCursor_Arrow = 0,
1762 KGGuiMouseCursor_TextInput,
1763 KGGuiMouseCursor_ResizeAll,
1764 KGGuiMouseCursor_ResizeNS,
1765 KGGuiMouseCursor_ResizeEW,
1766 KGGuiMouseCursor_ResizeNESW,
1767 KGGuiMouseCursor_ResizeNWSE,
1768 KGGuiMouseCursor_Hand,
1769 KGGuiMouseCursor_NotAllowed,
1770 KGGuiMouseCursor_COUNT
1779 KGGuiCond_Always = 1 << 0,
1780 KGGuiCond_Once = 1 << 1,
1781 KGGuiCond_FirstUseEver = 1 << 2,
1782 KGGuiCond_Appearing = 1 << 3,
1796inline void*
operator new(size_t,
KGNewWrapper,
void* ptr) {
return ptr; }
1797inline void operator delete(
void*,
KGNewWrapper,
void*) {}
1798#define KG_ALLOC(_SIZE) Karma::KarmaGui::MemAlloc(_SIZE)
1799#define KG_FREE(_PTR) Karma::KarmaGui::MemFree(_PTR)
1800#define KG_PLACEMENT_NEW(_PTR) new(KGNewWrapper(), _PTR)
1801#define KG_NEW(_TYPE) new(KGNewWrapper(), Karma::KarmaGui::MemAlloc(sizeof(_TYPE))) _TYPE
1823 typedef T value_type;
1824 typedef value_type* iterator;
1825 typedef const value_type* const_iterator;
1828 inline KGVector() { Size = Capacity = 0; Data = NULL; }
1829 inline KGVector(
const KGVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
1830 inline KGVector<T>& operator=(
const KGVector<T>& src) { clear(); resize(src.Size);
if (src.Data) memcpy(Data, src.Data, (
size_t)Size *
sizeof(T));
return *
this; }
1831 inline ~KGVector() {
if (Data) KG_FREE(Data); }
1833 inline void clear() {
if (Data) { Size = Capacity = 0; KG_FREE(Data); Data = NULL; } }
1834 inline void clear_delete() {
for (
int n = 0; n < Size; n++) KG_DELETE(Data[n]); clear(); }
1835 inline void clear_destruct() {
for (
int n = 0; n < Size; n++) Data[n].~T(); clear(); }
1837 inline bool empty()
const {
return Size == 0; }
1838 inline int size()
const {
return Size; }
1839 inline int size_in_bytes()
const {
return Size * (int)
sizeof(T); }
1840 inline int max_size()
const {
return 0x7FFFFFFF / (int)
sizeof(T); }
1841 inline int capacity()
const {
return Capacity; }
1842 inline T& operator[](
int i) { KR_CORE_ASSERT(i >= 0 && i < Size,
"");
return Data[i]; }
1843 inline const T& operator[](
int i)
const { KR_CORE_ASSERT(i >= 0 && i < Size,
"");
return Data[i]; }
1845 inline T* begin() {
return Data; }
1846 inline const T* begin()
const {
return Data; }
1847 inline T* end() {
return Data + Size; }
1848 inline const T* end()
const {
return Data + Size; }
1849 inline T& front() { KR_CORE_ASSERT(Size > 0,
"");
return Data[0]; }
1850 inline const T& front()
const { KR_CORE_ASSERT(Size > 0,
"");
return Data[0]; }
1851 inline T& back() { KR_CORE_ASSERT(Size > 0,
"");
return Data[Size - 1]; }
1852 inline const T& back()
const { KR_CORE_ASSERT(Size > 0,
"");
return Data[Size - 1]; }
1853 inline void swap(KGVector<T>& rhs) {
int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size;
int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; T* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
1855 inline int _grow_capacity(
int sz)
const {
int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8;
return new_capacity > sz ? new_capacity : sz; }
1856 inline void resize(
int new_size) {
if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
1857 inline void resize(
int new_size,
const T& v) {
if (new_size > Capacity) reserve(_grow_capacity(new_size));
if (new_size > Size)
for (
int n = Size; n < new_size; n++) memcpy(&Data[n], &v,
sizeof(v)); Size = new_size; }
1858 inline void shrink(
int new_size) { KR_CORE_ASSERT(new_size <= Size,
""); Size = new_size; }
1859 inline void reserve(
int new_capacity) {
if (new_capacity <= Capacity)
return; T* new_data = (T*)KG_ALLOC((
size_t)new_capacity *
sizeof(T));
if (Data) { memcpy(new_data, Data, (
size_t)Size *
sizeof(T)); KG_FREE(Data); } Data = new_data; Capacity = new_capacity; }
1860 inline void reserve_discard(
int new_capacity) {
if (new_capacity <= Capacity)
return;
if (Data) KG_FREE(Data); Data = (T*)KG_ALLOC((
size_t)new_capacity *
sizeof(T)); Capacity = new_capacity; }
1863 inline void push_back(
const T& v) {
if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v,
sizeof(v)); Size++; }
1864 inline void pop_back() { KR_CORE_ASSERT(Size > 0,
""); Size--; }
1865 inline void push_front(
const T& v) {
if (Size == 0) push_back(v);
else insert(Data, v); }
1866 inline T* erase(
const T* it) { KR_CORE_ASSERT(it >= Data && it < Data + Size,
"");
const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((
size_t)Size - (
size_t)off - 1) *
sizeof(T)); Size--;
return Data + off; }
1867 inline T* erase(
const T* it,
const T* it_last){ KR_CORE_ASSERT(it >= Data && it < Data + Size && it_last >= it && it_last <= Data + Size,
"");
const ptrdiff_t count = it_last - it;
const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((
size_t)Size - (
size_t)off - (
size_t)count) *
sizeof(T)); Size -= (int)count;
return Data + off; }
1868 inline T* erase_unsorted(
const T* it) { KR_CORE_ASSERT(it >= Data && it < Data + Size,
"");
const ptrdiff_t off = it - Data;
if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1,
sizeof(T)); Size--;
return Data + off; }
1869 inline T* insert(
const T* it,
const T& v) { KR_CORE_ASSERT(it >= Data && it <= Data + Size,
"");
const ptrdiff_t off = it - Data;
if (Size == Capacity) reserve(_grow_capacity(Size + 1));
if (off < (
int)Size) memmove(Data + off + 1, Data + off, ((
size_t)Size - (
size_t)off) *
sizeof(T)); memcpy(&Data[off], &v,
sizeof(v)); Size++;
return Data + off; }
1870 inline bool contains(
const T& v)
const {
const T* data = Data;
const T* data_end = Data + Size;
while (data < data_end)
if (*data++ == v)
return true;
return false; }
1871 inline T* find(
const T& v) { T* data = Data;
const T* data_end = Data + Size;
while (data < data_end)
if (*data == v)
break;
else ++data;
return data; }
1872 inline const T* find(
const T& v)
const {
const T* data = Data;
const T* data_end = Data + Size;
while (data < data_end)
if (*data == v)
break;
else ++data;
return data; }
1873 inline bool find_erase(
const T& v) {
const T* it = find(v);
if (it < Data + Size) { erase(it);
return true; }
return false; }
1874 inline bool find_erase_unsorted(
const T& v) {
const T* it = find(v);
if (it < Data + Size) { erase_unsorted(it);
return true; }
return false; }
1875 inline int index_from_ptr(
const T* it)
const { KR_CORE_ASSERT(it >= Data && it < Data + Size,
"");
const ptrdiff_t off = it - Data;
return (
int)off; }
1889 float DisabledAlpha;
1891 float WindowRounding;
1892 float WindowBorderSize;
1895 KarmaGuiDir WindowMenuButtonPosition;
1896 float ChildRounding;
1897 float ChildBorderSize;
1898 float PopupRounding;
1899 float PopupBorderSize;
1901 float FrameRounding;
1902 float FrameBorderSize;
1906 KGVec2 TouchExtraPadding;
1907 float IndentSpacing;
1908 float ColumnsMinSpacing;
1909 float ScrollbarSize;
1910 float ScrollbarRounding;
1913 float LogSliderDeadzone;
1915 float TabBorderSize;
1916 float TabMinWidthForCloseButton;
1917 KarmaGuiDir ColorButtonPosition;
1919 KGVec2 SelectableTextAlign;
1920 KGVec2 DisplayWindowPadding;
1921 KGVec2 DisplaySafeAreaPadding;
1922 float MouseCursorScale;
1923 bool AntiAliasedLines;
1924 bool AntiAliasedLinesUseTex;
1925 bool AntiAliasedFill;
1926 float CurveTessellationTol;
1927 float CircleTessellationMaxError;
1928 KGVec4 Colors[KGGuiCol_COUNT];
1931 void ScaleAllSizes(
float scale_factor);
1947 float DownDurationPrev;
1957 KarmaGuiConfigFlags ConfigFlags;
1958 KarmaGuiBackendFlags BackendFlags;
1961 float IniSavingRate;
1962 const char* IniFilename;
1963 const char* LogFilename;
1964 float MouseDoubleClickTime;
1965 float MouseDoubleClickMaxDist;
1966 float MouseDragThreshold;
1967 float KeyRepeatDelay;
1968 float KeyRepeatRate;
1969 float HoverDelayNormal;
1970 float HoverDelayShort;
1974 float FontGlobalScale;
1975 bool FontAllowUserScaling;
1977 KGVec2 DisplayFramebufferScale;
1980 bool ConfigDockingNoSplit;
1981 bool ConfigDockingWithShift;
1982 bool ConfigDockingAlwaysTabBar;
1983 bool ConfigDockingTransparentPayload;
1986 bool ConfigViewportsNoAutoMerge;
1987 bool ConfigViewportsNoTaskBarIcon;
1988 bool ConfigViewportsNoDecoration;
1989 bool ConfigViewportsNoDefaultParent;
1992 bool MouseDrawCursor;
1993 bool ConfigMacOSXBehaviors;
1994 bool ConfigInputTrickleEventQueue;
1995 bool ConfigInputTextCursorBlink;
1996 bool ConfigInputTextEnterKeepActive;
1997 bool ConfigDragClickToInputText;
1998 bool ConfigWindowsResizeFromEdges;
1999 bool ConfigWindowsMoveFromTitleBarOnly;
2000 float ConfigMemoryCompactTimer;
2008 const char* BackendPlatformName;
2009 const char* BackendRendererName;
2010 void* BackendPlatformUserData;
2011 void* BackendRendererUserData;
2012 void* BackendLanguageUserData;
2016 const char* (*GetClipboardTextFn)(
void* user_data);
2017 void (*SetClipboardTextFn)(
void* user_data,
const char* text);
2018 void* ClipboardUserData;
2023#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2024 void* ImeWindowHandle;
2026 void* _UnusedPadding;
2034 void AddKeyEvent(KarmaGuiKey key,
bool down);
2035 void AddKeyAnalogEvent(KarmaGuiKey key,
bool down,
float v);
2036 void AddMousePosEvent(
float x,
float y);
2037 void AddMouseButtonEvent(
int button,
bool down);
2038 void AddMouseWheelEvent(
float wh_x,
float wh_y);
2039 void AddMouseViewportEvent(KGGuiID
id);
2040 void AddFocusEvent(
bool focused);
2041 void AddInputCharacter(
unsigned int c);
2042 void AddInputCharacterUTF16(KGWchar16 c);
2043 void AddInputCharactersUTF8(
const char* str);
2045 void SetKeyEventNativeData(KarmaGuiKey key,
int native_keycode,
int native_scancode,
int native_legacy_index = -1);
2046 void SetAppAcceptingEvents(
bool accepting_events);
2047 void ClearInputCharacters();
2048 void ClearInputKeys();
2056 bool WantCaptureMouse;
2057 bool WantCaptureKeyboard;
2059 bool WantSetMousePos;
2060 bool WantSaveIniSettings;
2064 int MetricsRenderVertices;
2065 int MetricsRenderIndices;
2066 int MetricsRenderWindows;
2067 int MetricsActiveWindows;
2068 int MetricsActiveAllocations;
2074#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
2075 int KeyMap[KGGuiKey_COUNT];
2076 bool KeysDown[KGGuiKey_COUNT];
2077 float NavInputs[KGGuiNavInput_COUNT];
2091 KGGuiID MouseHoveredViewport;
2098 KarmaGuiKeyChord KeyMods;
2100 bool WantCaptureMouseUnlessPopupClose;
2102 KGVec2 MouseClickedPos[5];
2103 double MouseClickedTime[5];
2104 bool MouseClicked[5];
2105 bool MouseDoubleClicked[5];
2106 KGU16 MouseClickedCount[5];
2107 KGU16 MouseClickedLastCount[5];
2108 bool MouseReleased[5];
2109 bool MouseDownOwned[5];
2110 bool MouseDownOwnedUnlessPopupClose[5];
2111 float MouseDownDuration[5];
2112 float MouseDownDurationPrev[5];
2113 KGVec2 MouseDragMaxDistanceAbs[5];
2114 float MouseDragMaxDistanceSqr[5];
2117 bool AppAcceptingEvents;
2118 KGS8 BackendUsingLegacyKeyArrays;
2119 bool BackendUsingLegacyNavInputArray;
2120 KGWchar16 InputQueueSurrogate;
2141 KarmaGuiInputTextFlags EventFlag;
2142 KarmaGuiInputTextFlags Flags;
2149 KarmaGuiKey EventKey;
2160 KarmaGuiInputTextCallbackData();
2161 void DeleteChars(
int pos,
int bytes_count);
2162 void InsertChars(
int pos,
const char* text,
const char* text_end = NULL);
2163 void SelectAll() { SelectionStart = 0; SelectionEnd = BufTextLen; }
2164 void ClearSelection() { SelectionStart = SelectionEnd = BufTextLen; }
2165 bool HasSelection()
const {
return SelectionStart != SelectionEnd; }
2188 KGGuiID ParentViewportId;
2189 KarmaGuiViewportFlags ViewportFlagsOverrideSet;
2190 KarmaGuiViewportFlags ViewportFlagsOverrideClear;
2191 KarmaGuiTabItemFlags TabItemFlagsOverrideSet;
2192 KarmaGuiDockNodeFlags DockNodeFlagsOverrideSet;
2193 bool DockingAlwaysTabBar;
2194 bool DockingAllowUnclassed;
2196 KarmaGuiWindowClass() { memset(
this, 0,
sizeof(*
this)); ParentViewportId = (KGGuiID)-1; DockingAllowUnclassed =
true; }
2208 KGGuiID SourceParentId;
2210 char DataType[32 + 1];
2214 KarmaGuiPayload() { Clear(); }
2215 void Clear() { SourceId = SourceParentId = 0; Data = NULL; DataSize = 0; memset(DataType, 0,
sizeof(DataType)); DataFrameCount = -1; Preview = Delivery =
false; }
2216 bool IsDataType(
const char* type)
const {
return DataFrameCount != -1 && strcmp(type, DataType) == 0; }
2217 bool IsPreview()
const {
return Preview; }
2218 bool IsDelivery()
const {
return Delivery; }
2224 KGGuiID ColumnUserID;
2227 KarmaGuiSortDirection SortDirection : 8;
2229 KarmaGuiTableColumnSortSpecs() { memset(
this, 0,
sizeof(*
this)); }
2242 KarmaGuiTableSortSpecs() { memset(
this, 0,
sizeof(*
this)); }
2250#define KG_UNICODE_CODEPOINT_INVALID 0xFFFD
2251#define KG_UNICODE_CODEPOINT_MAX 0xFFFF
2258 KarmaGuiOnceUponAFrame() { RefFrame = -1; }
2259 mutable int RefFrame;
2260 operator bool()
const {
int current_frame = Karma::KarmaGui::GetFrameCount();
if (RefFrame == current_frame)
return false; RefFrame = current_frame;
return true; }
2266 KarmaGuiTextFilter(
const char* default_filter =
"");
2267 bool Draw(
const char* label =
"Filter (inc,-exc)",
float width = 0.0f);
2268 bool PassFilter(
const char* text,
const char* text_end = NULL)
const;
2270 void Clear() { InputBuf[0] = 0; Build(); }
2271 bool IsActive()
const {
return !Filters.empty(); }
2279 ImGuiTextRange() { b = e = NULL; }
2280 ImGuiTextRange(
const char* _b,
const char* _e) { b = _b; e = _e; }
2281 bool empty()
const {
return b == e; }
2294 static char EmptyString[1];
2296 KarmaGuiTextBuffer() { }
2297 inline char operator[](
int i)
const { KR_CORE_ASSERT(Buf.Data != NULL,
"");
return Buf.Data[i]; }
2298 const char* begin()
const {
return Buf.Data ? &Buf.front() : EmptyString; }
2299 const char* end()
const {
return Buf.Data ? &Buf.back() : EmptyString; }
2300 int size()
const {
return Buf.Size ? Buf.Size - 1 : 0; }
2301 bool empty()
const {
return Buf.Size <= 1; }
2302 void clear() { Buf.clear(); }
2303 void reserve(
int capacity) { Buf.reserve(capacity); }
2304 const char* c_str()
const {
return Buf.Data ? Buf.Data : EmptyString; }
2305 void append(
const char* str,
const char* str_end = NULL);
2306 void appendf(
const char* fmt, ...) KG_FMTARGS(2);
2307 void appendfv(
const char* fmt, va_list args) KG_FMTLIST(2);
2321 struct ImGuiStoragePair
2324 union {
int val_i;
float val_f;
void* val_p; };
2325 ImGuiStoragePair(KGGuiID _key,
int _val_i) { key = _key; val_i = _val_i; }
2326 ImGuiStoragePair(KGGuiID _key,
float _val_f) { key = _key; val_f = _val_f; }
2327 ImGuiStoragePair(KGGuiID _key,
void* _val_p) { key = _key; val_p = _val_p; }
2335 void Clear() { Data.clear(); }
2336 int GetInt(KGGuiID key,
int default_val = 0)
const;
2337 void SetInt(KGGuiID key,
int val);
2338 bool GetBool(KGGuiID key,
bool default_val =
false)
const;
2339 void SetBool(KGGuiID key,
bool val);
2340 float GetFloat(KGGuiID key,
float default_val = 0.0f)
const;
2341 void SetFloat(KGGuiID key,
float val);
2342 void* GetVoidPtr(KGGuiID key)
const;
2343 void SetVoidPtr(KGGuiID key,
void* val);
2349 int* GetIntRef(KGGuiID key,
int default_val = 0);
2350 bool* GetBoolRef(KGGuiID key,
bool default_val =
false);
2351 float* GetFloatRef(KGGuiID key,
float default_val = 0.0f);
2352 void** GetVoidPtrRef(KGGuiID key,
void* default_val = NULL);
2355 void SetAllInt(
int val);
2358 void BuildSortByKey();
2392 KarmaGuiListClipper();
2393 ~KarmaGuiListClipper();
2394 void Begin(
int items_count,
float items_height = -1.0f);
2399 void ForceDisplayRangeByIndices(
int item_min,
int item_max);
2400 inline KarmaGuiListClipper(
int items_count,
float items_height = -1.0f) { memset(
this, 0,
sizeof(*
this)); ItemsCount = -1; Begin(items_count, items_height); }
2405#ifndef KG_COL32_R_SHIFT
2406#define KG_COL32_R_SHIFT 0
2407#define KG_COL32_G_SHIFT 8
2408#define KG_COL32_B_SHIFT 16
2409#define KG_COL32_A_SHIFT 24
2410#define KG_COL32_A_MASK 0xFF000000
2412#define KG_COL32(R,G,B,A) (((KGU32)(A)<<KG_COL32_A_SHIFT) | ((KGU32)(B)<<KG_COL32_B_SHIFT) | ((KGU32)(G)<<KG_COL32_G_SHIFT) | ((KGU32)(R)<<KG_COL32_R_SHIFT))
2413#define KG_COL32_WHITE KG_COL32(255,255,255,255)
2414#define KG_COL32_BLACK KG_COL32(0,0,0,255)
2415#define KG_COL32_BLACK_TRANS KG_COL32(0,0,0,0)
2425 constexpr KGColor() { }
2426 constexpr KGColor(
float r,
float g,
float b,
float a = 1.0f) : Value(r, g, b, a) { }
2427 constexpr KGColor(
const KGVec4& col) : Value(col) {}
2428 KGColor(
int r,
int g,
int b,
int a = 255) {
float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; }
2429 KGColor(KGU32 rgba) {
float sc = 1.0f / 255.0f; Value.x = (float)((rgba >> KG_COL32_R_SHIFT) & 0xFF) * sc; Value.y = (float)((rgba >> KG_COL32_G_SHIFT) & 0xFF) * sc; Value.z = (float)((rgba >> KG_COL32_B_SHIFT) & 0xFF) * sc; Value.w = (float)((rgba >> KG_COL32_A_SHIFT) & 0xFF) * sc; }
2430 inline operator KGU32()
const {
return Karma::KarmaGui::ColorConvertFloat4ToU32(Value); }
2431 inline operator KGVec4()
const {
return Value; }
2434 inline void SetHSV(
float h,
float s,
float v,
float a = 1.0f){ Karma::KarmaGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; }
2435 KGColor HSV(
float h,
float s,
float v,
float a = 1.0f) {
float r, g, b; Karma::KarmaGui::ColorConvertHSVtoRGB(h, s, v, r, g, b);
return KGColor(r, g, b, a); }
2444#ifndef KG_DRAWLIST_TEX_LINES_WIDTH_MAX
2445#define KG_DRAWLIST_TEX_LINES_WIDTH_MAX (63)
2455#ifndef KGDrawCallback
2463#define KGDrawCallback_ResetRenderState (KGDrawCallback)(-1)
2473 KGTextureID TextureId;
2474 unsigned int VtxOffset;
2475 unsigned int IdxOffset;
2476 unsigned int ElemCount;
2477 KGDrawCallback UserCallback;
2478 void* UserCallbackData;
2480 KGDrawCmd() { memset(
this, 0,
sizeof(*
this)); }
2483 inline KGTextureID GetTexID()
const {
return TextureId; }
2488#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
2500IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
2507 KGTextureID TextureId;
2508 unsigned int VtxOffset;
2527 inline KGDrawListSplitter() { memset(
this, 0,
sizeof(*
this)); }
2528 inline ~KGDrawListSplitter() { ClearFreeMemory(); }
2529 inline void Clear() { _Current = 0; _Count = 1; }
2530 void ClearFreeMemory();
2531 void Split(
KGDrawList* draw_list,
int count);
2533 void SetCurrentChannel(
KGDrawList* draw_list,
int channel_idx);
2540 KGDrawFlags_None = 0,
2541 KGDrawFlags_Closed = 1 << 0,
2542 KGDrawFlags_RoundCornersTopLeft = 1 << 4,
2543 KGDrawFlags_RoundCornersTopRight = 1 << 5,
2544 KGDrawFlags_RoundCornersBottomLeft = 1 << 6,
2545 KGDrawFlags_RoundCornersBottomRight = 1 << 7,
2546 KGDrawFlags_RoundCornersNone = 1 << 8,
2547 KGDrawFlags_RoundCornersTop = KGDrawFlags_RoundCornersTopLeft | KGDrawFlags_RoundCornersTopRight,
2548 KGDrawFlags_RoundCornersBottom = KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersBottomRight,
2549 KGDrawFlags_RoundCornersLeft = KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersTopLeft,
2550 KGDrawFlags_RoundCornersRight = KGDrawFlags_RoundCornersBottomRight | KGDrawFlags_RoundCornersTopRight,
2551 KGDrawFlags_RoundCornersAll = KGDrawFlags_RoundCornersTopLeft | KGDrawFlags_RoundCornersTopRight | KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersBottomRight,
2552 KGDrawFlags_RoundCornersDefault_ = KGDrawFlags_RoundCornersAll,
2553 KGDrawFlags_RoundCornersMask_ = KGDrawFlags_RoundCornersAll | KGDrawFlags_RoundCornersNone,
2558enum KGDrawListFlags_
2560 KGDrawListFlags_None = 0,
2561 KGDrawListFlags_AntiAliasedLines = 1 << 0,
2562 KGDrawListFlags_AntiAliasedLinesUseTex = 1 << 1,
2563 KGDrawListFlags_AntiAliasedFill = 1 << 2,
2564 KGDrawListFlags_AllowVtxOffset = 1 << 3,
2586 KGDrawListFlags Flags;
2589 unsigned int _VtxCurrentIdx;
2591 const char* _OwnerName;
2593 KGDrawIdx* _IdxWritePtr;
2602 KGDrawList(
KGDrawListSharedData* shared_data) { memset(
this, 0,
sizeof(*
this)); _Data = shared_data; }
2604 ~KGDrawList() { _ClearFreeMemory(); }
2605 void PushClipRect(
const KGVec2& clip_rect_min,
const KGVec2& clip_rect_max,
bool intersect_with_current_clip_rect =
false);
2606 void PushClipRectFullScreen();
2608 void PushTextureID(KGTextureID texture_id);
2609 void PopTextureID();
2610 inline KGVec2 GetClipRectMin()
const {
const KGVec4& cr = _ClipRectStack.back();
return KGVec2(cr.x, cr.y); }
2611 inline KGVec2 GetClipRectMax()
const {
const KGVec4& cr = _ClipRectStack.back();
return KGVec2(cr.z, cr.w); }
2620 void AddLine(
const KGVec2& p1,
const KGVec2& p2, KGU32 col,
float thickness = 1.0f);
2621 void AddRect(
const KGVec2& p_min,
const KGVec2& p_max, KGU32 col,
float rounding = 0.0f, KGDrawFlags flags = 0,
float thickness = 1.0f);
2622 void AddRectFilled(
const KGVec2& p_min,
const KGVec2& p_max, KGU32 col,
float rounding = 0.0f, KGDrawFlags flags = 0);
2623 void AddRectFilledMultiColor(
const KGVec2& p_min,
const KGVec2& p_max, KGU32 col_upr_left, KGU32 col_upr_right, KGU32 col_bot_right, KGU32 col_bot_left);
2624 void AddQuad(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4, KGU32 col,
float thickness = 1.0f);
2626 void AddTriangle(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col,
float thickness = 1.0f);
2627 void AddTriangleFilled(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col);
2628 void AddCircle(
const KGVec2& center,
float radius, KGU32 col,
int num_segments = 0,
float thickness = 1.0f);
2629 void AddCircleFilled(
const KGVec2& center,
float radius, KGU32 col,
int num_segments = 0);
2630 void AddNgon(
const KGVec2& center,
float radius, KGU32 col,
int num_segments,
float thickness = 1.0f);
2631 void AddNgonFilled(
const KGVec2& center,
float radius, KGU32 col,
int num_segments);
2632 void AddText(
const KGVec2& pos, KGU32 col,
const char* text_begin,
const char* text_end = NULL);
2633 void AddText(
const KGFont* font,
float font_size,
const KGVec2& pos, KGU32 col,
const char* text_begin,
const char* text_end = NULL,
float wrap_width = 0.0f,
const KGVec4* cpu_fine_clip_rect = NULL);
2634 void AddPolyline(
const KGVec2* points,
int num_points, KGU32 col, KGDrawFlags flags,
float thickness);
2635 void AddConvexPolyFilled(
const KGVec2* points,
int num_points, KGU32 col);
2636 void AddBezierCubic(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4, KGU32 col,
float thickness,
int num_segments = 0);
2637 void AddBezierQuadratic(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col,
float thickness,
int num_segments = 0);
2643 void AddImage(KGTextureID user_texture_id,
const KGVec2& p_min,
const KGVec2& p_max,
const KGVec2& uv_min =
KGVec2(0, 0),
const KGVec2& uv_max =
KGVec2(1, 1), KGU32 col = KG_COL32_WHITE);
2644 void AddImageQuad(KGTextureID user_texture_id,
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4,
const KGVec2& uv1 =
KGVec2(0, 0),
const KGVec2& uv2 =
KGVec2(1, 0),
const KGVec2& uv3 =
KGVec2(1, 1),
const KGVec2& uv4 =
KGVec2(0, 1), KGU32 col = KG_COL32_WHITE);
2645 void AddImageRounded(KGTextureID user_texture_id,
const KGVec2& p_min,
const KGVec2& p_max,
const KGVec2& uv_min,
const KGVec2& uv_max, KGU32 col,
float rounding, KGDrawFlags flags = 0);
2648 void SetWindowBackgroundColor(
KGVec4 bgColor);
2652 inline void PathClear() { _Path.Size = 0; }
2653 inline void PathLineTo(
const KGVec2& pos) { _Path.push_back(pos); }
2654 inline void PathLineToMergeDuplicate(
const KGVec2& pos) {
if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }
2655 inline void PathFillConvex(KGU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; }
2656 inline void PathStroke(KGU32 col, KGDrawFlags flags = 0,
float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, flags, thickness); _Path.Size = 0; }
2657 void PathArcTo(
const KGVec2& center,
float radius,
float a_min,
float a_max,
int num_segments = 0);
2658 void PathArcToFast(
const KGVec2& center,
float radius,
int a_min_of_12,
int a_max_of_12);
2659 void PathBezierCubicCurveTo(
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4,
int num_segments = 0);
2660 void PathBezierQuadraticCurveTo(
const KGVec2& p2,
const KGVec2& p3,
int num_segments = 0);
2661 void PathRect(
const KGVec2& rect_min,
const KGVec2& rect_max,
float rounding = 0.0f, KGDrawFlags flags = 0);
2664 void AddCallback(KGDrawCallback callback,
void* callback_data);
2666 KGDrawList* CloneOutput()
const;
2674 inline void ChannelsSplit(
int count) { _Splitter.Split(
this, count); }
2675 inline void ChannelsMerge() { _Splitter.Merge(
this); }
2676 inline void ChannelsSetCurrent(
int n) { _Splitter.SetCurrentChannel(
this, n); }
2681 void PrimReserve(
int idx_count,
int vtx_count);
2682 void PrimUnreserve(
int idx_count,
int vtx_count);
2683 void PrimRect(
const KGVec2& a,
const KGVec2& b, KGU32 col);
2686 inline void PrimWriteVtx(
const KGVec2& pos,
const KGVec2& uv, KGU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
2687 inline void PrimWriteIdx(KGDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
2688 inline void PrimVtx(
const KGVec2& pos,
const KGVec2& uv, KGU32 col) { PrimWriteIdx((KGDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }
2691 void _ResetForNewFrame();
2692 void _ClearFreeMemory();
2693 void _PopUnusedDrawCmd();
2694 void _TryMergeDrawCmds();
2695 void _OnChangedClipRect();
2696 void _OnChangedTextureID();
2697 void _OnChangedVtxOffset();
2698 int _CalcCircleAutoSegmentCount(
float radius)
const;
2699 void _PathArcToFastEx(
const KGVec2& center,
float radius,
int a_min_sample,
int a_max_sample,
int a_step);
2700 void _PathArcToN(
const KGVec2& center,
float radius,
float a_min,
float a_max,
int num_segments);
2719 KGDrawData() { Clear(); }
2720 void Clear() { memset(
this, 0,
sizeof(*
this)); }
2721 void DeIndexAllBuffers();
2722 void ScaleClipRects(
const KGVec2& fb_scale);
2733 bool FontDataOwnedByAtlas;
2739 KGVec2 GlyphExtraSpacing;
2741 const KGWchar* GlyphRanges;
2742 float GlyphMinAdvanceX;
2743 float GlyphMaxAdvanceX;
2745 unsigned int FontBuilderFlags;
2746 float RasterizerMultiply;
2747 KGWchar EllipsisChar;
2760 unsigned int Colored : 1;
2761 unsigned int Visible : 1;
2762 unsigned int Codepoint : 30;
2764 float X0, Y0, X1, Y1;
2765 float U0, V0, U1, V1;
2774 KGFontGlyphRangesBuilder() { Clear(); }
2775 inline void Clear() {
int size_in_bytes = (KG_UNICODE_CODEPOINT_MAX + 1) / 8; UsedChars.resize(size_in_bytes / (
int)
sizeof(KGU32)); memset(UsedChars.Data, 0, (
size_t)size_in_bytes); }
2776 inline bool GetBit(
size_t n)
const {
int off = (int)(n >> 5); KGU32 mask = 1u << (n & 31);
return (UsedChars[off] & mask) != 0; }
2777 inline void SetBit(
size_t n) {
int off = (int)(n >> 5); KGU32 mask = 1u << (n & 31); UsedChars[off] |= mask; }
2778 inline void AddChar(KGWchar c) { SetBit(c); }
2779 void AddText(
const char* text,
const char* text_end = NULL);
2780 void AddRanges(
const KGWchar* ranges);
2787 unsigned short Width, Height;
2788 unsigned short X, Y;
2789 unsigned int GlyphID;
2790 float GlyphAdvanceX;
2793 KGFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset =
KGVec2(0, 0); Font = NULL; }
2794 bool IsPacked()
const {
return X != 0xFFFF; }
2798enum KGFontAtlasFlags_
2800 KGFontAtlasFlags_None = 0,
2801 KGFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0,
2802 KGFontAtlasFlags_NoMouseCursors = 1 << 1,
2803 KGFontAtlasFlags_NoBakedLines = 1 << 2,
2829 KGFont* AddFontFromFileTTF(
const char* filename,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2830 KGFont* AddFontFromMemoryTTF(
void* font_data,
int font_size,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2831 KGFont* AddFontFromMemoryCompressedTTF(
const void* compressed_font_data,
int compressed_font_size,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2832 KGFont* AddFontFromMemoryCompressedBase85TTF(
const char* compressed_font_data_base85,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2833 void ClearInputData();
2834 void ClearTexData();
2844 void GetTexDataAsAlpha8(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2845 void GetTexDataAsRGBA32(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2846 bool IsBuilt()
const {
return Fonts.Size > 0 && TexReady; }
2847 void SetTexID(KGTextureID
id) { TexID = id; }
2856 static const KGWchar* GetGlyphRangesDefault();
2857 static const KGWchar* GetGlyphRangesGreek();
2858 static const KGWchar* GetGlyphRangesKorean();
2859 static const KGWchar* GetGlyphRangesJapanese();
2860 static const KGWchar* GetGlyphRangesChineseFull();
2861 static const KGWchar* GetGlyphRangesChineseSimplifiedCommon();
2862 static const KGWchar* GetGlyphRangesCyrillic();
2863 static const KGWchar* GetGlyphRangesThai();
2864 static const KGWchar* GetGlyphRangesVietnamese();
2877 int AddCustomRectRegular(
int width,
int height);
2878 int AddCustomRectFontGlyph(
KGFont* font, KGWchar
id,
int width,
int height,
float advance_x,
const KGVec2& offset =
KGVec2(0, 0));
2879 KGFontAtlasCustomRect* GetCustomRectByIndex(
int index) { KR_CORE_ASSERT(index >= 0,
"");
return &CustomRects[index]; }
2883 bool GetMouseCursorTexData(KarmaGuiMouseCursor cursor,
KGVec2* out_offset,
KGVec2* out_size,
KGVec2 out_uv_border[2],
KGVec2 out_uv_fill[2]);
2889 KGFontAtlasFlags Flags;
2891 int TexDesiredWidth;
2892 int TexGlyphPadding;
2899 bool TexPixelsUseColors;
2900 unsigned char* TexPixelsAlpha8;
2901 unsigned int* TexPixelsRGBA32;
2909 KGVec4 TexUvLines[KG_DRAWLIST_TEX_LINES_WIDTH_MAX + 1];
2913 unsigned int FontBuilderFlags;
2916 int PackIdMouseCursors;
2930 float FallbackAdvanceX;
2941 short ConfigDataCount;
2942 KGWchar FallbackChar;
2943 KGWchar EllipsisChar;
2945 bool DirtyLookupTables;
2947 float Ascent, Descent;
2948 int MetricsTotalSurface;
2949 KGU8 Used4kPagesMap[(KG_UNICODE_CODEPOINT_MAX+1)/4096/8];
2955 const KGFontGlyph*FindGlyphNoFallback(KGWchar c)
const;
2956 float GetCharAdvance(KGWchar c)
const {
return ((
int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; }
2957 bool IsLoaded()
const {
return ContainerAtlas != NULL; }
2958 const char* GetDebugName()
const {
return ConfigData ? ConfigData->Name :
"<unknown>"; }
2962 KGVec2 CalcTextSizeA(
float size,
float max_width,
float wrap_width,
const char* text_begin,
const char* text_end = NULL,
const char** remaining = NULL)
const;
2963 const char* CalcWordWrapPositionA(
float scale,
const char* text,
const char* text_end,
float wrap_width)
const;
2964 void RenderChar(
KGDrawList* draw_list,
float size,
const KGVec2& pos, KGU32 col, KGWchar c)
const;
2965 void RenderText(
KGDrawList* draw_list,
float size,
const KGVec2& pos, KGU32 col,
const KGVec4& clip_rect,
const char* text_begin,
const char* text_end,
float wrap_width = 0.0f,
bool cpu_fine_clip =
false)
const;
2968 void BuildLookupTable();
2969 void ClearOutputData();
2970 void GrowIndex(
int new_size);
2971 void AddGlyph(
const KGFontConfig* src_cfg, KGWchar c,
float x0,
float y0,
float x1,
float y1,
float u0,
float v0,
float u1,
float v1,
float advance_x);
2972 void AddRemapChar(KGWchar dst, KGWchar src,
bool overwrite_dst =
true);
2973 void SetGlyphVisible(KGWchar c,
bool visible);
2974 bool IsGlyphRangeUnused(
unsigned int c_begin,
unsigned int c_last);
2982enum KGGuiViewportFlags_
2984 KGGuiViewportFlags_None = 0,
2985 KGGuiViewportFlags_IsPlatformWindow = 1 << 0,
2986 KGGuiViewportFlags_IsPlatformMonitor = 1 << 1,
2987 KGGuiViewportFlags_OwnedByApp = 1 << 2,
2988 KGGuiViewportFlags_NoDecoration = 1 << 3,
2989 KGGuiViewportFlags_NoTaskBarIcon = 1 << 4,
2990 KGGuiViewportFlags_NoFocusOnAppearing = 1 << 5,
2991 KGGuiViewportFlags_NoFocusOnClick = 1 << 6,
2992 KGGuiViewportFlags_NoInputs = 1 << 7,
2993 KGGuiViewportFlags_NoRendererClear = 1 << 8,
2994 KGGuiViewportFlags_TopMost = 1 << 9,
2995 KGGuiViewportFlags_Minimized = 1 << 10,
2996 KGGuiViewportFlags_NoAutoMerge = 1 << 11,
2997 KGGuiViewportFlags_CanHostOtherWindows = 1 << 12,
3017 KarmaGuiViewportFlags Flags;
3023 KGGuiID ParentViewportId;
3031 void* RendererUserData;
3032 void* PlatformUserData;
3033 void* PlatformHandle;
3034 void* PlatformHandleRaw;
3035 bool PlatformWindowCreated;
3036 bool PlatformRequestMove;
3037 bool PlatformRequestResize;
3038 bool PlatformRequestClose;
3040 KarmaGuiViewport() { memset(
this, 0,
sizeof(*
this)); }
3041 ~KarmaGuiViewport() { KR_CORE_ASSERT(PlatformUserData == NULL && RendererUserData == NULL,
""); }
3044 KGVec2 GetCenter()
const {
return KGVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }
3045 KGVec2 GetWorkCenter()
const {
return KGVec2(WorkPos.x + WorkSize.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); }
3135 int (*Platform_CreateVkSurface)(
KarmaGuiViewport* vp, KGU64 vk_inst,
const void* vk_allocators, KGU64* out_vk_surface);
3182 KarmaGuiPlatformIO() { memset(
this, 0,
sizeof(*
this)); }
3189 KGVec2 MainPos, MainSize;
3190 KGVec2 WorkPos, WorkSize;
3192 KarmaGuiPlatformMonitor() { MainPos = MainSize = WorkPos = WorkSize =
KGVec2(0, 0); DpiScale = 1.0f; }
3200 float InputLineHeight;
3202 KarmaGuiPlatformImeData() { memset(
this, 0,
sizeof(*
this)); }
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
The chief class for our UI needs. The responsibility includes.
Definition KarmaGui.h:188
static bool ImageButton(const char *str_id, KGTextureID user_texture_id, const KGVec2 &size, const KGVec2 &uv0=KGVec2(0, 0), const KGVec2 &uv1=KGVec2(1, 1), const KGVec4 &bg_col=KGVec4(0, 0, 0, 0), const KGVec4 &tint_col=KGVec4(1, 1, 1, 1))
Function for drawing button with specified image.
Definition KarmaGuiWidgets.cpp:1110
static void MemFree(void *ptr)
A legacy function brought from ImGui for UI relevant memory deallocation.
Definition KarmaGui.cpp:3102
static void Render()
Function to fill the KGDrawData instance of KarmaGui.
Definition KarmaGui.cpp:4120
static void RenderPlatformWindowsDefault(void *platform_render_arg=NULL, void *renderer_render_arg=NULL)
Call in main loop. Will call RenderWindow/SwapBuffers platform functions for each secondary viewport ...
Definition KarmaGui.cpp:13339
static void AddTextVertical(KGDrawList *DrawList, const char *text, KGVec2 pos, KGU32 text_color)
Definition KarmaGuiWidgets.cpp:297
static void * MemAlloc(size_t size)
A legacy function brought from ImGui for UI relevant memory allocation.
Definition KarmaGui.cpp:3094
Definition KarmaGui.h:2422
Definition KarmaGui.h:2513
Definition KarmaGui.h:2471
Definition KarmaGui.h:2707
Draw command list.
Definition KarmaGui.h:2581
Definition KarmaGuiInternal.h:632
Definition KarmaGui.h:2522
Definition KarmaGui.h:2490
Definition KarmaGui.h:2786
Definition KarmaGui.h:2824
Definition KarmaGuiInternal.h:3369
Definition KarmaGui.h:2730
Definition KarmaGui.h:2759
Definition KarmaGui.h:2771
Definition KarmaGui.h:2927
Definition KarmaGui.h:1795
Definition KarmaGui.h:153
Definition KarmaGui.h:163
Definition KarmaGui.h:1817
Definition KarmaGuiInternal.h:1734
Definition KarmaGui.h:1952
Definition KarmaGui.h:2140
Definition KarmaGui.h:1944
Definition KarmaGui.h:2382
Definition KarmaGui.h:2257
Definition KarmaGui.h:2201
Definition KarmaGui.h:2171
Definition KarmaGui.h:2319
Definition KarmaGui.h:1887
Definition KarmaGui.h:2223
Definition KarmaGui.h:2237
Definition KarmaGui.h:2292
Definition KarmaGui.h:2265
A Platform Window (always 1 unless multi-viewport are enabled. One per platform window to output to)....
Definition KarmaGui.h:3015
Definition KarmaGui.h:2186