4#if(defined(__clang__) || defined(__GNUC__))
5#define KG_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
6#define KG_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
12#define KG_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR))))
13#define KG_UNUSED(_VAR) ((void)(_VAR))
14#define KG_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER)
66enum KarmaGuiKey : int;
68typedef int KarmaGuiCol;
69typedef int KarmaGuiCond;
70typedef int KarmaGuiDataType;
71typedef int KarmaGuiDir;
72typedef int KarmaGuiMouseButton;
73typedef int KarmaGuiMouseCursor;
74typedef int KarmaGuiSortDirection;
75typedef int KarmaGuiStyleVar;
76typedef int KarmaGuiTableBgTarget;
79typedef int KGDrawFlags;
80typedef int KGDrawListFlags;
81typedef int KGFontAtlasFlags;
82typedef int KarmaGuiBackendFlags;
83typedef int KarmaGuiButtonFlags;
84typedef int KarmaGuiColorEditFlags;
85typedef int KarmaGuiConfigFlags;
86typedef int KarmaGuiComboFlags;
87typedef int KarmaGuiDockNodeFlags;
88typedef int KarmaGuiDragDropFlags;
89typedef int KarmaGuiFocusedFlags;
90typedef int KarmaGuiHoveredFlags;
91typedef int KarmaGuiInputFlags;
92typedef int KarmaGuiInputTextFlags;
93typedef int KarmaGuiKeyChord;
94typedef int KarmaGuiPopupFlags;
95typedef int KarmaGuiSelectableFlags;
96typedef int KarmaGuiSliderFlags;
97typedef int KarmaGuiTabBarFlags;
98typedef int KarmaGuiTabItemFlags;
99typedef int KarmaGuiTableFlags;
100typedef int KarmaGuiTableColumnFlags;
101typedef int KarmaGuiTableRowFlags;
102typedef int KarmaGuiTreeNodeFlags;
103typedef int KarmaGuiViewportFlags;
104typedef int KarmaGuiWindowFlags;
105typedef void* KGTextureID;
112typedef unsigned short KGDrawIdx;
121typedef unsigned int KGGuiID;
122typedef signed char KGS8;
123typedef unsigned char KGU8;
124typedef signed short KGS16;
125typedef unsigned short KGU16;
126typedef signed int KGS32;
127typedef unsigned int KGU32;
128typedef signed long long KGS64;
129typedef unsigned long long KGU64;
133typedef unsigned short KGWchar16;
134typedef KGWchar16 KGWchar;
139typedef void* (*KarmaGuiMemAllocFunc)(
size_t sz,
void* user_data);
140typedef void (*KarmaGuiMemFreeFunc)(
void* ptr,
void* user_data);
147 constexpr KGVec2() : x(0.0f), y(0.0f) { }
148 constexpr KGVec2(
float _x,
float _y) : x(_x), y(_y) { }
149 float operator[] (
size_t idx)
const { KR_CORE_ASSERT(idx <= 1,
"");
return (&x)[idx]; }
150 float& operator[] (
size_t idx) { KR_CORE_ASSERT(idx <= 1,
"");
return (&x)[idx]; }
157 constexpr KGVec4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) { }
158 constexpr KGVec4(
float _x,
float _y,
float _z,
float _w) : x(_x), y(_y), z(_z), w(_w) { }
159#ifdef KG_VEC4_CLASS_EXTRA
178 static void NewFrame();
179 static void EndFrame();
180 static void Render();
184 static void ShowDemoWindow(
bool* p_open = NULL);
185 static void ShowMetricsWindow(
bool* p_open = NULL);
186 static void ShowDebugLogWindow(
bool* p_open = NULL);
187 static void ShowStackToolWindow(
bool* p_open = NULL);
188 static void ShowAboutWindow(
bool* p_open = NULL);
190 static bool ShowStyleSelector(
const char* label);
191 static void ShowFontSelector(
const char* label);
192 static void ShowUserGuide();
212 static bool Begin(
const char* name,
bool* p_open = NULL, KarmaGuiWindowFlags flags = 0);
223 static bool BeginChild(
const char* str_id,
const KGVec2& size =
KGVec2(0, 0),
bool border =
false, KarmaGuiWindowFlags flags = 0);
224 static bool BeginChild(KGGuiID
id,
const KGVec2& size =
KGVec2(0, 0),
bool border =
false, KarmaGuiWindowFlags flags = 0);
225 static void EndChild();
229 static bool IsWindowAppearing();
230 static bool IsWindowCollapsed();
231 static bool IsWindowFocused(KarmaGuiFocusedFlags flags=0);
232 static bool IsWindowHovered(KarmaGuiHoveredFlags flags=0);
234 static float GetWindowDpiScale();
235 static KGVec2 GetWindowPos();
236 static KGVec2 GetWindowSize();
237 static float GetWindowWidth();
238 static float GetWindowHeight();
243 static void SetNextWindowPos(
const KGVec2& pos, KarmaGuiCond cond = 0,
const KGVec2& pivot =
KGVec2(0, 0));
244 static void SetNextWindowSize(
const KGVec2& size, KarmaGuiCond cond = 0);
245 static void SetNextWindowSizeConstraints(
const KGVec2& size_min,
const KGVec2& size_max, KarmaGuiSizeCallback custom_callback = NULL,
void* custom_callback_data = NULL);
246 static void SetNextWindowContentSize(
const KGVec2& size);
247 static void SetNextWindowCollapsed(
bool collapsed, KarmaGuiCond cond = 0);
248 static void SetNextWindowFocus();
249 static void SetNextWindowScroll(
const KGVec2& scroll);
250 static void SetNextWindowBgAlpha(
float alpha);
251 static void SetNextWindowViewport(KGGuiID viewport_id);
252 static void SetWindowPos(
const KGVec2& pos, KarmaGuiCond cond = 0);
253 static void SetWindowSize(
const KGVec2& size, KarmaGuiCond cond = 0);
254 static void SetWindowCollapsed(
bool collapsed, KarmaGuiCond cond = 0);
255 static void SetWindowFocus();
256 static void SetWindowFontScale(
float scale);
257 static void SetWindowPos(
const char* name,
const KGVec2& pos, KarmaGuiCond cond = 0);
258 static void SetWindowSize(
const char* name,
const KGVec2& size, KarmaGuiCond cond = 0);
259 static void SetWindowCollapsed(
const char* name,
bool collapsed, KarmaGuiCond cond = 0);
260 static void SetWindowFocus(
const char* name);
265 static KGVec2 GetContentRegionAvail();
266 static KGVec2 GetContentRegionMax();
267 static KGVec2 GetWindowContentRegionMin();
268 static KGVec2 GetWindowContentRegionMax();
273 static float GetScrollX();
274 static float GetScrollY();
275 static void SetScrollX(
float scroll_x);
276 static void SetScrollY(
float scroll_y);
277 static float GetScrollMaxX();
278 static float GetScrollMaxY();
279 static void SetScrollHereX(
float center_x_ratio = 0.5f);
280 static void SetScrollHereY(
float center_y_ratio = 0.5f);
281 static void SetScrollFromPosX(
float local_x,
float center_x_ratio = 0.5f);
282 static void SetScrollFromPosY(
float local_y,
float center_y_ratio = 0.5f);
285 static void PushFont(
KGFont* font);
286 static void PopFont();
287 static void PushStyleColor(KarmaGuiCol idx, KGU32 col);
288 static void PushStyleColor(KarmaGuiCol idx,
const KGVec4& col);
289 static void PopStyleColor(
int count = 1);
290 static void PushStyleVar(KarmaGuiStyleVar idx,
float val);
291 static void PushStyleVar(KarmaGuiStyleVar idx,
const KGVec2& val);
292 static void PopStyleVar(
int count = 1);
293 static void PushAllowKeyboardFocus(
bool allow_keyboard_focus);
294 static void PopAllowKeyboardFocus();
295 static void PushButtonRepeat(
bool repeat);
296 static void PopButtonRepeat();
299 static void PushItemWidth(
float item_width);
300 static void PopItemWidth();
301 static void SetNextItemWidth(
float item_width);
302 static float CalcItemWidth();
303 static void PushTextWrapPos(
float wrap_local_pos_x = 0.0f);
304 static void PopTextWrapPos();
309 static float GetFontSize();
310 static KGVec2 GetFontTexUvWhitePixel();
311 static KGU32 GetColorU32(KarmaGuiCol idx,
float alpha_mul = 1.0f);
312 static KGU32 GetColorU32(
const KGVec4& col);
313 static KGU32 GetColorU32(KGU32 col);
314 static const KGVec4& GetStyleColorVec4(KarmaGuiCol idx);
323 static void Separator();
324 static void SameLine(
float offset_from_start_x=0.0f,
float spacing=-1.0f);
325 static void NewLine();
326 static void Spacing();
327 static void Dummy(
const KGVec2& size);
328 static void Indent(
float indent_w = 0.0f);
329 static void Unindent(
float indent_w = 0.0f);
330 static void BeginGroup();
331 static void EndGroup();
332 static KGVec2 GetCursorPos();
333 static float GetCursorPosX();
334 static float GetCursorPosY();
335 static void SetCursorPos(
const KGVec2& local_pos);
336 static void SetCursorPosX(
float local_x);
337 static void SetCursorPosY(
float local_y);
338 static KGVec2 GetCursorStartPos();
339 static KGVec2 GetCursorScreenPos();
340 static void SetCursorScreenPos(
const KGVec2& pos);
341 static void AlignTextToFramePadding();
342 static float GetTextLineHeight();
343 static float GetTextLineHeightWithSpacing();
344 static float GetFrameHeight();
345 static float GetFrameHeightWithSpacing();
358 static void PushID(
const char* str_id);
359 static void PushID(
const char* str_id_begin,
const char* str_id_end);
360 static void PushID(
const void* ptr_id);
361 static void PushID(
int int_id);
363 static KGGuiID GetID(
const char* str_id);
364 static KGGuiID GetID(
const char* str_id_begin,
const char* str_id_end);
365 static KGGuiID GetID(
const void* ptr_id);
368 static void TextUnformatted(
const char* text,
const char* text_end = NULL);
369 static void Text(
const char* fmt, ...) KG_FMTARGS(1);
370 static void TextV(
const char* fmt, va_list args) KG_FMTLIST(1);
371 static void TextColored(
const KGVec4& col,
const char* fmt, ...) KG_FMTARGS(2);
372 static void AddTextVertical(
KGDrawList* DrawList,
const char *text,
KGVec2 pos, KGU32 text_color);
373 static void TextColoredV(
const KGVec4& col,
const char* fmt, va_list args) KG_FMTLIST(2);
374 static void TextDisabled(
const char* fmt, ...) KG_FMTARGS(1);
375 static void TextDisabledV(
const char* fmt, va_list args) KG_FMTLIST(1);
376 static void TextWrapped(
const char* fmt, ...) KG_FMTARGS(1);
377 static void TextWrappedV(
const char* fmt, va_list args) KG_FMTLIST(1);
378 static void LabelText(
const char* label,
const char* fmt, ...) KG_FMTARGS(2);
379 static void LabelTextV(
const char* label,
const char* fmt, va_list args) KG_FMTLIST(2);
380 static void BulletText(
const char* fmt, ...) KG_FMTARGS(1);
381 static void BulletTextV(
const char* fmt, va_list args) KG_FMTLIST(1);
387 static bool SmallButton(
const char* label);
388 static bool InvisibleButton(
const char* str_id,
const KGVec2& size, KarmaGuiButtonFlags flags = 0);
389 static bool ArrowButton(
const char* str_id, KarmaGuiDir dir);
390 static bool Checkbox(
const char* label,
bool* v);
391 static bool CheckboxFlags(
const char* label,
int* flags,
int flags_value);
392 static bool CheckboxFlags(
const char* label,
unsigned int* flags,
unsigned int flags_value);
393 static bool RadioButton(
const char* label,
bool active);
394 static bool RadioButton(
const char* label,
int* v,
int v_button);
395 static void ProgressBar(
float fraction,
const KGVec2& size_arg =
KGVec2(-FLT_MIN, 0),
const char* overlay = NULL);
396 static void Bullet();
400 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));
401 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));
406 static bool BeginCombo(
const char* label,
const char* preview_value, KarmaGuiComboFlags flags = 0);
407 static void EndCombo();
408 static bool Combo(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int popup_max_height_in_items = -1);
409 static bool Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int popup_max_height_in_items = -1);
410 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);
424 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);
425 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);
426 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);
427 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);
428 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);
429 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);
430 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);
431 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);
432 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);
433 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);
434 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);
435 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);
443 static bool SliderFloat(
const char* label,
float* v,
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
444 static bool SliderFloat2(
const char* label,
float v[2],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
445 static bool SliderFloat3(
const char* label,
float v[3],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
446 static bool SliderFloat4(
const char* label,
float v[4],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
447 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);
448 static bool SliderInt(
const char* label,
int* v,
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
449 static bool SliderInt2(
const char* label,
int v[2],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
450 static bool SliderInt3(
const char* label,
int v[3],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
451 static bool SliderInt4(
const char* label,
int v[4],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
452 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);
453 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);
454 static bool VSliderFloat(
const char* label,
const KGVec2& size,
float* v,
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
455 static bool VSliderInt(
const char* label,
const KGVec2& size,
int* v,
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
456 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);
461 static bool InputText(
const char* label,
char* buf,
size_t buf_size, KarmaGuiInputTextFlags flags = 0, KarmaGuiInputTextCallback callback = NULL,
void* user_data = NULL);
462 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);
463 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);
464 static bool InputFloat(
const char* label,
float* v,
float step = 0.0f,
float step_fast = 0.0f,
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
465 static bool InputFloat2(
const char* label,
float v[2],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
466 static bool InputFloat3(
const char* label,
float v[3],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
467 static bool InputFloat4(
const char* label,
float v[4],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
468 static bool InputInt(
const char* label,
int* v,
int step = 1,
int step_fast = 100, KarmaGuiInputTextFlags flags = 0);
469 static bool InputInt2(
const char* label,
int v[2], KarmaGuiInputTextFlags flags = 0);
470 static bool InputInt3(
const char* label,
int v[3], KarmaGuiInputTextFlags flags = 0);
471 static bool InputInt4(
const char* label,
int v[4], KarmaGuiInputTextFlags flags = 0);
472 static bool InputDouble(
const char* label,
double* v,
double step = 0.0,
double step_fast = 0.0,
const char* format =
"%.6f", KarmaGuiInputTextFlags flags = 0);
473 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);
474 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);
479 static bool ColorEdit3(
const char* label,
float col[3], KarmaGuiColorEditFlags flags = 0);
480 static bool ColorEdit4(
const char* label,
float col[4], KarmaGuiColorEditFlags flags = 0);
481 static bool ColorPicker3(
const char* label,
float col[3], KarmaGuiColorEditFlags flags = 0);
482 static bool ColorPicker4(
const char* label,
float col[4], KarmaGuiColorEditFlags flags = 0,
const float* ref_col = NULL);
483 static bool ColorButton(
const char* desc_id,
const KGVec4& col, KarmaGuiColorEditFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
484 static void SetColorEditOptions(KarmaGuiColorEditFlags flags);
488 static bool TreeNode(
const char* label);
489 static bool TreeNode(
const char* str_id,
const char* fmt, ...) KG_FMTARGS(2);
490 static bool TreeNode(
const void* ptr_id,
const char* fmt, ...) KG_FMTARGS(2);
491 static bool TreeNodeV(
const char* str_id,
const char* fmt, va_list args) KG_FMTLIST(2);
492 static bool TreeNodeV(
const void* ptr_id,
const char* fmt, va_list args) KG_FMTLIST(2);
493 static bool TreeNodeEx(
const char* label, KarmaGuiTreeNodeFlags flags = 0);
494 static bool TreeNodeEx(
const char* str_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, ...) KG_FMTARGS(3);
495 static bool TreeNodeEx(
const void* ptr_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, ...) KG_FMTARGS(3);
496 static bool TreeNodeExV(
const char* str_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, va_list args) KG_FMTLIST(3);
497 static bool TreeNodeExV(
const void* ptr_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, va_list args) KG_FMTLIST(3);
498 static void TreePush(
const char* str_id);
499 static void TreePush(
const void* ptr_id);
500 static void TreePop();
501 static float GetTreeNodeToLabelSpacing();
502 static bool CollapsingHeader(
const char* label, KarmaGuiTreeNodeFlags flags = 0);
503 static bool CollapsingHeader(
const char* label,
bool* p_visible, KarmaGuiTreeNodeFlags flags = 0);
504 static void SetNextItemOpen(
bool is_open, KarmaGuiCond cond = 0);
509 static bool Selectable(
const char* label,
bool selected =
false, KarmaGuiSelectableFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
510 static bool Selectable(
const char* label,
bool* p_selected, KarmaGuiSelectableFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
518 static bool BeginListBox(
const char* label,
const KGVec2& size =
KGVec2(0, 0));
519 static void EndListBox();
520 static bool ListBox(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int height_in_items = -1);
521 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);
525 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));
526 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));
527 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));
528 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));
532 static void Value(
const char* prefix,
bool b);
533 static void Value(
const char* prefix,
int v);
534 static void Value(
const char* prefix,
unsigned int v);
535 static void Value(
const char* prefix,
float v,
const char* float_format = NULL);
542 static bool BeginMenuBar();
543 static void EndMenuBar();
544 static bool BeginMainMenuBar();
545 static void EndMainMenuBar();
546 static bool BeginMenu(
const char* label,
bool enabled =
true);
547 static void EndMenu();
548 static bool MenuItem(
const char* label,
const char* shortcut = NULL,
bool selected =
false,
bool enabled =
true);
549 static bool MenuItem(
const char* label,
const char* shortcut,
bool* p_selected,
bool enabled =
true);
553 static void BeginTooltip();
554 static void EndTooltip();
555 static void SetTooltip(
const char* fmt, ...) KG_FMTARGS(1);
556 static void SetTooltipV(
const char* fmt, va_list args) KG_FMTLIST(1);
570 static bool BeginPopup(
const char* str_id, KarmaGuiWindowFlags flags = 0);
571 static bool BeginPopupModal(
const char* name,
bool* p_open = NULL, KarmaGuiWindowFlags flags = 0);
572 static void EndPopup();
582 static void OpenPopup(
const char* str_id, KarmaGuiPopupFlags popup_flags = 0);
583 static void OpenPopup(KGGuiID
id, KarmaGuiPopupFlags popup_flags = 0);
584 static void OpenPopupOnItemClick(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
585 static void CloseCurrentPopup();
592 static bool BeginPopupContextItem(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
593 static bool BeginPopupContextWindow(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
594 static bool BeginPopupContextVoid(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
600 static bool IsPopupOpen(
const char* str_id, KarmaGuiPopupFlags flags = 0);
625 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);
626 static void EndTable();
627 static void TableNextRow(KarmaGuiTableRowFlags row_flags = 0,
float min_row_height = 0.0f);
628 static bool TableNextColumn();
629 static bool TableSetColumnIndex(
int column_n);
639 static void TableSetupColumn(
const char* label, KarmaGuiTableColumnFlags flags = 0,
float init_width_or_weight = 0.0f, KGGuiID user_id = 0);
640 static void TableSetupScrollFreeze(
int cols,
int rows);
641 static void TableHeadersRow();
642 static void TableHeader(
const char* label);
651 static int TableGetColumnCount();
652 static int TableGetColumnIndex();
653 static int TableGetRowIndex();
654 static const char* TableGetColumnName(
int column_n = -1);
655 static KarmaGuiTableColumnFlags TableGetColumnFlags(
int column_n = -1);
656 static void TableSetColumnEnabled(
int column_n,
bool v);
657 static void TableSetBgColor(KarmaGuiTableBgTarget target, KGU32 color,
int column_n = -1);
661 static void Columns(
int count = 1,
const char*
id = NULL,
bool border =
true);
662 static void NextColumn();
663 static int GetColumnIndex();
664 static float GetColumnWidth(
int column_index = -1);
665 static void SetColumnWidth(
int column_index,
float width);
666 static float GetColumnOffset(
int column_index = -1);
667 static void SetColumnOffset(
int column_index,
float offset_x);
668 static int GetColumnsCount();
672 static bool BeginTabBar(
const char* str_id, KarmaGuiTabBarFlags flags = 0);
673 static void EndTabBar();
674 static bool BeginTabItem(
const char* label,
bool* p_open = NULL, KarmaGuiTabItemFlags flags = 0);
675 static void EndTabItem();
676 static bool TabItemButton(
const char* label, KarmaGuiTabItemFlags flags = 0);
677 static void SetTabItemClosed(
const char* tab_or_docked_window_label);
692 static KGGuiID DockSpace(KGGuiID
id,
const KGVec2& size =
KGVec2(0, 0), KarmaGuiDockNodeFlags flags = 0,
const KarmaGuiWindowClass* window_class = NULL);
694 static void SetNextWindowDockID(KGGuiID dock_id, KarmaGuiCond cond = 0);
696 static KGGuiID GetWindowDockID();
697 static bool IsWindowDocked();
701 static void LogToTTY(
int auto_open_depth = -1);
702 static void LogToFile(
int auto_open_depth = -1,
const char* filename = NULL);
703 static void LogToClipboard(
int auto_open_depth = -1);
704 static void LogFinish();
705 static void LogButtons();
706 static void LogText(
const char* fmt, ...) KG_FMTARGS(1);
707 static void LogTextV(
const char* fmt, va_list args) KG_FMTLIST(1);
708 static void LogTextV(
KarmaGuiContext& g,
const char* fmt, va_list args);
715 static bool BeginDragDropSource(KarmaGuiDragDropFlags flags = 0);
716 static bool SetDragDropPayload(
const char* type,
const void* data,
size_t sz, KarmaGuiCond cond = 0);
717 static void EndDragDropSource();
718 static bool BeginDragDropTarget();
719 static const KarmaGuiPayload* AcceptDragDropPayload(
const char* type, KarmaGuiDragDropFlags flags = 0);
720 static void EndDragDropTarget();
727 static void BeginDisabled(
bool disabled =
true);
728 static void EndDisabled();
732 static void PushClipRect(
const KGVec2& clip_rect_min,
const KGVec2& clip_rect_max,
bool intersect_with_current_clip_rect);
733 static void PopClipRect();
737 static void SetItemDefaultFocus();
738 static void SetKeyboardFocusHere(
int offset = 0);
743 static bool IsItemHovered(KarmaGuiHoveredFlags flags = 0);
744 static bool IsItemActive();
745 static bool IsItemFocused();
746 static bool IsItemClicked(KarmaGuiMouseButton mouse_button = 0);
747 static bool IsItemVisible();
748 static bool IsItemEdited();
749 static bool IsItemActivated();
750 static bool IsItemDeactivated();
751 static bool IsItemDeactivatedAfterEdit();
752 static bool IsItemToggledOpen();
753 static bool IsAnyItemHovered();
754 static bool IsAnyItemActive();
755 static bool IsAnyItemFocused();
756 static KGGuiID GetItemID();
757 static KGVec2 GetItemRectMin();
758 static KGVec2 GetItemRectMax();
759 static KGVec2 GetItemRectSize();
760 static void SetItemAllowOverlap();
775 static bool IsRectVisible(
const KGVec2& size);
776 static bool IsRectVisible(
const KGVec2& rect_min,
const KGVec2& rect_max);
777 static double GetTime();
778 static int GetFrameCount();
780 static const char* GetStyleColorName(KarmaGuiCol idx);
783 static bool BeginChildFrame(KGGuiID
id,
const KGVec2& size, KarmaGuiWindowFlags flags = 0);
784 static void EndChildFrame();
787 static KGVec2 CalcTextSize(
const char* text,
const char* text_end = NULL,
bool hide_text_after_double_hash =
false,
float wrap_width = -1.0f);
790 static KGVec4 ColorConvertU32ToFloat4(KGU32 in);
791 static KGU32 ColorConvertFloat4ToU32(
const KGVec4& in);
792 static void ColorConvertRGBtoHSV(
float r,
float g,
float b,
float& out_h,
float& out_s,
float& out_v);
793 static void ColorConvertHSVtoRGB(
float h,
float s,
float v,
float& out_r,
float& out_g,
float& out_b);
800 static bool IsKeyDown(KarmaGuiKey key);
801 static bool IsKeyPressed(KarmaGuiKey key,
bool repeat =
true);
802 static bool IsKeyReleased(KarmaGuiKey key);
803 static int GetKeyPressedAmount(KarmaGuiKey key,
float repeat_delay,
float rate);
804 static const char* GetKeyName(KarmaGuiKey key);
805 static void SetNextFrameWantCaptureKeyboard(
bool want_capture_keyboard);
820 static bool Shortcut(KarmaGuiKeyChord key_chord, KGGuiID owner_id = 0, KarmaGuiInputFlags flags = 0);
826 static bool IsMouseDown(KarmaGuiMouseButton button);
827 static bool IsMouseClicked(KarmaGuiMouseButton button,
bool repeat =
false);
828 static bool IsMouseReleased(KarmaGuiMouseButton button);
829 static bool IsMouseDoubleClicked(KarmaGuiMouseButton button);
830 static int GetMouseClickedCount(KarmaGuiMouseButton button);
831 static bool IsMouseHoveringRect(
const KGVec2& r_min,
const KGVec2& r_max,
bool clip =
true);
832 static bool IsMousePosValid(
const KGVec2* mouse_pos = NULL);
833 static bool IsAnyMouseDown();
834 static KGVec2 GetMousePos();
835 static KGVec2 GetMousePosOnOpeningCurrentPopup();
836 static bool IsMouseDragging(KarmaGuiMouseButton button,
float lock_threshold = -1.0f);
837 static KGVec2 GetMouseDragDelta(KarmaGuiMouseButton button = 0,
float lock_threshold = -1.0f);
838 static void ResetMouseDragDelta(KarmaGuiMouseButton button = 0);
839 static KarmaGuiMouseCursor GetMouseCursor();
840 static void SetMouseCursor(KarmaGuiMouseCursor cursor_type);
841 static void SetNextFrameWantCaptureMouse(
bool want_capture_mouse);
845 static const char* GetClipboardText();
846 static void SetClipboardText(
const char* text);
852 static void LoadIniSettingsFromDisk(
const char* ini_filename);
853 static void LoadIniSettingsFromMemory(
const char* ini_data,
size_t ini_size=0);
854 static void SaveIniSettingsToDisk(
const char* ini_filename);
855 static const char* SaveIniSettingsToMemory(
size_t* out_ini_size = NULL);
858 static void DebugTextEncoding(
const char* text);
859 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);
865 static void SetAllocatorFunctions(KarmaGuiMemAllocFunc alloc_func, KarmaGuiMemFreeFunc free_func,
void* user_data = NULL);
866 static void GetAllocatorFunctions(KarmaGuiMemAllocFunc* p_alloc_func, KarmaGuiMemFreeFunc* p_free_func,
void** p_user_data);
867 static void* MemAlloc(
size_t size);
868 static void MemFree(
void* ptr);
874 static void UpdatePlatformWindows();
875 static void RenderPlatformWindowsDefault(
void* platform_render_arg = NULL,
void* renderer_render_arg = NULL);
876 static void DestroyPlatformWindows();
878 static KarmaGuiViewport* FindViewportByPlatformHandle(
void* platform_handle);
879 static KarmaGuiKey GetKeyIndex(KarmaGuiKey key);
882 static const char*
const GKeyNames[];
893enum KGGuiWindowFlags_
895 KGGuiWindowFlags_None = 0,
896 KGGuiWindowFlags_NoTitleBar = 1 << 0,
897 KGGuiWindowFlags_NoResize = 1 << 1,
898 KGGuiWindowFlags_NoMove = 1 << 2,
899 KGGuiWindowFlags_NoScrollbar = 1 << 3,
900 KGGuiWindowFlags_NoScrollWithMouse = 1 << 4,
901 KGGuiWindowFlags_NoCollapse = 1 << 5,
902 KGGuiWindowFlags_AlwaysAutoResize = 1 << 6,
903 KGGuiWindowFlags_NoBackground = 1 << 7,
904 KGGuiWindowFlags_NoSavedSettings = 1 << 8,
905 KGGuiWindowFlags_NoMouseInputs = 1 << 9,
906 KGGuiWindowFlags_MenuBar = 1 << 10,
907 KGGuiWindowFlags_HorizontalScrollbar = 1 << 11,
908 KGGuiWindowFlags_NoFocusOnAppearing = 1 << 12,
909 KGGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13,
910 KGGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14,
911 KGGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15,
912 KGGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16,
913 KGGuiWindowFlags_NoNavInputs = 1 << 18,
914 KGGuiWindowFlags_NoNavFocus = 1 << 19,
915 KGGuiWindowFlags_UnsavedDocument = 1 << 20,
916 KGGuiWindowFlags_NoDocking = 1 << 21,
918 KGGuiWindowFlags_NoNav = KGGuiWindowFlags_NoNavInputs | KGGuiWindowFlags_NoNavFocus,
919 KGGuiWindowFlags_NoDecoration = KGGuiWindowFlags_NoTitleBar | KGGuiWindowFlags_NoResize | KGGuiWindowFlags_NoScrollbar | KGGuiWindowFlags_NoCollapse,
920 KGGuiWindowFlags_NoInputs = KGGuiWindowFlags_NoMouseInputs | KGGuiWindowFlags_NoNavInputs | KGGuiWindowFlags_NoNavFocus,
923 KGGuiWindowFlags_NavFlattened = 1 << 23,
924 KGGuiWindowFlags_ChildWindow = 1 << 24,
925 KGGuiWindowFlags_Tooltip = 1 << 25,
926 KGGuiWindowFlags_Popup = 1 << 26,
927 KGGuiWindowFlags_Modal = 1 << 27,
928 KGGuiWindowFlags_ChildMenu = 1 << 28,
929 KGGuiWindowFlags_DockNodeHost = 1 << 29,
934enum KGGuiInputTextFlags_
936 KGGuiInputTextFlags_None = 0,
937 KGGuiInputTextFlags_CharsDecimal = 1 << 0,
938 KGGuiInputTextFlags_CharsHexadecimal = 1 << 1,
939 KGGuiInputTextFlags_CharsUppercase = 1 << 2,
940 KGGuiInputTextFlags_CharsNoBlank = 1 << 3,
941 KGGuiInputTextFlags_AutoSelectAll = 1 << 4,
942 KGGuiInputTextFlags_EnterReturnsTrue = 1 << 5,
943 KGGuiInputTextFlags_CallbackCompletion = 1 << 6,
944 KGGuiInputTextFlags_CallbackHistory = 1 << 7,
945 KGGuiInputTextFlags_CallbackAlways = 1 << 8,
946 KGGuiInputTextFlags_CallbackCharFilter = 1 << 9,
947 KGGuiInputTextFlags_AllowTabInput = 1 << 10,
948 KGGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11,
949 KGGuiInputTextFlags_NoHorizontalScroll = 1 << 12,
950 KGGuiInputTextFlags_AlwaysOverwrite = 1 << 13,
951 KGGuiInputTextFlags_ReadOnly = 1 << 14,
952 KGGuiInputTextFlags_Password = 1 << 15,
953 KGGuiInputTextFlags_NoUndoRedo = 1 << 16,
954 KGGuiInputTextFlags_CharsScientific = 1 << 17,
955 KGGuiInputTextFlags_CallbackResize = 1 << 18,
956 KGGuiInputTextFlags_CallbackEdit = 1 << 19,
957 KGGuiInputTextFlags_EscapeClearsAll = 1 << 20,
960#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
961 KGGuiInputTextFlags_AlwaysInsertMode = KGGuiInputTextFlags_AlwaysOverwrite
966enum KGGuiTreeNodeFlags_
968 KGGuiTreeNodeFlags_None = 0,
969 KGGuiTreeNodeFlags_Selected = 1 << 0,
970 KGGuiTreeNodeFlags_Framed = 1 << 1,
971 KGGuiTreeNodeFlags_AllowItemOverlap = 1 << 2,
972 KGGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3,
973 KGGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4,
974 KGGuiTreeNodeFlags_DefaultOpen = 1 << 5,
975 KGGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6,
976 KGGuiTreeNodeFlags_OpenOnArrow = 1 << 7,
977 KGGuiTreeNodeFlags_Leaf = 1 << 8,
978 KGGuiTreeNodeFlags_Bullet = 1 << 9,
979 KGGuiTreeNodeFlags_FramePadding = 1 << 10,
980 KGGuiTreeNodeFlags_SpanAvailWidth = 1 << 11,
981 KGGuiTreeNodeFlags_SpanFullWidth = 1 << 12,
982 KGGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13,
984 KGGuiTreeNodeFlags_CollapsingHeader = KGGuiTreeNodeFlags_Framed | KGGuiTreeNodeFlags_NoTreePushOnOpen | KGGuiTreeNodeFlags_NoAutoOpenOnLog,
997 KGGuiPopupFlags_None = 0,
998 KGGuiPopupFlags_MouseButtonLeft = 0,
999 KGGuiPopupFlags_MouseButtonRight = 1,
1000 KGGuiPopupFlags_MouseButtonMiddle = 2,
1001 KGGuiPopupFlags_MouseButtonMask_ = 0x1F,
1002 KGGuiPopupFlags_MouseButtonDefault_ = 1,
1003 KGGuiPopupFlags_NoOpenOverExistingPopup = 1 << 5,
1004 KGGuiPopupFlags_NoOpenOverItems = 1 << 6,
1005 KGGuiPopupFlags_AnyPopupId = 1 << 7,
1006 KGGuiPopupFlags_AnyPopupLevel = 1 << 8,
1007 KGGuiPopupFlags_AnyPopup = KGGuiPopupFlags_AnyPopupId | KGGuiPopupFlags_AnyPopupLevel,
1011enum KGGuiSelectableFlags_
1013 KGGuiSelectableFlags_None = 0,
1014 KGGuiSelectableFlags_DontClosePopups = 1 << 0,
1015 KGGuiSelectableFlags_SpanAllColumns = 1 << 1,
1016 KGGuiSelectableFlags_AllowDoubleClick = 1 << 2,
1017 KGGuiSelectableFlags_Disabled = 1 << 3,
1018 KGGuiSelectableFlags_AllowItemOverlap = 1 << 4,
1022enum KGGuiComboFlags_
1024 KGGuiComboFlags_None = 0,
1025 KGGuiComboFlags_PopupAlignLeft = 1 << 0,
1026 KGGuiComboFlags_HeightSmall = 1 << 1,
1027 KGGuiComboFlags_HeightRegular = 1 << 2,
1028 KGGuiComboFlags_HeightLarge = 1 << 3,
1029 KGGuiComboFlags_HeightLargest = 1 << 4,
1030 KGGuiComboFlags_NoArrowButton = 1 << 5,
1031 KGGuiComboFlags_NoPreview = 1 << 6,
1032 KGGuiComboFlags_HeightMask_ = KGGuiComboFlags_HeightSmall | KGGuiComboFlags_HeightRegular | KGGuiComboFlags_HeightLarge | KGGuiComboFlags_HeightLargest,
1036enum KGGuiTabBarFlags_
1038 KGGuiTabBarFlags_None = 0,
1039 KGGuiTabBarFlags_Reorderable = 1 << 0,
1040 KGGuiTabBarFlags_AutoSelectNewTabs = 1 << 1,
1041 KGGuiTabBarFlags_TabListPopupButton = 1 << 2,
1042 KGGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3,
1043 KGGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4,
1044 KGGuiTabBarFlags_NoTooltip = 1 << 5,
1045 KGGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6,
1046 KGGuiTabBarFlags_FittingPolicyScroll = 1 << 7,
1047 KGGuiTabBarFlags_FittingPolicyMask_ = KGGuiTabBarFlags_FittingPolicyResizeDown | KGGuiTabBarFlags_FittingPolicyScroll,
1048 KGGuiTabBarFlags_FittingPolicyDefault_ = KGGuiTabBarFlags_FittingPolicyResizeDown,
1052enum KGGuiTabItemFlags_
1054 KGGuiTabItemFlags_None = 0,
1055 KGGuiTabItemFlags_UnsavedDocument = 1 << 0,
1056 KGGuiTabItemFlags_SetSelected = 1 << 1,
1057 KGGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2,
1058 KGGuiTabItemFlags_NoPushId = 1 << 3,
1059 KGGuiTabItemFlags_NoTooltip = 1 << 4,
1060 KGGuiTabItemFlags_NoReorder = 1 << 5,
1061 KGGuiTabItemFlags_Leading = 1 << 6,
1062 KGGuiTabItemFlags_Trailing = 1 << 7,
1087enum KGGuiTableFlags_
1090 KGGuiTableFlags_None = 0,
1091 KGGuiTableFlags_Resizable = 1 << 0,
1092 KGGuiTableFlags_Reorderable = 1 << 1,
1093 KGGuiTableFlags_Hideable = 1 << 2,
1094 KGGuiTableFlags_Sortable = 1 << 3,
1095 KGGuiTableFlags_NoSavedSettings = 1 << 4,
1096 KGGuiTableFlags_ContextMenuInBody = 1 << 5,
1098 KGGuiTableFlags_RowBg = 1 << 6,
1099 KGGuiTableFlags_BordersInnerH = 1 << 7,
1100 KGGuiTableFlags_BordersOuterH = 1 << 8,
1101 KGGuiTableFlags_BordersInnerV = 1 << 9,
1102 KGGuiTableFlags_BordersOuterV = 1 << 10,
1103 KGGuiTableFlags_BordersH = KGGuiTableFlags_BordersInnerH | KGGuiTableFlags_BordersOuterH,
1104 KGGuiTableFlags_BordersV = KGGuiTableFlags_BordersInnerV | KGGuiTableFlags_BordersOuterV,
1105 KGGuiTableFlags_BordersInner = KGGuiTableFlags_BordersInnerV | KGGuiTableFlags_BordersInnerH,
1106 KGGuiTableFlags_BordersOuter = KGGuiTableFlags_BordersOuterV | KGGuiTableFlags_BordersOuterH,
1107 KGGuiTableFlags_Borders = KGGuiTableFlags_BordersInner | KGGuiTableFlags_BordersOuter,
1108 KGGuiTableFlags_NoBordersInBody = 1 << 11,
1109 KGGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12,
1111 KGGuiTableFlags_SizingFixedFit = 1 << 13,
1112 KGGuiTableFlags_SizingFixedSame = 2 << 13,
1113 KGGuiTableFlags_SizingStretchProp = 3 << 13,
1114 KGGuiTableFlags_SizingStretchSame = 4 << 13,
1116 KGGuiTableFlags_NoHostExtendX = 1 << 16,
1117 KGGuiTableFlags_NoHostExtendY = 1 << 17,
1118 KGGuiTableFlags_NoKeepColumnsVisible = 1 << 18,
1119 KGGuiTableFlags_PreciseWidths = 1 << 19,
1121 KGGuiTableFlags_NoClip = 1 << 20,
1123 KGGuiTableFlags_PadOuterX = 1 << 21,
1124 KGGuiTableFlags_NoPadOuterX = 1 << 22,
1125 KGGuiTableFlags_NoPadInnerX = 1 << 23,
1127 KGGuiTableFlags_ScrollX = 1 << 24,
1128 KGGuiTableFlags_ScrollY = 1 << 25,
1130 KGGuiTableFlags_SortMulti = 1 << 26,
1131 KGGuiTableFlags_SortTristate = 1 << 27,
1134 KGGuiTableFlags_SizingMask_ = KGGuiTableFlags_SizingFixedFit | KGGuiTableFlags_SizingFixedSame | KGGuiTableFlags_SizingStretchProp | KGGuiTableFlags_SizingStretchSame,
1138enum KGGuiTableColumnFlags_
1141 KGGuiTableColumnFlags_None = 0,
1142 KGGuiTableColumnFlags_Disabled = 1 << 0,
1143 KGGuiTableColumnFlags_DefaultHide = 1 << 1,
1144 KGGuiTableColumnFlags_DefaultSort = 1 << 2,
1145 KGGuiTableColumnFlags_WidthStretch = 1 << 3,
1146 KGGuiTableColumnFlags_WidthFixed = 1 << 4,
1147 KGGuiTableColumnFlags_NoResize = 1 << 5,
1148 KGGuiTableColumnFlags_NoReorder = 1 << 6,
1149 KGGuiTableColumnFlags_NoHide = 1 << 7,
1150 KGGuiTableColumnFlags_NoClip = 1 << 8,
1151 KGGuiTableColumnFlags_NoSort = 1 << 9,
1152 KGGuiTableColumnFlags_NoSortAscending = 1 << 10,
1153 KGGuiTableColumnFlags_NoSortDescending = 1 << 11,
1154 KGGuiTableColumnFlags_NoHeaderLabel = 1 << 12,
1155 KGGuiTableColumnFlags_NoHeaderWidth = 1 << 13,
1156 KGGuiTableColumnFlags_PreferSortAscending = 1 << 14,
1157 KGGuiTableColumnFlags_PreferSortDescending = 1 << 15,
1158 KGGuiTableColumnFlags_IndentEnable = 1 << 16,
1159 KGGuiTableColumnFlags_IndentDisable = 1 << 17,
1162 KGGuiTableColumnFlags_IsEnabled = 1 << 24,
1163 KGGuiTableColumnFlags_IsVisible = 1 << 25,
1164 KGGuiTableColumnFlags_IsSorted = 1 << 26,
1165 KGGuiTableColumnFlags_IsHovered = 1 << 27,
1168 KGGuiTableColumnFlags_WidthMask_ = KGGuiTableColumnFlags_WidthStretch | KGGuiTableColumnFlags_WidthFixed,
1169 KGGuiTableColumnFlags_IndentMask_ = KGGuiTableColumnFlags_IndentEnable | KGGuiTableColumnFlags_IndentDisable,
1170 KGGuiTableColumnFlags_StatusMask_ = KGGuiTableColumnFlags_IsEnabled | KGGuiTableColumnFlags_IsVisible | KGGuiTableColumnFlags_IsSorted | KGGuiTableColumnFlags_IsHovered,
1171 KGGuiTableColumnFlags_NoDirectResize_ = 1 << 30,
1175enum KGGuiTableRowFlags_
1177 KGGuiTableRowFlags_None = 0,
1178 KGGuiTableRowFlags_Headers = 1 << 0,
1190enum KGGuiTableBgTarget_
1192 KGGuiTableBgTarget_None = 0,
1193 KGGuiTableBgTarget_RowBg0 = 1,
1194 KGGuiTableBgTarget_RowBg1 = 2,
1195 KGGuiTableBgTarget_CellBg = 3,
1199enum KGGuiFocusedFlags_
1201 KGGuiFocusedFlags_None = 0,
1202 KGGuiFocusedFlags_ChildWindows = 1 << 0,
1203 KGGuiFocusedFlags_RootWindow = 1 << 1,
1204 KGGuiFocusedFlags_AnyWindow = 1 << 2,
1205 KGGuiFocusedFlags_NoPopupHierarchy = 1 << 3,
1206 KGGuiFocusedFlags_DockHierarchy = 1 << 4,
1207 KGGuiFocusedFlags_RootAndChildWindows = KGGuiFocusedFlags_RootWindow | KGGuiFocusedFlags_ChildWindows,
1213enum KGGuiHoveredFlags_
1215 KGGuiHoveredFlags_None = 0,
1216 KGGuiHoveredFlags_ChildWindows = 1 << 0,
1217 KGGuiHoveredFlags_RootWindow = 1 << 1,
1218 KGGuiHoveredFlags_AnyWindow = 1 << 2,
1219 KGGuiHoveredFlags_NoPopupHierarchy = 1 << 3,
1220 KGGuiHoveredFlags_DockHierarchy = 1 << 4,
1221 KGGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5,
1223 KGGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7,
1224 KGGuiHoveredFlags_AllowWhenOverlapped = 1 << 8,
1225 KGGuiHoveredFlags_AllowWhenDisabled = 1 << 9,
1226 KGGuiHoveredFlags_NoNavOverride = 1 << 10,
1227 KGGuiHoveredFlags_RectOnly = KGGuiHoveredFlags_AllowWhenBlockedByPopup | KGGuiHoveredFlags_AllowWhenBlockedByActiveItem | KGGuiHoveredFlags_AllowWhenOverlapped,
1228 KGGuiHoveredFlags_RootAndChildWindows = KGGuiHoveredFlags_RootWindow | KGGuiHoveredFlags_ChildWindows,
1231 KGGuiHoveredFlags_DelayNormal = 1 << 11,
1232 KGGuiHoveredFlags_DelayShort = 1 << 12,
1233 KGGuiHoveredFlags_NoSharedDelay = 1 << 13,
1239enum KGGuiDockNodeFlags_
1241 KGGuiDockNodeFlags_None = 0,
1242 KGGuiDockNodeFlags_KeepAliveOnly = 1 << 0,
1244 KGGuiDockNodeFlags_NoDockingInCentralNode = 1 << 2,
1245 KGGuiDockNodeFlags_PassthruCentralNode = 1 << 3,
1246 KGGuiDockNodeFlags_NoSplit = 1 << 4,
1247 KGGuiDockNodeFlags_NoResize = 1 << 5,
1248 KGGuiDockNodeFlags_AutoHideTabBar = 1 << 6,
1252enum KGGuiDragDropFlags_
1254 KGGuiDragDropFlags_None = 0,
1256 KGGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0,
1257 KGGuiDragDropFlags_SourceNoDisableHover = 1 << 1,
1258 KGGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2,
1259 KGGuiDragDropFlags_SourceAllowNullID = 1 << 3,
1260 KGGuiDragDropFlags_SourceExtern = 1 << 4,
1261 KGGuiDragDropFlags_SourceAutoExpirePayload = 1 << 5,
1263 KGGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10,
1264 KGGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11,
1265 KGGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12,
1266 KGGuiDragDropFlags_AcceptPeekOnly = KGGuiDragDropFlags_AcceptBeforeDelivery | KGGuiDragDropFlags_AcceptNoDrawDefaultRect,
1270#define KARMAGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F"
1271#define KARMAGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F"
1284 KGGuiDataType_Float,
1285 KGGuiDataType_Double,
1301enum KGGuiSortDirection_
1303 KGGuiSortDirection_None = 0,
1304 KGGuiSortDirection_Ascending = 1,
1305 KGGuiSortDirection_Descending = 2
1312enum KarmaGuiKey :
int
1318 KGGuiKey_RightArrow,
1331 KGGuiKey_LeftCtrl, KGGuiKey_LeftShift, KGGuiKey_LeftAlt, KGGuiKey_LeftSuper,
1332 KGGuiKey_RightCtrl, KGGuiKey_RightShift, KGGuiKey_RightAlt, KGGuiKey_RightSuper,
1334 KGGuiKey_0, KGGuiKey_1, KGGuiKey_2, KGGuiKey_3, KGGuiKey_4, KGGuiKey_5, KGGuiKey_6, KGGuiKey_7, KGGuiKey_8, KGGuiKey_9,
1335 KGGuiKey_A, KGGuiKey_B, KGGuiKey_C, KGGuiKey_D, KGGuiKey_E, KGGuiKey_F, KGGuiKey_G, KGGuiKey_H, KGGuiKey_I, KGGuiKey_J,
1336 KGGuiKey_K, KGGuiKey_L, KGGuiKey_M, KGGuiKey_N, KGGuiKey_O, KGGuiKey_P, KGGuiKey_Q, KGGuiKey_R, KGGuiKey_S, KGGuiKey_T,
1337 KGGuiKey_U, KGGuiKey_V, KGGuiKey_W, KGGuiKey_X, KGGuiKey_Y, KGGuiKey_Z,
1338 KGGuiKey_F1, KGGuiKey_F2, KGGuiKey_F3, KGGuiKey_F4, KGGuiKey_F5, KGGuiKey_F6,
1339 KGGuiKey_F7, KGGuiKey_F8, KGGuiKey_F9, KGGuiKey_F10, KGGuiKey_F11, KGGuiKey_F12,
1340 KGGuiKey_Apostrophe,
1347 KGGuiKey_LeftBracket,
1349 KGGuiKey_RightBracket,
1350 KGGuiKey_GraveAccent,
1352 KGGuiKey_ScrollLock,
1354 KGGuiKey_PrintScreen,
1356 KGGuiKey_Keypad0, KGGuiKey_Keypad1, KGGuiKey_Keypad2, KGGuiKey_Keypad3, KGGuiKey_Keypad4,
1357 KGGuiKey_Keypad5, KGGuiKey_Keypad6, KGGuiKey_Keypad7, KGGuiKey_Keypad8, KGGuiKey_Keypad9,
1358 KGGuiKey_KeypadDecimal,
1359 KGGuiKey_KeypadDivide,
1360 KGGuiKey_KeypadMultiply,
1361 KGGuiKey_KeypadSubtract,
1363 KGGuiKey_KeypadEnter,
1364 KGGuiKey_KeypadEqual,
1368 KGGuiKey_GamepadStart,
1369 KGGuiKey_GamepadBack,
1370 KGGuiKey_GamepadFaceLeft,
1371 KGGuiKey_GamepadFaceRight,
1372 KGGuiKey_GamepadFaceUp,
1373 KGGuiKey_GamepadFaceDown,
1374 KGGuiKey_GamepadDpadLeft,
1375 KGGuiKey_GamepadDpadRight,
1376 KGGuiKey_GamepadDpadUp,
1377 KGGuiKey_GamepadDpadDown,
1384 KGGuiKey_GamepadLStickLeft,
1385 KGGuiKey_GamepadLStickRight,
1386 KGGuiKey_GamepadLStickUp,
1387 KGGuiKey_GamepadLStickDown,
1388 KGGuiKey_GamepadRStickLeft,
1389 KGGuiKey_GamepadRStickRight,
1390 KGGuiKey_GamepadRStickUp,
1391 KGGuiKey_GamepadRStickDown,
1395 KGGuiKey_MouseLeft, KGGuiKey_MouseRight, KGGuiKey_MouseMiddle, KGGuiKey_MouseX1, KGGuiKey_MouseX2, KGGuiKey_MouseWheelX, KGGuiKey_MouseWheelY,
1398 KGGuiKey_ReservedForModCtrl, KGGuiKey_ReservedForModShift, KGGuiKey_ReservedForModAlt, KGGuiKey_ReservedForModSuper,
1410 KGGuiMod_Ctrl = 1 << 12,
1411 KGGuiMod_Shift = 1 << 13,
1412 KGGuiMod_Alt = 1 << 14,
1413 KGGuiMod_Super = 1 << 15,
1414 KGGuiMod_Shortcut = 1 << 11,
1415 KGGuiMod_Mask_ = 0xF800,
1419 KGGuiKey_NamedKey_BEGIN = 512,
1420 KGGuiKey_NamedKey_END = KGGuiKey_COUNT,
1421 KGGuiKey_NamedKey_COUNT = KGGuiKey_NamedKey_END - KGGuiKey_NamedKey_BEGIN,
1422#ifdef KARMAGUI_DISABLE_OBSOLETE_KEYIO
1423 KGGuiKey_KeysData_SIZE = KGGuiKey_NamedKey_COUNT,
1424 KGGuiKey_KeysData_OFFSET = KGGuiKey_NamedKey_BEGIN,
1426 KGGuiKey_KeysData_SIZE = KGGuiKey_COUNT,
1427 KGGuiKey_KeysData_OFFSET = 0,
1430#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1431 KGGuiKey_ModCtrl = KGGuiMod_Ctrl, KGGuiKey_ModShift = KGGuiMod_Shift, KGGuiKey_ModAlt = KGGuiMod_Alt, KGGuiKey_ModSuper = KGGuiMod_Super,
1432 KGGuiKey_KeyPadEnter = KGGuiKey_KeypadEnter,
1438enum KGGuiInputFlags_
1440 KGGuiInputFlags_None = 0,
1441 KGGuiInputFlags_Repeat = 1 << 0,
1454 KGGuiInputFlags_RouteFocused = 1 << 8,
1455 KGGuiInputFlags_RouteGlobalLow = 1 << 9,
1456 KGGuiInputFlags_RouteGlobal = 1 << 10,
1457 KGGuiInputFlags_RouteGlobalHigh = 1 << 11,
1458 KGGuiInputFlags_RouteAlways = 1 << 12,
1461 KGGuiInputFlags_RouteUnlessBgFocused= 1 << 13,
1464#ifndef KARMAGUI_DISABLE_OBSOLETE_KEYIO
1470 KGGuiNavInput_Activate, KGGuiNavInput_Cancel, KGGuiNavInput_Input, KGGuiNavInput_Menu, KGGuiNavInput_DpadLeft, KGGuiNavInput_DpadRight, KGGuiNavInput_DpadUp, KGGuiNavInput_DpadDown,
1471 KGGuiNavInput_LStickLeft, KGGuiNavInput_LStickRight, KGGuiNavInput_LStickUp, KGGuiNavInput_LStickDown, KGGuiNavInput_FocusPrev, KGGuiNavInput_FocusNext, KGGuiNavInput_TweakSlow, KGGuiNavInput_TweakFast,
1472 KGGuiNavInput_COUNT,
1477enum KGGuiConfigFlags_
1479 KGGuiConfigFlags_None = 0,
1480 KGGuiConfigFlags_NavEnableKeyboard = 1 << 0,
1481 KGGuiConfigFlags_NavEnableGamepad = 1 << 1,
1482 KGGuiConfigFlags_NavEnableSetMousePos = 1 << 2,
1483 KGGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3,
1484 KGGuiConfigFlags_NoMouse = 1 << 4,
1485 KGGuiConfigFlags_NoMouseCursorChange = 1 << 5,
1488 KGGuiConfigFlags_DockingEnable = 1 << 6,
1492 KGGuiConfigFlags_ViewportsEnable = 1 << 10,
1493 KGGuiConfigFlags_DpiEnableScaleViewports= 1 << 14,
1494 KGGuiConfigFlags_DpiEnableScaleFonts = 1 << 15,
1497 KGGuiConfigFlags_IsSRGB = 1 << 20,
1498 KGGuiConfigFlags_IsTouchScreen = 1 << 21,
1502enum KGGuiBackendFlags_
1504 KGGuiBackendFlags_None = 0,
1505 KGGuiBackendFlags_HasGamepad = 1 << 0,
1506 KGGuiBackendFlags_HasMouseCursors = 1 << 1,
1507 KGGuiBackendFlags_HasSetMousePos = 1 << 2,
1508 KGGuiBackendFlags_RendererHasVtxOffset = 1 << 3,
1511 KGGuiBackendFlags_PlatformHasViewports = 1 << 10,
1512 KGGuiBackendFlags_HasMouseHoveredViewport=1 << 11,
1513 KGGuiBackendFlags_RendererHasViewports = 1 << 12,
1520 KGGuiCol_TextDisabled,
1525 KGGuiCol_BorderShadow,
1527 KGGuiCol_FrameBgHovered,
1528 KGGuiCol_FrameBgActive,
1530 KGGuiCol_TitleBgActive,
1531 KGGuiCol_TitleBgCollapsed,
1533 KGGuiCol_ScrollbarBg,
1534 KGGuiCol_ScrollbarGrab,
1535 KGGuiCol_ScrollbarGrabHovered,
1536 KGGuiCol_ScrollbarGrabActive,
1538 KGGuiCol_SliderGrab,
1539 KGGuiCol_SliderGrabActive,
1541 KGGuiCol_ButtonHovered,
1542 KGGuiCol_ButtonActive,
1544 KGGuiCol_HeaderHovered,
1545 KGGuiCol_HeaderActive,
1547 KGGuiCol_SeparatorHovered,
1548 KGGuiCol_SeparatorActive,
1549 KGGuiCol_ResizeGrip,
1550 KGGuiCol_ResizeGripHovered,
1551 KGGuiCol_ResizeGripActive,
1553 KGGuiCol_TabHovered,
1555 KGGuiCol_TabUnfocused,
1556 KGGuiCol_TabUnfocusedActive,
1557 KGGuiCol_DockingPreview,
1558 KGGuiCol_DockingEmptyBg,
1560 KGGuiCol_PlotLinesHovered,
1561 KGGuiCol_PlotHistogram,
1562 KGGuiCol_PlotHistogramHovered,
1563 KGGuiCol_TableHeaderBg,
1564 KGGuiCol_TableBorderStrong,
1565 KGGuiCol_TableBorderLight,
1566 KGGuiCol_TableRowBg,
1567 KGGuiCol_TableRowBgAlt,
1568 KGGuiCol_TextSelectedBg,
1569 KGGuiCol_DragDropTarget,
1570 KGGuiCol_NavHighlight,
1571 KGGuiCol_NavWindowingHighlight,
1572 KGGuiCol_NavWindowingDimBg,
1573 KGGuiCol_ModalWindowDimBg,
1587 KGGuiStyleVar_Alpha,
1588 KGGuiStyleVar_DisabledAlpha,
1589 KGGuiStyleVar_WindowPadding,
1590 KGGuiStyleVar_WindowRounding,
1591 KGGuiStyleVar_WindowBorderSize,
1592 KGGuiStyleVar_WindowMinSize,
1593 KGGuiStyleVar_WindowTitleAlign,
1594 KGGuiStyleVar_ChildRounding,
1595 KGGuiStyleVar_ChildBorderSize,
1596 KGGuiStyleVar_PopupRounding,
1597 KGGuiStyleVar_PopupBorderSize,
1598 KGGuiStyleVar_FramePadding,
1599 KGGuiStyleVar_FrameRounding,
1600 KGGuiStyleVar_FrameBorderSize,
1601 KGGuiStyleVar_ItemSpacing,
1602 KGGuiStyleVar_ItemInnerSpacing,
1603 KGGuiStyleVar_IndentSpacing,
1604 KGGuiStyleVar_CellPadding,
1605 KGGuiStyleVar_ScrollbarSize,
1606 KGGuiStyleVar_ScrollbarRounding,
1607 KGGuiStyleVar_GrabMinSize,
1608 KGGuiStyleVar_GrabRounding,
1609 KGGuiStyleVar_TabRounding,
1610 KGGuiStyleVar_ButtonTextAlign,
1611 KGGuiStyleVar_SelectableTextAlign,
1616enum KGGuiButtonFlags_
1618 KGGuiButtonFlags_None = 0,
1619 KGGuiButtonFlags_MouseButtonLeft = 1 << 0,
1620 KGGuiButtonFlags_MouseButtonRight = 1 << 1,
1621 KGGuiButtonFlags_MouseButtonMiddle = 1 << 2,
1624 KGGuiButtonFlags_MouseButtonMask_ = KGGuiButtonFlags_MouseButtonLeft | KGGuiButtonFlags_MouseButtonRight | KGGuiButtonFlags_MouseButtonMiddle,
1625 KGGuiButtonFlags_MouseButtonDefault_ = KGGuiButtonFlags_MouseButtonLeft,
1629enum KGGuiColorEditFlags_
1631 KGGuiColorEditFlags_None = 0,
1632 KGGuiColorEditFlags_NoAlpha = 1 << 1,
1633 KGGuiColorEditFlags_NoPicker = 1 << 2,
1634 KGGuiColorEditFlags_NoOptions = 1 << 3,
1635 KGGuiColorEditFlags_NoSmallPreview = 1 << 4,
1636 KGGuiColorEditFlags_NoInputs = 1 << 5,
1637 KGGuiColorEditFlags_NoTooltip = 1 << 6,
1638 KGGuiColorEditFlags_NoLabel = 1 << 7,
1639 KGGuiColorEditFlags_NoSidePreview = 1 << 8,
1640 KGGuiColorEditFlags_NoDragDrop = 1 << 9,
1641 KGGuiColorEditFlags_NoBorder = 1 << 10,
1644 KGGuiColorEditFlags_AlphaBar = 1 << 16,
1645 KGGuiColorEditFlags_AlphaPreview = 1 << 17,
1646 KGGuiColorEditFlags_AlphaPreviewHalf= 1 << 18,
1647 KGGuiColorEditFlags_HDR = 1 << 19,
1648 KGGuiColorEditFlags_DisplayRGB = 1 << 20,
1649 KGGuiColorEditFlags_DisplayHSV = 1 << 21,
1650 KGGuiColorEditFlags_DisplayHex = 1 << 22,
1651 KGGuiColorEditFlags_Uint8 = 1 << 23,
1652 KGGuiColorEditFlags_Float = 1 << 24,
1653 KGGuiColorEditFlags_PickerHueBar = 1 << 25,
1654 KGGuiColorEditFlags_PickerHueWheel = 1 << 26,
1655 KGGuiColorEditFlags_InputRGB = 1 << 27,
1656 KGGuiColorEditFlags_InputHSV = 1 << 28,
1660 KGGuiColorEditFlags_DefaultOptions_ = KGGuiColorEditFlags_Uint8 | KGGuiColorEditFlags_DisplayRGB | KGGuiColorEditFlags_InputRGB | KGGuiColorEditFlags_PickerHueBar,
1663 KGGuiColorEditFlags_DisplayMask_ = KGGuiColorEditFlags_DisplayRGB | KGGuiColorEditFlags_DisplayHSV | KGGuiColorEditFlags_DisplayHex,
1664 KGGuiColorEditFlags_DataTypeMask_ = KGGuiColorEditFlags_Uint8 | KGGuiColorEditFlags_Float,
1665 KGGuiColorEditFlags_PickerMask_ = KGGuiColorEditFlags_PickerHueWheel | KGGuiColorEditFlags_PickerHueBar,
1666 KGGuiColorEditFlags_InputMask_ = KGGuiColorEditFlags_InputRGB | KGGuiColorEditFlags_InputHSV,
1675enum KGGuiSliderFlags_
1677 KGGuiSliderFlags_None = 0,
1678 KGGuiSliderFlags_AlwaysClamp = 1 << 4,
1679 KGGuiSliderFlags_Logarithmic = 1 << 5,
1680 KGGuiSliderFlags_NoRoundToFormat = 1 << 6,
1681 KGGuiSliderFlags_NoInput = 1 << 7,
1682 KGGuiSliderFlags_InvalidMask_ = 0x7000000F,
1685#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1686 KGGuiSliderFlags_ClampOnInput = KGGuiSliderFlags_AlwaysClamp,
1692enum KGGuiMouseButton_
1694 KGGuiMouseButton_Left = 0,
1695 KGGuiMouseButton_Right = 1,
1696 KGGuiMouseButton_Middle = 2,
1697 KGGuiMouseButton_COUNT = 5
1702enum KGGuiMouseCursor_
1704 KGGuiMouseCursor_None = -1,
1705 KGGuiMouseCursor_Arrow = 0,
1706 KGGuiMouseCursor_TextInput,
1707 KGGuiMouseCursor_ResizeAll,
1708 KGGuiMouseCursor_ResizeNS,
1709 KGGuiMouseCursor_ResizeEW,
1710 KGGuiMouseCursor_ResizeNESW,
1711 KGGuiMouseCursor_ResizeNWSE,
1712 KGGuiMouseCursor_Hand,
1713 KGGuiMouseCursor_NotAllowed,
1714 KGGuiMouseCursor_COUNT
1723 KGGuiCond_Always = 1 << 0,
1724 KGGuiCond_Once = 1 << 1,
1725 KGGuiCond_FirstUseEver = 1 << 2,
1726 KGGuiCond_Appearing = 1 << 3,
1740inline void*
operator new(size_t,
KGNewWrapper,
void* ptr) {
return ptr; }
1741inline void operator delete(
void*,
KGNewWrapper,
void*) {}
1742#define KG_ALLOC(_SIZE) Karma::KarmaGui::MemAlloc(_SIZE)
1743#define KG_FREE(_PTR) Karma::KarmaGui::MemFree(_PTR)
1744#define KG_PLACEMENT_NEW(_PTR) new(KGNewWrapper(), _PTR)
1745#define KG_NEW(_TYPE) new(KGNewWrapper(), Karma::KarmaGui::MemAlloc(sizeof(_TYPE))) _TYPE
1746template<
typename T>
void KG_DELETE(T* p) {
if (p) { p->~T(); Karma::KarmaGui::MemFree(p); } }
1767 typedef T value_type;
1768 typedef value_type* iterator;
1769 typedef const value_type* const_iterator;
1772 inline KGVector() { Size = Capacity = 0; Data = NULL; }
1773 inline KGVector(
const KGVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
1774 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; }
1775 inline ~KGVector() {
if (Data) KG_FREE(Data); }
1777 inline void clear() {
if (Data) { Size = Capacity = 0; KG_FREE(Data); Data = NULL; } }
1778 inline void clear_delete() {
for (
int n = 0; n < Size; n++) KG_DELETE(Data[n]); clear(); }
1779 inline void clear_destruct() {
for (
int n = 0; n < Size; n++) Data[n].~T(); clear(); }
1781 inline bool empty()
const {
return Size == 0; }
1782 inline int size()
const {
return Size; }
1783 inline int size_in_bytes()
const {
return Size * (int)
sizeof(T); }
1784 inline int max_size()
const {
return 0x7FFFFFFF / (int)
sizeof(T); }
1785 inline int capacity()
const {
return Capacity; }
1786 inline T& operator[](
int i) { KR_CORE_ASSERT(i >= 0 && i < Size,
"");
return Data[i]; }
1787 inline const T& operator[](
int i)
const { KR_CORE_ASSERT(i >= 0 && i < Size,
"");
return Data[i]; }
1789 inline T* begin() {
return Data; }
1790 inline const T* begin()
const {
return Data; }
1791 inline T* end() {
return Data + Size; }
1792 inline const T* end()
const {
return Data + Size; }
1793 inline T& front() { KR_CORE_ASSERT(Size > 0,
"");
return Data[0]; }
1794 inline const T& front()
const { KR_CORE_ASSERT(Size > 0,
"");
return Data[0]; }
1795 inline T& back() { KR_CORE_ASSERT(Size > 0,
"");
return Data[Size - 1]; }
1796 inline const T& back()
const { KR_CORE_ASSERT(Size > 0,
"");
return Data[Size - 1]; }
1797 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; }
1799 inline int _grow_capacity(
int sz)
const {
int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8;
return new_capacity > sz ? new_capacity : sz; }
1800 inline void resize(
int new_size) {
if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
1801 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; }
1802 inline void shrink(
int new_size) { KR_CORE_ASSERT(new_size <= Size,
""); Size = new_size; }
1803 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; }
1804 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; }
1807 inline void push_back(
const T& v) {
if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v,
sizeof(v)); Size++; }
1808 inline void pop_back() { KR_CORE_ASSERT(Size > 0,
""); Size--; }
1809 inline void push_front(
const T& v) {
if (Size == 0) push_back(v);
else insert(Data, v); }
1810 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; }
1811 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; }
1812 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; }
1813 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; }
1814 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; }
1815 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; }
1816 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; }
1817 inline bool find_erase(
const T& v) {
const T* it = find(v);
if (it < Data + Size) { erase(it);
return true; }
return false; }
1818 inline bool find_erase_unsorted(
const T& v) {
const T* it = find(v);
if (it < Data + Size) { erase_unsorted(it);
return true; }
return false; }
1819 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; }
1833 float DisabledAlpha;
1835 float WindowRounding;
1836 float WindowBorderSize;
1839 KarmaGuiDir WindowMenuButtonPosition;
1840 float ChildRounding;
1841 float ChildBorderSize;
1842 float PopupRounding;
1843 float PopupBorderSize;
1845 float FrameRounding;
1846 float FrameBorderSize;
1850 KGVec2 TouchExtraPadding;
1851 float IndentSpacing;
1852 float ColumnsMinSpacing;
1853 float ScrollbarSize;
1854 float ScrollbarRounding;
1857 float LogSliderDeadzone;
1859 float TabBorderSize;
1860 float TabMinWidthForCloseButton;
1861 KarmaGuiDir ColorButtonPosition;
1863 KGVec2 SelectableTextAlign;
1864 KGVec2 DisplayWindowPadding;
1865 KGVec2 DisplaySafeAreaPadding;
1866 float MouseCursorScale;
1867 bool AntiAliasedLines;
1868 bool AntiAliasedLinesUseTex;
1869 bool AntiAliasedFill;
1870 float CurveTessellationTol;
1871 float CircleTessellationMaxError;
1872 KGVec4 Colors[KGGuiCol_COUNT];
1875 void ScaleAllSizes(
float scale_factor);
1891 float DownDurationPrev;
1901 KarmaGuiConfigFlags ConfigFlags;
1902 KarmaGuiBackendFlags BackendFlags;
1905 float IniSavingRate;
1906 const char* IniFilename;
1907 const char* LogFilename;
1908 float MouseDoubleClickTime;
1909 float MouseDoubleClickMaxDist;
1910 float MouseDragThreshold;
1911 float KeyRepeatDelay;
1912 float KeyRepeatRate;
1913 float HoverDelayNormal;
1914 float HoverDelayShort;
1918 float FontGlobalScale;
1919 bool FontAllowUserScaling;
1921 KGVec2 DisplayFramebufferScale;
1924 bool ConfigDockingNoSplit;
1925 bool ConfigDockingWithShift;
1926 bool ConfigDockingAlwaysTabBar;
1927 bool ConfigDockingTransparentPayload;
1930 bool ConfigViewportsNoAutoMerge;
1931 bool ConfigViewportsNoTaskBarIcon;
1932 bool ConfigViewportsNoDecoration;
1933 bool ConfigViewportsNoDefaultParent;
1936 bool MouseDrawCursor;
1937 bool ConfigMacOSXBehaviors;
1938 bool ConfigInputTrickleEventQueue;
1939 bool ConfigInputTextCursorBlink;
1940 bool ConfigInputTextEnterKeepActive;
1941 bool ConfigDragClickToInputText;
1942 bool ConfigWindowsResizeFromEdges;
1943 bool ConfigWindowsMoveFromTitleBarOnly;
1944 float ConfigMemoryCompactTimer;
1952 const char* BackendPlatformName;
1953 const char* BackendRendererName;
1954 void* BackendPlatformUserData;
1955 void* BackendRendererUserData;
1956 void* BackendLanguageUserData;
1960 const char* (*GetClipboardTextFn)(
void* user_data);
1961 void (*SetClipboardTextFn)(
void* user_data,
const char* text);
1962 void* ClipboardUserData;
1967#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1968 void* ImeWindowHandle;
1970 void* _UnusedPadding;
1978 void AddKeyEvent(KarmaGuiKey key,
bool down);
1979 void AddKeyAnalogEvent(KarmaGuiKey key,
bool down,
float v);
1980 void AddMousePosEvent(
float x,
float y);
1981 void AddMouseButtonEvent(
int button,
bool down);
1982 void AddMouseWheelEvent(
float wh_x,
float wh_y);
1983 void AddMouseViewportEvent(KGGuiID
id);
1984 void AddFocusEvent(
bool focused);
1985 void AddInputCharacter(
unsigned int c);
1986 void AddInputCharacterUTF16(KGWchar16 c);
1987 void AddInputCharactersUTF8(
const char* str);
1989 void SetKeyEventNativeData(KarmaGuiKey key,
int native_keycode,
int native_scancode,
int native_legacy_index = -1);
1990 void SetAppAcceptingEvents(
bool accepting_events);
1991 void ClearInputCharacters();
1992 void ClearInputKeys();
2000 bool WantCaptureMouse;
2001 bool WantCaptureKeyboard;
2003 bool WantSetMousePos;
2004 bool WantSaveIniSettings;
2008 int MetricsRenderVertices;
2009 int MetricsRenderIndices;
2010 int MetricsRenderWindows;
2011 int MetricsActiveWindows;
2012 int MetricsActiveAllocations;
2018#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
2019 int KeyMap[KGGuiKey_COUNT];
2020 bool KeysDown[KGGuiKey_COUNT];
2021 float NavInputs[KGGuiNavInput_COUNT];
2035 KGGuiID MouseHoveredViewport;
2042 KarmaGuiKeyChord KeyMods;
2044 bool WantCaptureMouseUnlessPopupClose;
2046 KGVec2 MouseClickedPos[5];
2047 double MouseClickedTime[5];
2048 bool MouseClicked[5];
2049 bool MouseDoubleClicked[5];
2050 KGU16 MouseClickedCount[5];
2051 KGU16 MouseClickedLastCount[5];
2052 bool MouseReleased[5];
2053 bool MouseDownOwned[5];
2054 bool MouseDownOwnedUnlessPopupClose[5];
2055 float MouseDownDuration[5];
2056 float MouseDownDurationPrev[5];
2057 KGVec2 MouseDragMaxDistanceAbs[5];
2058 float MouseDragMaxDistanceSqr[5];
2061 bool AppAcceptingEvents;
2062 KGS8 BackendUsingLegacyKeyArrays;
2063 bool BackendUsingLegacyNavInputArray;
2064 KGWchar16 InputQueueSurrogate;
2085 KarmaGuiInputTextFlags EventFlag;
2086 KarmaGuiInputTextFlags Flags;
2093 KarmaGuiKey EventKey;
2105 void DeleteChars(
int pos,
int bytes_count);
2106 void InsertChars(
int pos,
const char* text,
const char* text_end = NULL);
2107 void SelectAll() { SelectionStart = 0; SelectionEnd = BufTextLen; }
2108 void ClearSelection() { SelectionStart = SelectionEnd = BufTextLen; }
2109 bool HasSelection()
const {
return SelectionStart != SelectionEnd; }
2132 KGGuiID ParentViewportId;
2133 KarmaGuiViewportFlags ViewportFlagsOverrideSet;
2134 KarmaGuiViewportFlags ViewportFlagsOverrideClear;
2135 KarmaGuiTabItemFlags TabItemFlagsOverrideSet;
2136 KarmaGuiDockNodeFlags DockNodeFlagsOverrideSet;
2137 bool DockingAlwaysTabBar;
2138 bool DockingAllowUnclassed;
2140 KarmaGuiWindowClass() { memset(
this, 0,
sizeof(*
this)); ParentViewportId = (KGGuiID)-1; DockingAllowUnclassed =
true; }
2152 KGGuiID SourceParentId;
2154 char DataType[32 + 1];
2159 void Clear() { SourceId = SourceParentId = 0; Data = NULL; DataSize = 0; memset(DataType, 0,
sizeof(DataType)); DataFrameCount = -1; Preview = Delivery =
false; }
2160 bool IsDataType(
const char* type)
const {
return DataFrameCount != -1 && strcmp(type, DataType) == 0; }
2161 bool IsPreview()
const {
return Preview; }
2162 bool IsDelivery()
const {
return Delivery; }
2168 KGGuiID ColumnUserID;
2171 KarmaGuiSortDirection SortDirection : 8;
2194#define KG_UNICODE_CODEPOINT_INVALID 0xFFFD
2195#define KG_UNICODE_CODEPOINT_MAX 0xFFFF
2203 mutable int RefFrame;
2204 operator bool()
const {
int current_frame = Karma::KarmaGui::GetFrameCount();
if (RefFrame == current_frame)
return false; RefFrame = current_frame;
return true; }
2211 bool Draw(
const char* label =
"Filter (inc,-exc)",
float width = 0.0f);
2212 bool PassFilter(
const char* text,
const char* text_end = NULL)
const;
2214 void Clear() { InputBuf[0] = 0; Build(); }
2215 bool IsActive()
const {
return !Filters.empty(); }
2224 ImGuiTextRange(
const char* _b,
const char* _e) { b = _b; e = _e; }
2225 bool empty()
const {
return b == e; }
2238 static char EmptyString[1];
2241 inline char operator[](
int i)
const { KR_CORE_ASSERT(Buf.Data != NULL,
"");
return Buf.Data[i]; }
2242 const char* begin()
const {
return Buf.Data ? &Buf.front() : EmptyString; }
2243 const char* end()
const {
return Buf.Data ? &Buf.back() : EmptyString; }
2244 int size()
const {
return Buf.Size ? Buf.Size - 1 : 0; }
2245 bool empty()
const {
return Buf.Size <= 1; }
2246 void clear() { Buf.clear(); }
2247 void reserve(
int capacity) { Buf.reserve(capacity); }
2248 const char* c_str()
const {
return Buf.Data ? Buf.Data : EmptyString; }
2249 void append(
const char* str,
const char* str_end = NULL);
2250 void appendf(
const char* fmt, ...) KG_FMTARGS(2);
2251 void appendfv(
const char* fmt, va_list args) KG_FMTLIST(2);
2268 union {
int val_i;
float val_f;
void* val_p; };
2270 ImGuiStoragePair(KGGuiID _key,
float _val_f) { key = _key; val_f = _val_f; }
2271 ImGuiStoragePair(KGGuiID _key,
void* _val_p) { key = _key; val_p = _val_p; }
2279 void Clear() { Data.clear(); }
2280 int GetInt(KGGuiID key,
int default_val = 0)
const;
2281 void SetInt(KGGuiID key,
int val);
2282 bool GetBool(KGGuiID key,
bool default_val =
false)
const;
2283 void SetBool(KGGuiID key,
bool val);
2284 float GetFloat(KGGuiID key,
float default_val = 0.0f)
const;
2285 void SetFloat(KGGuiID key,
float val);
2286 void* GetVoidPtr(KGGuiID key)
const;
2287 void SetVoidPtr(KGGuiID key,
void* val);
2293 int* GetIntRef(KGGuiID key,
int default_val = 0);
2294 bool* GetBoolRef(KGGuiID key,
bool default_val =
false);
2295 float* GetFloatRef(KGGuiID key,
float default_val = 0.0f);
2296 void** GetVoidPtrRef(KGGuiID key,
void* default_val = NULL);
2299 void SetAllInt(
int val);
2302 void BuildSortByKey();
2338 void Begin(
int items_count,
float items_height = -1.0f);
2343 void ForceDisplayRangeByIndices(
int item_min,
int item_max);
2344 inline KarmaGuiListClipper(
int items_count,
float items_height = -1.0f) { memset(
this, 0,
sizeof(*
this)); ItemsCount = -1; Begin(items_count, items_height); }
2349#ifndef KG_COL32_R_SHIFT
2350#define KG_COL32_R_SHIFT 0
2351#define KG_COL32_G_SHIFT 8
2352#define KG_COL32_B_SHIFT 16
2353#define KG_COL32_A_SHIFT 24
2354#define KG_COL32_A_MASK 0xFF000000
2356#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))
2357#define KG_COL32_WHITE KG_COL32(255,255,255,255)
2358#define KG_COL32_BLACK KG_COL32(0,0,0,255)
2359#define KG_COL32_BLACK_TRANS KG_COL32(0,0,0,0)
2370 constexpr KGColor(
float r,
float g,
float b,
float a = 1.0f) : Value(r, g, b, a) { }
2372 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; }
2373 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; }
2374 inline operator KGU32()
const {
return Karma::KarmaGui::ColorConvertFloat4ToU32(Value); }
2375 inline operator KGVec4()
const {
return Value; }
2378 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; }
2379 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); }
2388#ifndef KG_DRAWLIST_TEX_LINES_WIDTH_MAX
2389#define KG_DRAWLIST_TEX_LINES_WIDTH_MAX (63)
2399#ifndef KGDrawCallback
2407#define KGDrawCallback_ResetRenderState (KGDrawCallback)(-1)
2417 KGTextureID TextureId;
2418 unsigned int VtxOffset;
2419 unsigned int IdxOffset;
2420 unsigned int ElemCount;
2421 KGDrawCallback UserCallback;
2422 void* UserCallbackData;
2424 KGDrawCmd() { memset(
this, 0,
sizeof(*
this)); }
2427 inline KGTextureID GetTexID()
const {
return TextureId; }
2432#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
2444IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
2451 KGTextureID TextureId;
2452 unsigned int VtxOffset;
2473 inline void Clear() { _Current = 0; _Count = 1; }
2474 void ClearFreeMemory();
2475 void Split(
KGDrawList* draw_list,
int count);
2477 void SetCurrentChannel(
KGDrawList* draw_list,
int channel_idx);
2484 KGDrawFlags_None = 0,
2485 KGDrawFlags_Closed = 1 << 0,
2486 KGDrawFlags_RoundCornersTopLeft = 1 << 4,
2487 KGDrawFlags_RoundCornersTopRight = 1 << 5,
2488 KGDrawFlags_RoundCornersBottomLeft = 1 << 6,
2489 KGDrawFlags_RoundCornersBottomRight = 1 << 7,
2490 KGDrawFlags_RoundCornersNone = 1 << 8,
2491 KGDrawFlags_RoundCornersTop = KGDrawFlags_RoundCornersTopLeft | KGDrawFlags_RoundCornersTopRight,
2492 KGDrawFlags_RoundCornersBottom = KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersBottomRight,
2493 KGDrawFlags_RoundCornersLeft = KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersTopLeft,
2494 KGDrawFlags_RoundCornersRight = KGDrawFlags_RoundCornersBottomRight | KGDrawFlags_RoundCornersTopRight,
2495 KGDrawFlags_RoundCornersAll = KGDrawFlags_RoundCornersTopLeft | KGDrawFlags_RoundCornersTopRight | KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersBottomRight,
2496 KGDrawFlags_RoundCornersDefault_ = KGDrawFlags_RoundCornersAll,
2497 KGDrawFlags_RoundCornersMask_ = KGDrawFlags_RoundCornersAll | KGDrawFlags_RoundCornersNone,
2502enum KGDrawListFlags_
2504 KGDrawListFlags_None = 0,
2505 KGDrawListFlags_AntiAliasedLines = 1 << 0,
2506 KGDrawListFlags_AntiAliasedLinesUseTex = 1 << 1,
2507 KGDrawListFlags_AntiAliasedFill = 1 << 2,
2508 KGDrawListFlags_AllowVtxOffset = 1 << 3,
2526 KGDrawListFlags Flags;
2529 unsigned int _VtxCurrentIdx;
2531 const char* _OwnerName;
2533 KGDrawIdx* _IdxWritePtr;
2545 void PushClipRect(
const KGVec2& clip_rect_min,
const KGVec2& clip_rect_max,
bool intersect_with_current_clip_rect =
false);
2546 void PushClipRectFullScreen();
2548 void PushTextureID(KGTextureID texture_id);
2549 void PopTextureID();
2550 inline KGVec2 GetClipRectMin()
const {
const KGVec4& cr = _ClipRectStack.back();
return KGVec2(cr.x, cr.y); }
2551 inline KGVec2 GetClipRectMax()
const {
const KGVec4& cr = _ClipRectStack.back();
return KGVec2(cr.z, cr.w); }
2560 void AddLine(
const KGVec2& p1,
const KGVec2& p2, KGU32 col,
float thickness = 1.0f);
2561 void AddRect(
const KGVec2& p_min,
const KGVec2& p_max, KGU32 col,
float rounding = 0.0f, KGDrawFlags flags = 0,
float thickness = 1.0f);
2562 void AddRectFilled(
const KGVec2& p_min,
const KGVec2& p_max, KGU32 col,
float rounding = 0.0f, KGDrawFlags flags = 0);
2563 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);
2564 void AddQuad(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4, KGU32 col,
float thickness = 1.0f);
2566 void AddTriangle(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col,
float thickness = 1.0f);
2567 void AddTriangleFilled(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col);
2568 void AddCircle(
const KGVec2& center,
float radius, KGU32 col,
int num_segments = 0,
float thickness = 1.0f);
2569 void AddCircleFilled(
const KGVec2& center,
float radius, KGU32 col,
int num_segments = 0);
2570 void AddNgon(
const KGVec2& center,
float radius, KGU32 col,
int num_segments,
float thickness = 1.0f);
2571 void AddNgonFilled(
const KGVec2& center,
float radius, KGU32 col,
int num_segments);
2572 void AddText(
const KGVec2& pos, KGU32 col,
const char* text_begin,
const char* text_end = NULL);
2573 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);
2574 void AddPolyline(
const KGVec2* points,
int num_points, KGU32 col, KGDrawFlags flags,
float thickness);
2575 void AddConvexPolyFilled(
const KGVec2* points,
int num_points, KGU32 col);
2576 void AddBezierCubic(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4, KGU32 col,
float thickness,
int num_segments = 0);
2577 void AddBezierQuadratic(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col,
float thickness,
int num_segments = 0);
2583 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);
2584 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);
2585 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);
2588 void SetWindowBackgroundColor(
KGVec4 bgColor);
2592 inline void PathClear() { _Path.Size = 0; }
2593 inline void PathLineTo(
const KGVec2& pos) { _Path.push_back(pos); }
2594 inline void PathLineToMergeDuplicate(
const KGVec2& pos) {
if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }
2595 inline void PathFillConvex(KGU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; }
2596 inline void PathStroke(KGU32 col, KGDrawFlags flags = 0,
float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, flags, thickness); _Path.Size = 0; }
2597 void PathArcTo(
const KGVec2& center,
float radius,
float a_min,
float a_max,
int num_segments = 0);
2598 void PathArcToFast(
const KGVec2& center,
float radius,
int a_min_of_12,
int a_max_of_12);
2599 void PathBezierCubicCurveTo(
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4,
int num_segments = 0);
2600 void PathBezierQuadraticCurveTo(
const KGVec2& p2,
const KGVec2& p3,
int num_segments = 0);
2601 void PathRect(
const KGVec2& rect_min,
const KGVec2& rect_max,
float rounding = 0.0f, KGDrawFlags flags = 0);
2604 void AddCallback(KGDrawCallback callback,
void* callback_data);
2614 inline void ChannelsSplit(
int count) { _Splitter.Split(
this, count); }
2615 inline void ChannelsMerge() { _Splitter.Merge(
this); }
2616 inline void ChannelsSetCurrent(
int n) { _Splitter.SetCurrentChannel(
this, n); }
2621 void PrimReserve(
int idx_count,
int vtx_count);
2622 void PrimUnreserve(
int idx_count,
int vtx_count);
2623 void PrimRect(
const KGVec2& a,
const KGVec2& b, KGU32 col);
2626 inline void PrimWriteVtx(
const KGVec2& pos,
const KGVec2& uv, KGU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
2627 inline void PrimWriteIdx(KGDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
2628 inline void PrimVtx(
const KGVec2& pos,
const KGVec2& uv, KGU32 col) { PrimWriteIdx((KGDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }
2631 void _ResetForNewFrame();
2632 void _ClearFreeMemory();
2633 void _PopUnusedDrawCmd();
2634 void _TryMergeDrawCmds();
2635 void _OnChangedClipRect();
2636 void _OnChangedTextureID();
2637 void _OnChangedVtxOffset();
2638 int _CalcCircleAutoSegmentCount(
float radius)
const;
2639 void _PathArcToFastEx(
const KGVec2& center,
float radius,
int a_min_sample,
int a_max_sample,
int a_step);
2640 void _PathArcToN(
const KGVec2& center,
float radius,
float a_min,
float a_max,
int num_segments);
2660 void Clear() { memset(
this, 0,
sizeof(*
this)); }
2661 void DeIndexAllBuffers();
2662 void ScaleClipRects(
const KGVec2& fb_scale);
2673 bool FontDataOwnedByAtlas;
2679 KGVec2 GlyphExtraSpacing;
2681 const KGWchar* GlyphRanges;
2682 float GlyphMinAdvanceX;
2683 float GlyphMaxAdvanceX;
2685 unsigned int FontBuilderFlags;
2686 float RasterizerMultiply;
2687 KGWchar EllipsisChar;
2700 unsigned int Colored : 1;
2701 unsigned int Visible : 1;
2702 unsigned int Codepoint : 30;
2704 float X0, Y0, X1, Y1;
2705 float U0, V0, U1, V1;
2715 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); }
2716 inline bool GetBit(
size_t n)
const {
int off = (int)(n >> 5); KGU32 mask = 1u << (n & 31);
return (UsedChars[off] & mask) != 0; }
2717 inline void SetBit(
size_t n) {
int off = (int)(n >> 5); KGU32 mask = 1u << (n & 31); UsedChars[off] |= mask; }
2718 inline void AddChar(KGWchar c) { SetBit(c); }
2719 void AddText(
const char* text,
const char* text_end = NULL);
2720 void AddRanges(
const KGWchar* ranges);
2727 unsigned short Width, Height;
2728 unsigned short X, Y;
2729 unsigned int GlyphID;
2730 float GlyphAdvanceX;
2733 KGFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset =
KGVec2(0, 0); Font = NULL; }
2734 bool IsPacked()
const {
return X != 0xFFFF; }
2738enum KGFontAtlasFlags_
2740 KGFontAtlasFlags_None = 0,
2741 KGFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0,
2742 KGFontAtlasFlags_NoMouseCursors = 1 << 1,
2743 KGFontAtlasFlags_NoBakedLines = 1 << 2,
2769 KGFont* AddFontFromFileTTF(
const char* filename,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2770 KGFont* AddFontFromMemoryTTF(
void* font_data,
int font_size,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2771 KGFont* AddFontFromMemoryCompressedTTF(
const void* compressed_font_data,
int compressed_font_size,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2772 KGFont* AddFontFromMemoryCompressedBase85TTF(
const char* compressed_font_data_base85,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2773 void ClearInputData();
2774 void ClearTexData();
2784 void GetTexDataAsAlpha8(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2785 void GetTexDataAsRGBA32(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2786 bool IsBuilt()
const {
return Fonts.Size > 0 && TexReady; }
2787 void SetTexID(KGTextureID
id) { TexID = id; }
2796 static const KGWchar* GetGlyphRangesDefault();
2797 static const KGWchar* GetGlyphRangesGreek();
2798 static const KGWchar* GetGlyphRangesKorean();
2799 static const KGWchar* GetGlyphRangesJapanese();
2800 static const KGWchar* GetGlyphRangesChineseFull();
2801 static const KGWchar* GetGlyphRangesChineseSimplifiedCommon();
2802 static const KGWchar* GetGlyphRangesCyrillic();
2803 static const KGWchar* GetGlyphRangesThai();
2804 static const KGWchar* GetGlyphRangesVietnamese();
2817 int AddCustomRectRegular(
int width,
int height);
2818 int AddCustomRectFontGlyph(
KGFont* font, KGWchar
id,
int width,
int height,
float advance_x,
const KGVec2& offset =
KGVec2(0, 0));
2819 KGFontAtlasCustomRect* GetCustomRectByIndex(
int index) { KR_CORE_ASSERT(index >= 0,
"");
return &CustomRects[index]; }
2823 bool GetMouseCursorTexData(KarmaGuiMouseCursor cursor,
KGVec2* out_offset,
KGVec2* out_size,
KGVec2 out_uv_border[2],
KGVec2 out_uv_fill[2]);
2829 KGFontAtlasFlags Flags;
2831 int TexDesiredWidth;
2832 int TexGlyphPadding;
2839 bool TexPixelsUseColors;
2840 unsigned char* TexPixelsAlpha8;
2841 unsigned int* TexPixelsRGBA32;
2849 KGVec4 TexUvLines[KG_DRAWLIST_TEX_LINES_WIDTH_MAX + 1];
2853 unsigned int FontBuilderFlags;
2856 int PackIdMouseCursors;
2870 float FallbackAdvanceX;
2881 short ConfigDataCount;
2882 KGWchar FallbackChar;
2883 KGWchar EllipsisChar;
2885 bool DirtyLookupTables;
2887 float Ascent, Descent;
2888 int MetricsTotalSurface;
2889 KGU8 Used4kPagesMap[(KG_UNICODE_CODEPOINT_MAX+1)/4096/8];
2895 const KGFontGlyph*FindGlyphNoFallback(KGWchar c)
const;
2896 float GetCharAdvance(KGWchar c)
const {
return ((
int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; }
2897 bool IsLoaded()
const {
return ContainerAtlas != NULL; }
2898 const char* GetDebugName()
const {
return ConfigData ? ConfigData->Name :
"<unknown>"; }
2902 KGVec2 CalcTextSizeA(
float size,
float max_width,
float wrap_width,
const char* text_begin,
const char* text_end = NULL,
const char** remaining = NULL)
const;
2903 const char* CalcWordWrapPositionA(
float scale,
const char* text,
const char* text_end,
float wrap_width)
const;
2904 void RenderChar(
KGDrawList* draw_list,
float size,
const KGVec2& pos, KGU32 col, KGWchar c)
const;
2905 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;
2908 void BuildLookupTable();
2909 void ClearOutputData();
2910 void GrowIndex(
int new_size);
2911 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);
2912 void AddRemapChar(KGWchar dst, KGWchar src,
bool overwrite_dst =
true);
2913 void SetGlyphVisible(KGWchar c,
bool visible);
2914 bool IsGlyphRangeUnused(
unsigned int c_begin,
unsigned int c_last);
2922enum KGGuiViewportFlags_
2924 KGGuiViewportFlags_None = 0,
2925 KGGuiViewportFlags_IsPlatformWindow = 1 << 0,
2926 KGGuiViewportFlags_IsPlatformMonitor = 1 << 1,
2927 KGGuiViewportFlags_OwnedByApp = 1 << 2,
2928 KGGuiViewportFlags_NoDecoration = 1 << 3,
2929 KGGuiViewportFlags_NoTaskBarIcon = 1 << 4,
2930 KGGuiViewportFlags_NoFocusOnAppearing = 1 << 5,
2931 KGGuiViewportFlags_NoFocusOnClick = 1 << 6,
2932 KGGuiViewportFlags_NoInputs = 1 << 7,
2933 KGGuiViewportFlags_NoRendererClear = 1 << 8,
2934 KGGuiViewportFlags_TopMost = 1 << 9,
2935 KGGuiViewportFlags_Minimized = 1 << 10,
2936 KGGuiViewportFlags_NoAutoMerge = 1 << 11,
2937 KGGuiViewportFlags_CanHostOtherWindows = 1 << 12,
2950 KarmaGuiViewportFlags Flags;
2956 KGGuiID ParentViewportId;
2964 void* RendererUserData;
2965 void* PlatformUserData;
2966 void* PlatformHandle;
2967 void* PlatformHandleRaw;
2968 bool PlatformWindowCreated;
2969 bool PlatformRequestMove;
2970 bool PlatformRequestResize;
2971 bool PlatformRequestClose;
2974 ~KarmaGuiViewport() { KR_CORE_ASSERT(PlatformUserData == NULL && RendererUserData == NULL,
""); }
2977 KGVec2 GetCenter()
const {
return KGVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }
2978 KGVec2 GetWorkCenter()
const {
return KGVec2(WorkPos.x + WorkSize.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); }
3068 int (*Platform_CreateVkSurface)(
KarmaGuiViewport* vp, KGU64 vk_inst,
const void* vk_allocators, KGU64* out_vk_surface);
3096 KGVec2 MainPos, MainSize;
3097 KGVec2 WorkPos, WorkSize;
3107 float InputLineHeight;
Definition KarmaGui.h:167
Definition KarmaGui.h:2366
Definition KarmaGui.h:2457
Definition KarmaGui.h:2415
Definition KarmaGui.h:2647
Definition KarmaGuiInternal.h:623
Definition KarmaGui.h:2466
Definition KarmaGui.h:2521
Definition KarmaGui.h:2434
Definition KarmaGui.h:2726
Definition KarmaGui.h:2764
Definition KarmaGuiInternal.h:3360
Definition KarmaGui.h:2670
Definition KarmaGui.h:2711
Definition KarmaGui.h:2699
Definition KarmaGui.h:2867
Definition KarmaGui.h:1739
Definition KarmaGui.h:145
Definition KarmaGui.h:155
Definition KarmaGui.h:1761
Definition KarmaGuiInternal.h:1725
Definition KarmaGui.h:1896
Definition KarmaGui.h:2084
Definition KarmaGui.h:1888
Definition KarmaGui.h:2326
Definition KarmaGui.h:2201
Definition KarmaGui.h:2145
Definition KarmaGui.h:2115
Definition KarmaGui.h:2266
Definition KarmaGui.h:2263
Definition KarmaGui.h:1831
Definition KarmaGui.h:2167
Definition KarmaGui.h:2181
Definition KarmaGui.h:2236
Definition KarmaGui.h:2209
Definition KarmaGui.h:2948
Definition KarmaGui.h:2130