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)
77enum KarmaGuiKey : int;
79typedef int KarmaGuiCol;
80typedef int KarmaGuiCond;
81typedef int KarmaGuiDataType;
82typedef int KarmaGuiDir;
83typedef int KarmaGuiMouseButton;
84typedef int KarmaGuiMouseCursor;
85typedef int KarmaGuiSortDirection;
86typedef int KarmaGuiStyleVar;
87typedef int KarmaGuiTableBgTarget;
90typedef int KGDrawFlags;
91typedef int KGDrawListFlags;
92typedef int KGFontAtlasFlags;
93typedef int KarmaGuiBackendFlags;
94typedef int KarmaGuiButtonFlags;
95typedef int KarmaGuiColorEditFlags;
96typedef int KarmaGuiConfigFlags;
97typedef int KarmaGuiComboFlags;
98typedef int KarmaGuiDockNodeFlags;
99typedef int KarmaGuiDragDropFlags;
100typedef int KarmaGuiFocusedFlags;
101typedef int KarmaGuiHoveredFlags;
102typedef int KarmaGuiInputFlags;
103typedef int KarmaGuiInputTextFlags;
104typedef int KarmaGuiKeyChord;
105typedef int KarmaGuiPopupFlags;
106typedef int KarmaGuiSelectableFlags;
107typedef int KarmaGuiSliderFlags;
108typedef int KarmaGuiTabBarFlags;
109typedef int KarmaGuiTabItemFlags;
110typedef int KarmaGuiTableFlags;
111typedef int KarmaGuiTableColumnFlags;
112typedef int KarmaGuiTableRowFlags;
113typedef int KarmaGuiTreeNodeFlags;
114typedef int KarmaGuiViewportFlags;
115typedef int KarmaGuiWindowFlags;
116typedef void* KGTextureID;
123typedef unsigned short KGDrawIdx;
132typedef unsigned int KGGuiID;
133typedef signed char KGS8;
134typedef unsigned char KGU8;
135typedef signed short KGS16;
136typedef unsigned short KGU16;
137typedef signed int KGS32;
138typedef unsigned int KGU32;
139typedef signed long long KGS64;
140typedef unsigned long long KGU64;
144typedef unsigned short KGWchar16;
145typedef KGWchar16 KGWchar;
150typedef void* (*KarmaGuiMemAllocFunc)(
size_t sz,
void* user_data);
151typedef void (*KarmaGuiMemFreeFunc)(
void* ptr,
void* user_data);
158 constexpr KGVec2() : x(0.0f), y(0.0f) { }
159 constexpr KGVec2(
float _x,
float _y) : x(_x), y(_y) { }
160 float operator[] (
size_t idx)
const { KR_CORE_ASSERT(idx <= 1,
"");
return (&x)[idx]; }
161 float& operator[] (
size_t idx) { KR_CORE_ASSERT(idx <= 1,
"");
return (&x)[idx]; }
168 constexpr KGVec4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) { }
169 constexpr KGVec4(
float _x,
float _y,
float _z,
float _w) : x(_x), y(_y), z(_z), w(_w) { }
170#ifdef KG_VEC4_CLASS_EXTRA
189 static void NewFrame();
190 static void EndFrame();
201 static void ShowDemoWindow(
bool* p_open = NULL);
202 static void ShowMetricsWindow(
bool* p_open = NULL);
203 static void ShowDebugLogWindow(
bool* p_open = NULL);
204 static void ShowStackToolWindow(
bool* p_open = NULL);
205 static void ShowAboutWindow(
bool* p_open = NULL);
207 static bool ShowStyleSelector(
const char* label);
208 static void ShowFontSelector(
const char* label);
209 static void ShowUserGuide();
229 static bool Begin(
const char* name,
bool* p_open = NULL, KarmaGuiWindowFlags flags = 0);
240 static bool BeginChild(
const char* str_id,
const KGVec2& size =
KGVec2(0, 0),
bool border =
false, KarmaGuiWindowFlags flags = 0);
241 static bool BeginChild(KGGuiID
id,
const KGVec2& size =
KGVec2(0, 0),
bool border =
false, KarmaGuiWindowFlags flags = 0);
242 static void EndChild();
246 static bool IsWindowAppearing();
247 static bool IsWindowCollapsed();
248 static bool IsWindowFocused(KarmaGuiFocusedFlags flags=0);
249 static bool IsWindowHovered(KarmaGuiHoveredFlags flags=0);
251 static float GetWindowDpiScale();
252 static KGVec2 GetWindowPos();
253 static KGVec2 GetWindowSize();
254 static float GetWindowWidth();
255 static float GetWindowHeight();
260 static void SetNextWindowPos(
const KGVec2& pos, KarmaGuiCond cond = 0,
const KGVec2& pivot =
KGVec2(0, 0));
261 static void SetNextWindowSize(
const KGVec2& size, KarmaGuiCond cond = 0);
262 static void SetNextWindowSizeConstraints(
const KGVec2& size_min,
const KGVec2& size_max, KarmaGuiSizeCallback custom_callback = NULL,
void* custom_callback_data = NULL);
263 static void SetNextWindowContentSize(
const KGVec2& size);
264 static void SetNextWindowCollapsed(
bool collapsed, KarmaGuiCond cond = 0);
265 static void SetNextWindowFocus();
266 static void SetNextWindowScroll(
const KGVec2& scroll);
267 static void SetNextWindowBgAlpha(
float alpha);
268 static void SetNextWindowViewport(KGGuiID viewport_id);
269 static void SetWindowPos(
const KGVec2& pos, KarmaGuiCond cond = 0);
270 static void SetWindowSize(
const KGVec2& size, KarmaGuiCond cond = 0);
271 static void SetWindowCollapsed(
bool collapsed, KarmaGuiCond cond = 0);
272 static void SetWindowFocus();
273 static void SetWindowFontScale(
float scale);
274 static void SetWindowPos(
const char* name,
const KGVec2& pos, KarmaGuiCond cond = 0);
275 static void SetWindowSize(
const char* name,
const KGVec2& size, KarmaGuiCond cond = 0);
276 static void SetWindowCollapsed(
const char* name,
bool collapsed, KarmaGuiCond cond = 0);
277 static void SetWindowFocus(
const char* name);
282 static KGVec2 GetContentRegionAvail();
283 static KGVec2 GetContentRegionMax();
284 static KGVec2 GetWindowContentRegionMin();
285 static KGVec2 GetWindowContentRegionMax();
290 static float GetScrollX();
291 static float GetScrollY();
292 static void SetScrollX(
float scroll_x);
293 static void SetScrollY(
float scroll_y);
294 static float GetScrollMaxX();
295 static float GetScrollMaxY();
296 static void SetScrollHereX(
float center_x_ratio = 0.5f);
297 static void SetScrollHereY(
float center_y_ratio = 0.5f);
298 static void SetScrollFromPosX(
float local_x,
float center_x_ratio = 0.5f);
299 static void SetScrollFromPosY(
float local_y,
float center_y_ratio = 0.5f);
302 static void PushFont(
KGFont* font);
303 static void PopFont();
304 static void PushStyleColor(KarmaGuiCol idx, KGU32 col);
305 static void PushStyleColor(KarmaGuiCol idx,
const KGVec4& col);
306 static void PopStyleColor(
int count = 1);
307 static void PushStyleVar(KarmaGuiStyleVar idx,
float val);
308 static void PushStyleVar(KarmaGuiStyleVar idx,
const KGVec2& val);
309 static void PopStyleVar(
int count = 1);
310 static void PushAllowKeyboardFocus(
bool allow_keyboard_focus);
311 static void PopAllowKeyboardFocus();
312 static void PushButtonRepeat(
bool repeat);
313 static void PopButtonRepeat();
316 static void PushItemWidth(
float item_width);
317 static void PopItemWidth();
318 static void SetNextItemWidth(
float item_width);
319 static float CalcItemWidth();
320 static void PushTextWrapPos(
float wrap_local_pos_x = 0.0f);
321 static void PopTextWrapPos();
326 static float GetFontSize();
327 static KGVec2 GetFontTexUvWhitePixel();
328 static KGU32 GetColorU32(KarmaGuiCol idx,
float alpha_mul = 1.0f);
329 static KGU32 GetColorU32(
const KGVec4& col);
330 static KGU32 GetColorU32(KGU32 col);
331 static const KGVec4& GetStyleColorVec4(KarmaGuiCol idx);
340 static void Separator();
341 static void SameLine(
float offset_from_start_x=0.0f,
float spacing=-1.0f);
342 static void NewLine();
343 static void Spacing();
344 static void Dummy(
const KGVec2& size);
345 static void Indent(
float indent_w = 0.0f);
346 static void Unindent(
float indent_w = 0.0f);
347 static void BeginGroup();
348 static void EndGroup();
349 static KGVec2 GetCursorPos();
350 static float GetCursorPosX();
351 static float GetCursorPosY();
352 static void SetCursorPos(
const KGVec2& local_pos);
353 static void SetCursorPosX(
float local_x);
354 static void SetCursorPosY(
float local_y);
355 static KGVec2 GetCursorStartPos();
356 static KGVec2 GetCursorScreenPos();
357 static void SetCursorScreenPos(
const KGVec2& pos);
358 static void AlignTextToFramePadding();
359 static float GetTextLineHeight();
360 static float GetTextLineHeightWithSpacing();
361 static float GetFrameHeight();
362 static float GetFrameHeightWithSpacing();
375 static void PushID(
const char* str_id);
376 static void PushID(
const char* str_id_begin,
const char* str_id_end);
377 static void PushID(
const void* ptr_id);
378 static void PushID(
int int_id);
380 static KGGuiID GetID(
const char* str_id);
381 static KGGuiID GetID(
const char* str_id_begin,
const char* str_id_end);
382 static KGGuiID GetID(
const void* ptr_id);
385 static void TextUnformatted(
const char* text,
const char* text_end = NULL);
386 static void Text(
const char* fmt, ...) KG_FMTARGS(1);
387 static void TextV(
const char* fmt, va_list args) KG_FMTLIST(1);
388 static void TextColored(
const KGVec4& col,
const char* fmt, ...) KG_FMTARGS(2);
390 static void TextColoredV(
const KGVec4& col,
const char* fmt, va_list args) KG_FMTLIST(2);
391 static void TextDisabled(
const char* fmt, ...) KG_FMTARGS(1);
392 static void TextDisabledV(
const char* fmt, va_list args) KG_FMTLIST(1);
393 static void TextWrapped(
const char* fmt, ...) KG_FMTARGS(1);
394 static void TextWrappedV(
const char* fmt, va_list args) KG_FMTLIST(1);
395 static void LabelText(
const char* label,
const char* fmt, ...) KG_FMTARGS(2);
396 static void LabelTextV(
const char* label,
const char* fmt, va_list args) KG_FMTLIST(2);
397 static void BulletText(
const char* fmt, ...) KG_FMTARGS(1);
398 static void BulletTextV(
const char* fmt, va_list args) KG_FMTLIST(1);
403 static bool Button(
const char* label,
const KGVec2& size =
KGVec2(0, 0));
404 static bool SmallButton(
const char* label);
405 static bool InvisibleButton(
const char* str_id,
const KGVec2& size, KarmaGuiButtonFlags flags = 0);
406 static bool ArrowButton(
const char* str_id, KarmaGuiDir dir);
407 static bool Checkbox(
const char* label,
bool* v);
408 static bool CheckboxFlags(
const char* label,
int* flags,
int flags_value);
409 static bool CheckboxFlags(
const char* label,
unsigned int* flags,
unsigned int flags_value);
410 static bool RadioButton(
const char* label,
bool active);
411 static bool RadioButton(
const char* label,
int* v,
int v_button);
412 static void ProgressBar(
float fraction,
const KGVec2& size_arg =
KGVec2(-FLT_MIN, 0),
const char* overlay = NULL);
413 static void Bullet();
417 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));
423 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));
428 static bool BeginCombo(
const char* label,
const char* preview_value, KarmaGuiComboFlags flags = 0);
429 static void EndCombo();
430 static bool Combo(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int popup_max_height_in_items = -1);
431 static bool Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int popup_max_height_in_items = -1);
432 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);
446 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);
447 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);
448 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);
449 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);
450 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);
451 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);
452 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);
453 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);
454 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);
455 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);
456 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);
457 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);
465 static bool SliderFloat(
const char* label,
float* v,
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
466 static bool SliderFloat2(
const char* label,
float v[2],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
467 static bool SliderFloat3(
const char* label,
float v[3],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
468 static bool SliderFloat4(
const char* label,
float v[4],
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
469 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);
470 static bool SliderInt(
const char* label,
int* v,
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
471 static bool SliderInt2(
const char* label,
int v[2],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
472 static bool SliderInt3(
const char* label,
int v[3],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
473 static bool SliderInt4(
const char* label,
int v[4],
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
474 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);
475 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);
476 static bool VSliderFloat(
const char* label,
const KGVec2& size,
float* v,
float v_min,
float v_max,
const char* format =
"%.3f", KarmaGuiSliderFlags flags = 0);
477 static bool VSliderInt(
const char* label,
const KGVec2& size,
int* v,
int v_min,
int v_max,
const char* format =
"%d", KarmaGuiSliderFlags flags = 0);
478 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);
483 static bool InputText(
const char* label,
char* buf,
size_t buf_size, KarmaGuiInputTextFlags flags = 0, KarmaGuiInputTextCallback callback = NULL,
void* user_data = NULL);
484 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);
485 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);
486 static bool InputFloat(
const char* label,
float* v,
float step = 0.0f,
float step_fast = 0.0f,
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
487 static bool InputFloat2(
const char* label,
float v[2],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
488 static bool InputFloat3(
const char* label,
float v[3],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
489 static bool InputFloat4(
const char* label,
float v[4],
const char* format =
"%.3f", KarmaGuiInputTextFlags flags = 0);
490 static bool InputInt(
const char* label,
int* v,
int step = 1,
int step_fast = 100, KarmaGuiInputTextFlags flags = 0);
491 static bool InputInt2(
const char* label,
int v[2], KarmaGuiInputTextFlags flags = 0);
492 static bool InputInt3(
const char* label,
int v[3], KarmaGuiInputTextFlags flags = 0);
493 static bool InputInt4(
const char* label,
int v[4], KarmaGuiInputTextFlags flags = 0);
494 static bool InputDouble(
const char* label,
double* v,
double step = 0.0,
double step_fast = 0.0,
const char* format =
"%.6f", KarmaGuiInputTextFlags flags = 0);
495 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);
496 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);
501 static bool ColorEdit3(
const char* label,
float col[3], KarmaGuiColorEditFlags flags = 0);
502 static bool ColorEdit4(
const char* label,
float col[4], KarmaGuiColorEditFlags flags = 0);
503 static bool ColorPicker3(
const char* label,
float col[3], KarmaGuiColorEditFlags flags = 0);
504 static bool ColorPicker4(
const char* label,
float col[4], KarmaGuiColorEditFlags flags = 0,
const float* ref_col = NULL);
505 static bool ColorButton(
const char* desc_id,
const KGVec4& col, KarmaGuiColorEditFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
506 static void SetColorEditOptions(KarmaGuiColorEditFlags flags);
510 static bool TreeNode(
const char* label);
511 static bool TreeNode(
const char* str_id,
const char* fmt, ...) KG_FMTARGS(2);
512 static bool TreeNode(
const void* ptr_id,
const char* fmt, ...) KG_FMTARGS(2);
513 static bool TreeNodeV(
const char* str_id,
const char* fmt, va_list args) KG_FMTLIST(2);
514 static bool TreeNodeV(
const void* ptr_id,
const char* fmt, va_list args) KG_FMTLIST(2);
515 static bool TreeNodeEx(
const char* label, KarmaGuiTreeNodeFlags flags = 0);
516 static bool TreeNodeEx(
const char* str_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, ...) KG_FMTARGS(3);
517 static bool TreeNodeEx(
const void* ptr_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, ...) KG_FMTARGS(3);
518 static bool TreeNodeExV(
const char* str_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, va_list args) KG_FMTLIST(3);
519 static bool TreeNodeExV(
const void* ptr_id, KarmaGuiTreeNodeFlags flags,
const char* fmt, va_list args) KG_FMTLIST(3);
520 static void TreePush(
const char* str_id);
521 static void TreePush(
const void* ptr_id);
522 static void TreePop();
523 static float GetTreeNodeToLabelSpacing();
524 static bool CollapsingHeader(
const char* label, KarmaGuiTreeNodeFlags flags = 0);
525 static bool CollapsingHeader(
const char* label,
bool* p_visible, KarmaGuiTreeNodeFlags flags = 0);
526 static void SetNextItemOpen(
bool is_open, KarmaGuiCond cond = 0);
531 static bool Selectable(
const char* label,
bool selected =
false, KarmaGuiSelectableFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
532 static bool Selectable(
const char* label,
bool* p_selected, KarmaGuiSelectableFlags flags = 0,
const KGVec2& size =
KGVec2(0, 0));
540 static bool BeginListBox(
const char* label,
const KGVec2& size =
KGVec2(0, 0));
541 static void EndListBox();
542 static bool ListBox(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int height_in_items = -1);
543 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);
547 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));
548 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));
549 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));
550 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));
554 static void Value(
const char* prefix,
bool b);
555 static void Value(
const char* prefix,
int v);
556 static void Value(
const char* prefix,
unsigned int v);
557 static void Value(
const char* prefix,
float v,
const char* float_format = NULL);
564 static bool BeginMenuBar();
565 static void EndMenuBar();
566 static bool BeginMainMenuBar();
567 static void EndMainMenuBar();
568 static bool BeginMenu(
const char* label,
bool enabled =
true);
569 static void EndMenu();
570 static bool MenuItem(
const char* label,
const char* shortcut = NULL,
bool selected =
false,
bool enabled =
true);
571 static bool MenuItem(
const char* label,
const char* shortcut,
bool* p_selected,
bool enabled =
true);
575 static void BeginTooltip();
576 static void EndTooltip();
577 static void SetTooltip(
const char* fmt, ...) KG_FMTARGS(1);
578 static void SetTooltipV(
const char* fmt, va_list args) KG_FMTLIST(1);
592 static bool BeginPopup(
const char* str_id, KarmaGuiWindowFlags flags = 0);
593 static bool BeginPopupModal(
const char* name,
bool* p_open = NULL, KarmaGuiWindowFlags flags = 0);
594 static void EndPopup();
604 static void OpenPopup(
const char* str_id, KarmaGuiPopupFlags popup_flags = 0);
605 static void OpenPopup(KGGuiID
id, KarmaGuiPopupFlags popup_flags = 0);
606 static void OpenPopupOnItemClick(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
607 static void CloseCurrentPopup();
614 static bool BeginPopupContextItem(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
615 static bool BeginPopupContextWindow(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
616 static bool BeginPopupContextVoid(
const char* str_id = NULL, KarmaGuiPopupFlags popup_flags = 1);
622 static bool IsPopupOpen(
const char* str_id, KarmaGuiPopupFlags flags = 0);
647 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);
648 static void EndTable();
649 static void TableNextRow(KarmaGuiTableRowFlags row_flags = 0,
float min_row_height = 0.0f);
650 static bool TableNextColumn();
651 static bool TableSetColumnIndex(
int column_n);
661 static void TableSetupColumn(
const char* label, KarmaGuiTableColumnFlags flags = 0,
float init_width_or_weight = 0.0f, KGGuiID user_id = 0);
662 static void TableSetupScrollFreeze(
int cols,
int rows);
663 static void TableHeadersRow();
664 static void TableHeader(
const char* label);
673 static int TableGetColumnCount();
674 static int TableGetColumnIndex();
675 static int TableGetRowIndex();
676 static const char* TableGetColumnName(
int column_n = -1);
677 static KarmaGuiTableColumnFlags TableGetColumnFlags(
int column_n = -1);
678 static void TableSetColumnEnabled(
int column_n,
bool v);
679 static void TableSetBgColor(KarmaGuiTableBgTarget target, KGU32 color,
int column_n = -1);
683 static void Columns(
int count = 1,
const char*
id = NULL,
bool border =
true);
684 static void NextColumn();
685 static int GetColumnIndex();
686 static float GetColumnWidth(
int column_index = -1);
687 static void SetColumnWidth(
int column_index,
float width);
688 static float GetColumnOffset(
int column_index = -1);
689 static void SetColumnOffset(
int column_index,
float offset_x);
690 static int GetColumnsCount();
694 static bool BeginTabBar(
const char* str_id, KarmaGuiTabBarFlags flags = 0);
695 static void EndTabBar();
696 static bool BeginTabItem(
const char* label,
bool* p_open = NULL, KarmaGuiTabItemFlags flags = 0);
697 static void EndTabItem();
698 static bool TabItemButton(
const char* label, KarmaGuiTabItemFlags flags = 0);
699 static void SetTabItemClosed(
const char* tab_or_docked_window_label);
714 static KGGuiID DockSpace(KGGuiID
id,
const KGVec2& size =
KGVec2(0, 0), KarmaGuiDockNodeFlags flags = 0,
const KarmaGuiWindowClass* window_class = NULL);
716 static void SetNextWindowDockID(KGGuiID dock_id, KarmaGuiCond cond = 0);
718 static KGGuiID GetWindowDockID();
719 static bool IsWindowDocked();
723 static void LogToTTY(
int auto_open_depth = -1);
724 static void LogToFile(
int auto_open_depth = -1,
const char* filename = NULL);
725 static void LogToClipboard(
int auto_open_depth = -1);
726 static void LogFinish();
727 static void LogButtons();
728 static void LogText(
const char* fmt, ...) KG_FMTARGS(1);
729 static void LogTextV(
const char* fmt, va_list args) KG_FMTLIST(1);
730 static void LogTextV(
KarmaGuiContext& g,
const char* fmt, va_list args);
737 static bool BeginDragDropSource(KarmaGuiDragDropFlags flags = 0);
738 static bool SetDragDropPayload(
const char* type,
const void* data,
size_t sz, KarmaGuiCond cond = 0);
739 static void EndDragDropSource();
740 static bool BeginDragDropTarget();
741 static const KarmaGuiPayload* AcceptDragDropPayload(
const char* type, KarmaGuiDragDropFlags flags = 0);
742 static void EndDragDropTarget();
749 static void BeginDisabled(
bool disabled =
true);
750 static void EndDisabled();
754 static void PushClipRect(
const KGVec2& clip_rect_min,
const KGVec2& clip_rect_max,
bool intersect_with_current_clip_rect);
755 static void PopClipRect();
759 static void SetItemDefaultFocus();
760 static void SetKeyboardFocusHere(
int offset = 0);
765 static bool IsItemHovered(KarmaGuiHoveredFlags flags = 0);
766 static bool IsItemActive();
767 static bool IsItemFocused();
768 static bool IsItemClicked(KarmaGuiMouseButton mouse_button = 0);
769 static bool IsItemVisible();
770 static bool IsItemEdited();
771 static bool IsItemActivated();
772 static bool IsItemDeactivated();
773 static bool IsItemDeactivatedAfterEdit();
774 static bool IsItemToggledOpen();
775 static bool IsAnyItemHovered();
776 static bool IsAnyItemActive();
777 static bool IsAnyItemFocused();
778 static KGGuiID GetItemID();
779 static KGVec2 GetItemRectMin();
780 static KGVec2 GetItemRectMax();
781 static KGVec2 GetItemRectSize();
782 static void SetItemAllowOverlap();
797 static bool IsRectVisible(
const KGVec2& size);
798 static bool IsRectVisible(
const KGVec2& rect_min,
const KGVec2& rect_max);
799 static double GetTime();
800 static int GetFrameCount();
802 static const char* GetStyleColorName(KarmaGuiCol idx);
805 static bool BeginChildFrame(KGGuiID
id,
const KGVec2& size, KarmaGuiWindowFlags flags = 0);
806 static void EndChildFrame();
809 static KGVec2 CalcTextSize(
const char* text,
const char* text_end = NULL,
bool hide_text_after_double_hash =
false,
float wrap_width = -1.0f);
812 static KGVec4 ColorConvertU32ToFloat4(KGU32 in);
813 static KGU32 ColorConvertFloat4ToU32(
const KGVec4& in);
814 static void ColorConvertRGBtoHSV(
float r,
float g,
float b,
float& out_h,
float& out_s,
float& out_v);
815 static void ColorConvertHSVtoRGB(
float h,
float s,
float v,
float& out_r,
float& out_g,
float& out_b);
822 static bool IsKeyDown(KarmaGuiKey key);
823 static bool IsKeyPressed(KarmaGuiKey key,
bool repeat =
true);
824 static bool IsKeyReleased(KarmaGuiKey key);
825 static int GetKeyPressedAmount(KarmaGuiKey key,
float repeat_delay,
float rate);
826 static const char* GetKeyName(KarmaGuiKey key);
827 static void SetNextFrameWantCaptureKeyboard(
bool want_capture_keyboard);
842 static bool Shortcut(KarmaGuiKeyChord key_chord, KGGuiID owner_id = 0, KarmaGuiInputFlags flags = 0);
848 static bool IsMouseDown(KarmaGuiMouseButton button);
849 static bool IsMouseClicked(KarmaGuiMouseButton button,
bool repeat =
false);
850 static bool IsMouseReleased(KarmaGuiMouseButton button);
851 static bool IsMouseDoubleClicked(KarmaGuiMouseButton button);
852 static int GetMouseClickedCount(KarmaGuiMouseButton button);
853 static bool IsMouseHoveringRect(
const KGVec2& r_min,
const KGVec2& r_max,
bool clip =
true);
854 static bool IsMousePosValid(
const KGVec2* mouse_pos = NULL);
855 static bool IsAnyMouseDown();
856 static KGVec2 GetMousePos();
857 static KGVec2 GetMousePosOnOpeningCurrentPopup();
858 static bool IsMouseDragging(KarmaGuiMouseButton button,
float lock_threshold = -1.0f);
859 static KGVec2 GetMouseDragDelta(KarmaGuiMouseButton button = 0,
float lock_threshold = -1.0f);
860 static void ResetMouseDragDelta(KarmaGuiMouseButton button = 0);
861 static KarmaGuiMouseCursor GetMouseCursor();
862 static void SetMouseCursor(KarmaGuiMouseCursor cursor_type);
863 static void SetNextFrameWantCaptureMouse(
bool want_capture_mouse);
867 static const char* GetClipboardText();
868 static void SetClipboardText(
const char* text);
874 static void LoadIniSettingsFromDisk(
const char* ini_filename);
875 static void LoadIniSettingsFromMemory(
const char* ini_data,
size_t ini_size=0);
876 static void SaveIniSettingsToDisk(
const char* ini_filename);
877 static const char* SaveIniSettingsToMemory(
size_t* out_ini_size = NULL);
880 static void DebugTextEncoding(
const char* text);
881 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);
887 static void SetAllocatorFunctions(KarmaGuiMemAllocFunc alloc_func, KarmaGuiMemFreeFunc free_func,
void* user_data = NULL);
888 static void GetAllocatorFunctions(KarmaGuiMemAllocFunc* p_alloc_func, KarmaGuiMemFreeFunc* p_free_func,
void** p_user_data);
906 static void MemFree(
void* ptr);
912 static void UpdatePlatformWindows();
922 static void DestroyPlatformWindows();
924 static KarmaGuiViewport* FindViewportByPlatformHandle(
void* platform_handle);
925 static KarmaGuiKey GetKeyIndex(KarmaGuiKey key);
928 static const char*
const GKeyNames[];
939enum KGGuiWindowFlags_
941 KGGuiWindowFlags_None = 0,
942 KGGuiWindowFlags_NoTitleBar = 1 << 0,
943 KGGuiWindowFlags_NoResize = 1 << 1,
944 KGGuiWindowFlags_NoMove = 1 << 2,
945 KGGuiWindowFlags_NoScrollbar = 1 << 3,
946 KGGuiWindowFlags_NoScrollWithMouse = 1 << 4,
947 KGGuiWindowFlags_NoCollapse = 1 << 5,
948 KGGuiWindowFlags_AlwaysAutoResize = 1 << 6,
949 KGGuiWindowFlags_NoBackground = 1 << 7,
950 KGGuiWindowFlags_NoSavedSettings = 1 << 8,
951 KGGuiWindowFlags_NoMouseInputs = 1 << 9,
952 KGGuiWindowFlags_MenuBar = 1 << 10,
953 KGGuiWindowFlags_HorizontalScrollbar = 1 << 11,
954 KGGuiWindowFlags_NoFocusOnAppearing = 1 << 12,
955 KGGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13,
956 KGGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14,
957 KGGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15,
958 KGGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16,
959 KGGuiWindowFlags_NoNavInputs = 1 << 18,
960 KGGuiWindowFlags_NoNavFocus = 1 << 19,
961 KGGuiWindowFlags_UnsavedDocument = 1 << 20,
962 KGGuiWindowFlags_NoDocking = 1 << 21,
964 KGGuiWindowFlags_NoNav = KGGuiWindowFlags_NoNavInputs | KGGuiWindowFlags_NoNavFocus,
965 KGGuiWindowFlags_NoDecoration = KGGuiWindowFlags_NoTitleBar | KGGuiWindowFlags_NoResize | KGGuiWindowFlags_NoScrollbar | KGGuiWindowFlags_NoCollapse,
966 KGGuiWindowFlags_NoInputs = KGGuiWindowFlags_NoMouseInputs | KGGuiWindowFlags_NoNavInputs | KGGuiWindowFlags_NoNavFocus,
969 KGGuiWindowFlags_NavFlattened = 1 << 23,
970 KGGuiWindowFlags_ChildWindow = 1 << 24,
971 KGGuiWindowFlags_Tooltip = 1 << 25,
972 KGGuiWindowFlags_Popup = 1 << 26,
973 KGGuiWindowFlags_Modal = 1 << 27,
974 KGGuiWindowFlags_ChildMenu = 1 << 28,
975 KGGuiWindowFlags_DockNodeHost = 1 << 29,
980enum KGGuiInputTextFlags_
982 KGGuiInputTextFlags_None = 0,
983 KGGuiInputTextFlags_CharsDecimal = 1 << 0,
984 KGGuiInputTextFlags_CharsHexadecimal = 1 << 1,
985 KGGuiInputTextFlags_CharsUppercase = 1 << 2,
986 KGGuiInputTextFlags_CharsNoBlank = 1 << 3,
987 KGGuiInputTextFlags_AutoSelectAll = 1 << 4,
988 KGGuiInputTextFlags_EnterReturnsTrue = 1 << 5,
989 KGGuiInputTextFlags_CallbackCompletion = 1 << 6,
990 KGGuiInputTextFlags_CallbackHistory = 1 << 7,
991 KGGuiInputTextFlags_CallbackAlways = 1 << 8,
992 KGGuiInputTextFlags_CallbackCharFilter = 1 << 9,
993 KGGuiInputTextFlags_AllowTabInput = 1 << 10,
994 KGGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11,
995 KGGuiInputTextFlags_NoHorizontalScroll = 1 << 12,
996 KGGuiInputTextFlags_AlwaysOverwrite = 1 << 13,
997 KGGuiInputTextFlags_ReadOnly = 1 << 14,
998 KGGuiInputTextFlags_Password = 1 << 15,
999 KGGuiInputTextFlags_NoUndoRedo = 1 << 16,
1000 KGGuiInputTextFlags_CharsScientific = 1 << 17,
1001 KGGuiInputTextFlags_CallbackResize = 1 << 18,
1002 KGGuiInputTextFlags_CallbackEdit = 1 << 19,
1003 KGGuiInputTextFlags_EscapeClearsAll = 1 << 20,
1006#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1007 KGGuiInputTextFlags_AlwaysInsertMode = KGGuiInputTextFlags_AlwaysOverwrite
1012enum KGGuiTreeNodeFlags_
1014 KGGuiTreeNodeFlags_None = 0,
1015 KGGuiTreeNodeFlags_Selected = 1 << 0,
1016 KGGuiTreeNodeFlags_Framed = 1 << 1,
1017 KGGuiTreeNodeFlags_AllowItemOverlap = 1 << 2,
1018 KGGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3,
1019 KGGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4,
1020 KGGuiTreeNodeFlags_DefaultOpen = 1 << 5,
1021 KGGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6,
1022 KGGuiTreeNodeFlags_OpenOnArrow = 1 << 7,
1023 KGGuiTreeNodeFlags_Leaf = 1 << 8,
1024 KGGuiTreeNodeFlags_Bullet = 1 << 9,
1025 KGGuiTreeNodeFlags_FramePadding = 1 << 10,
1026 KGGuiTreeNodeFlags_SpanAvailWidth = 1 << 11,
1027 KGGuiTreeNodeFlags_SpanFullWidth = 1 << 12,
1028 KGGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13,
1030 KGGuiTreeNodeFlags_CollapsingHeader = KGGuiTreeNodeFlags_Framed | KGGuiTreeNodeFlags_NoTreePushOnOpen | KGGuiTreeNodeFlags_NoAutoOpenOnLog,
1041enum KGGuiPopupFlags_
1043 KGGuiPopupFlags_None = 0,
1044 KGGuiPopupFlags_MouseButtonLeft = 0,
1045 KGGuiPopupFlags_MouseButtonRight = 1,
1046 KGGuiPopupFlags_MouseButtonMiddle = 2,
1047 KGGuiPopupFlags_MouseButtonMask_ = 0x1F,
1048 KGGuiPopupFlags_MouseButtonDefault_ = 1,
1049 KGGuiPopupFlags_NoOpenOverExistingPopup = 1 << 5,
1050 KGGuiPopupFlags_NoOpenOverItems = 1 << 6,
1051 KGGuiPopupFlags_AnyPopupId = 1 << 7,
1052 KGGuiPopupFlags_AnyPopupLevel = 1 << 8,
1053 KGGuiPopupFlags_AnyPopup = KGGuiPopupFlags_AnyPopupId | KGGuiPopupFlags_AnyPopupLevel,
1057enum KGGuiSelectableFlags_
1059 KGGuiSelectableFlags_None = 0,
1060 KGGuiSelectableFlags_DontClosePopups = 1 << 0,
1061 KGGuiSelectableFlags_SpanAllColumns = 1 << 1,
1062 KGGuiSelectableFlags_AllowDoubleClick = 1 << 2,
1063 KGGuiSelectableFlags_Disabled = 1 << 3,
1064 KGGuiSelectableFlags_AllowItemOverlap = 1 << 4,
1068enum KGGuiComboFlags_
1070 KGGuiComboFlags_None = 0,
1071 KGGuiComboFlags_PopupAlignLeft = 1 << 0,
1072 KGGuiComboFlags_HeightSmall = 1 << 1,
1073 KGGuiComboFlags_HeightRegular = 1 << 2,
1074 KGGuiComboFlags_HeightLarge = 1 << 3,
1075 KGGuiComboFlags_HeightLargest = 1 << 4,
1076 KGGuiComboFlags_NoArrowButton = 1 << 5,
1077 KGGuiComboFlags_NoPreview = 1 << 6,
1078 KGGuiComboFlags_HeightMask_ = KGGuiComboFlags_HeightSmall | KGGuiComboFlags_HeightRegular | KGGuiComboFlags_HeightLarge | KGGuiComboFlags_HeightLargest,
1082enum KGGuiTabBarFlags_
1084 KGGuiTabBarFlags_None = 0,
1085 KGGuiTabBarFlags_Reorderable = 1 << 0,
1086 KGGuiTabBarFlags_AutoSelectNewTabs = 1 << 1,
1087 KGGuiTabBarFlags_TabListPopupButton = 1 << 2,
1088 KGGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3,
1089 KGGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4,
1090 KGGuiTabBarFlags_NoTooltip = 1 << 5,
1091 KGGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6,
1092 KGGuiTabBarFlags_FittingPolicyScroll = 1 << 7,
1093 KGGuiTabBarFlags_FittingPolicyMask_ = KGGuiTabBarFlags_FittingPolicyResizeDown | KGGuiTabBarFlags_FittingPolicyScroll,
1094 KGGuiTabBarFlags_FittingPolicyDefault_ = KGGuiTabBarFlags_FittingPolicyResizeDown,
1098enum KGGuiTabItemFlags_
1100 KGGuiTabItemFlags_None = 0,
1101 KGGuiTabItemFlags_UnsavedDocument = 1 << 0,
1102 KGGuiTabItemFlags_SetSelected = 1 << 1,
1103 KGGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2,
1104 KGGuiTabItemFlags_NoPushId = 1 << 3,
1105 KGGuiTabItemFlags_NoTooltip = 1 << 4,
1106 KGGuiTabItemFlags_NoReorder = 1 << 5,
1107 KGGuiTabItemFlags_Leading = 1 << 6,
1108 KGGuiTabItemFlags_Trailing = 1 << 7,
1133enum KGGuiTableFlags_
1136 KGGuiTableFlags_None = 0,
1137 KGGuiTableFlags_Resizable = 1 << 0,
1138 KGGuiTableFlags_Reorderable = 1 << 1,
1139 KGGuiTableFlags_Hideable = 1 << 2,
1140 KGGuiTableFlags_Sortable = 1 << 3,
1141 KGGuiTableFlags_NoSavedSettings = 1 << 4,
1142 KGGuiTableFlags_ContextMenuInBody = 1 << 5,
1144 KGGuiTableFlags_RowBg = 1 << 6,
1145 KGGuiTableFlags_BordersInnerH = 1 << 7,
1146 KGGuiTableFlags_BordersOuterH = 1 << 8,
1147 KGGuiTableFlags_BordersInnerV = 1 << 9,
1148 KGGuiTableFlags_BordersOuterV = 1 << 10,
1149 KGGuiTableFlags_BordersH = KGGuiTableFlags_BordersInnerH | KGGuiTableFlags_BordersOuterH,
1150 KGGuiTableFlags_BordersV = KGGuiTableFlags_BordersInnerV | KGGuiTableFlags_BordersOuterV,
1151 KGGuiTableFlags_BordersInner = KGGuiTableFlags_BordersInnerV | KGGuiTableFlags_BordersInnerH,
1152 KGGuiTableFlags_BordersOuter = KGGuiTableFlags_BordersOuterV | KGGuiTableFlags_BordersOuterH,
1153 KGGuiTableFlags_Borders = KGGuiTableFlags_BordersInner | KGGuiTableFlags_BordersOuter,
1154 KGGuiTableFlags_NoBordersInBody = 1 << 11,
1155 KGGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12,
1157 KGGuiTableFlags_SizingFixedFit = 1 << 13,
1158 KGGuiTableFlags_SizingFixedSame = 2 << 13,
1159 KGGuiTableFlags_SizingStretchProp = 3 << 13,
1160 KGGuiTableFlags_SizingStretchSame = 4 << 13,
1162 KGGuiTableFlags_NoHostExtendX = 1 << 16,
1163 KGGuiTableFlags_NoHostExtendY = 1 << 17,
1164 KGGuiTableFlags_NoKeepColumnsVisible = 1 << 18,
1165 KGGuiTableFlags_PreciseWidths = 1 << 19,
1167 KGGuiTableFlags_NoClip = 1 << 20,
1169 KGGuiTableFlags_PadOuterX = 1 << 21,
1170 KGGuiTableFlags_NoPadOuterX = 1 << 22,
1171 KGGuiTableFlags_NoPadInnerX = 1 << 23,
1173 KGGuiTableFlags_ScrollX = 1 << 24,
1174 KGGuiTableFlags_ScrollY = 1 << 25,
1176 KGGuiTableFlags_SortMulti = 1 << 26,
1177 KGGuiTableFlags_SortTristate = 1 << 27,
1180 KGGuiTableFlags_SizingMask_ = KGGuiTableFlags_SizingFixedFit | KGGuiTableFlags_SizingFixedSame | KGGuiTableFlags_SizingStretchProp | KGGuiTableFlags_SizingStretchSame,
1184enum KGGuiTableColumnFlags_
1187 KGGuiTableColumnFlags_None = 0,
1188 KGGuiTableColumnFlags_Disabled = 1 << 0,
1189 KGGuiTableColumnFlags_DefaultHide = 1 << 1,
1190 KGGuiTableColumnFlags_DefaultSort = 1 << 2,
1191 KGGuiTableColumnFlags_WidthStretch = 1 << 3,
1192 KGGuiTableColumnFlags_WidthFixed = 1 << 4,
1193 KGGuiTableColumnFlags_NoResize = 1 << 5,
1194 KGGuiTableColumnFlags_NoReorder = 1 << 6,
1195 KGGuiTableColumnFlags_NoHide = 1 << 7,
1196 KGGuiTableColumnFlags_NoClip = 1 << 8,
1197 KGGuiTableColumnFlags_NoSort = 1 << 9,
1198 KGGuiTableColumnFlags_NoSortAscending = 1 << 10,
1199 KGGuiTableColumnFlags_NoSortDescending = 1 << 11,
1200 KGGuiTableColumnFlags_NoHeaderLabel = 1 << 12,
1201 KGGuiTableColumnFlags_NoHeaderWidth = 1 << 13,
1202 KGGuiTableColumnFlags_PreferSortAscending = 1 << 14,
1203 KGGuiTableColumnFlags_PreferSortDescending = 1 << 15,
1204 KGGuiTableColumnFlags_IndentEnable = 1 << 16,
1205 KGGuiTableColumnFlags_IndentDisable = 1 << 17,
1208 KGGuiTableColumnFlags_IsEnabled = 1 << 24,
1209 KGGuiTableColumnFlags_IsVisible = 1 << 25,
1210 KGGuiTableColumnFlags_IsSorted = 1 << 26,
1211 KGGuiTableColumnFlags_IsHovered = 1 << 27,
1214 KGGuiTableColumnFlags_WidthMask_ = KGGuiTableColumnFlags_WidthStretch | KGGuiTableColumnFlags_WidthFixed,
1215 KGGuiTableColumnFlags_IndentMask_ = KGGuiTableColumnFlags_IndentEnable | KGGuiTableColumnFlags_IndentDisable,
1216 KGGuiTableColumnFlags_StatusMask_ = KGGuiTableColumnFlags_IsEnabled | KGGuiTableColumnFlags_IsVisible | KGGuiTableColumnFlags_IsSorted | KGGuiTableColumnFlags_IsHovered,
1217 KGGuiTableColumnFlags_NoDirectResize_ = 1 << 30,
1221enum KGGuiTableRowFlags_
1223 KGGuiTableRowFlags_None = 0,
1224 KGGuiTableRowFlags_Headers = 1 << 0,
1236enum KGGuiTableBgTarget_
1238 KGGuiTableBgTarget_None = 0,
1239 KGGuiTableBgTarget_RowBg0 = 1,
1240 KGGuiTableBgTarget_RowBg1 = 2,
1241 KGGuiTableBgTarget_CellBg = 3,
1245enum KGGuiFocusedFlags_
1247 KGGuiFocusedFlags_None = 0,
1248 KGGuiFocusedFlags_ChildWindows = 1 << 0,
1249 KGGuiFocusedFlags_RootWindow = 1 << 1,
1250 KGGuiFocusedFlags_AnyWindow = 1 << 2,
1251 KGGuiFocusedFlags_NoPopupHierarchy = 1 << 3,
1252 KGGuiFocusedFlags_DockHierarchy = 1 << 4,
1253 KGGuiFocusedFlags_RootAndChildWindows = KGGuiFocusedFlags_RootWindow | KGGuiFocusedFlags_ChildWindows,
1259enum KGGuiHoveredFlags_
1261 KGGuiHoveredFlags_None = 0,
1262 KGGuiHoveredFlags_ChildWindows = 1 << 0,
1263 KGGuiHoveredFlags_RootWindow = 1 << 1,
1264 KGGuiHoveredFlags_AnyWindow = 1 << 2,
1265 KGGuiHoveredFlags_NoPopupHierarchy = 1 << 3,
1266 KGGuiHoveredFlags_DockHierarchy = 1 << 4,
1267 KGGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5,
1269 KGGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7,
1270 KGGuiHoveredFlags_AllowWhenOverlapped = 1 << 8,
1271 KGGuiHoveredFlags_AllowWhenDisabled = 1 << 9,
1272 KGGuiHoveredFlags_NoNavOverride = 1 << 10,
1273 KGGuiHoveredFlags_RectOnly = KGGuiHoveredFlags_AllowWhenBlockedByPopup | KGGuiHoveredFlags_AllowWhenBlockedByActiveItem | KGGuiHoveredFlags_AllowWhenOverlapped,
1274 KGGuiHoveredFlags_RootAndChildWindows = KGGuiHoveredFlags_RootWindow | KGGuiHoveredFlags_ChildWindows,
1277 KGGuiHoveredFlags_DelayNormal = 1 << 11,
1278 KGGuiHoveredFlags_DelayShort = 1 << 12,
1279 KGGuiHoveredFlags_NoSharedDelay = 1 << 13,
1285enum KGGuiDockNodeFlags_
1287 KGGuiDockNodeFlags_None = 0,
1288 KGGuiDockNodeFlags_KeepAliveOnly = 1 << 0,
1290 KGGuiDockNodeFlags_NoDockingInCentralNode = 1 << 2,
1291 KGGuiDockNodeFlags_PassthruCentralNode = 1 << 3,
1292 KGGuiDockNodeFlags_NoSplit = 1 << 4,
1293 KGGuiDockNodeFlags_NoResize = 1 << 5,
1294 KGGuiDockNodeFlags_AutoHideTabBar = 1 << 6,
1298enum KGGuiDragDropFlags_
1300 KGGuiDragDropFlags_None = 0,
1302 KGGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0,
1303 KGGuiDragDropFlags_SourceNoDisableHover = 1 << 1,
1304 KGGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2,
1305 KGGuiDragDropFlags_SourceAllowNullID = 1 << 3,
1306 KGGuiDragDropFlags_SourceExtern = 1 << 4,
1307 KGGuiDragDropFlags_SourceAutoExpirePayload = 1 << 5,
1309 KGGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10,
1310 KGGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11,
1311 KGGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12,
1312 KGGuiDragDropFlags_AcceptPeekOnly = KGGuiDragDropFlags_AcceptBeforeDelivery | KGGuiDragDropFlags_AcceptNoDrawDefaultRect,
1316#define KARMAGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F"
1317#define KARMAGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F"
1330 KGGuiDataType_Float,
1331 KGGuiDataType_Double,
1347enum KGGuiSortDirection_
1349 KGGuiSortDirection_None = 0,
1350 KGGuiSortDirection_Ascending = 1,
1351 KGGuiSortDirection_Descending = 2
1358enum KarmaGuiKey :
int
1364 KGGuiKey_RightArrow,
1377 KGGuiKey_LeftCtrl, KGGuiKey_LeftShift, KGGuiKey_LeftAlt, KGGuiKey_LeftSuper,
1378 KGGuiKey_RightCtrl, KGGuiKey_RightShift, KGGuiKey_RightAlt, KGGuiKey_RightSuper,
1380 KGGuiKey_0, KGGuiKey_1, KGGuiKey_2, KGGuiKey_3, KGGuiKey_4, KGGuiKey_5, KGGuiKey_6, KGGuiKey_7, KGGuiKey_8, KGGuiKey_9,
1381 KGGuiKey_A, KGGuiKey_B, KGGuiKey_C, KGGuiKey_D, KGGuiKey_E, KGGuiKey_F, KGGuiKey_G, KGGuiKey_H, KGGuiKey_I, KGGuiKey_J,
1382 KGGuiKey_K, KGGuiKey_L, KGGuiKey_M, KGGuiKey_N, KGGuiKey_O, KGGuiKey_P, KGGuiKey_Q, KGGuiKey_R, KGGuiKey_S, KGGuiKey_T,
1383 KGGuiKey_U, KGGuiKey_V, KGGuiKey_W, KGGuiKey_X, KGGuiKey_Y, KGGuiKey_Z,
1384 KGGuiKey_F1, KGGuiKey_F2, KGGuiKey_F3, KGGuiKey_F4, KGGuiKey_F5, KGGuiKey_F6,
1385 KGGuiKey_F7, KGGuiKey_F8, KGGuiKey_F9, KGGuiKey_F10, KGGuiKey_F11, KGGuiKey_F12,
1386 KGGuiKey_Apostrophe,
1393 KGGuiKey_LeftBracket,
1395 KGGuiKey_RightBracket,
1396 KGGuiKey_GraveAccent,
1398 KGGuiKey_ScrollLock,
1400 KGGuiKey_PrintScreen,
1402 KGGuiKey_Keypad0, KGGuiKey_Keypad1, KGGuiKey_Keypad2, KGGuiKey_Keypad3, KGGuiKey_Keypad4,
1403 KGGuiKey_Keypad5, KGGuiKey_Keypad6, KGGuiKey_Keypad7, KGGuiKey_Keypad8, KGGuiKey_Keypad9,
1404 KGGuiKey_KeypadDecimal,
1405 KGGuiKey_KeypadDivide,
1406 KGGuiKey_KeypadMultiply,
1407 KGGuiKey_KeypadSubtract,
1409 KGGuiKey_KeypadEnter,
1410 KGGuiKey_KeypadEqual,
1414 KGGuiKey_GamepadStart,
1415 KGGuiKey_GamepadBack,
1416 KGGuiKey_GamepadFaceLeft,
1417 KGGuiKey_GamepadFaceRight,
1418 KGGuiKey_GamepadFaceUp,
1419 KGGuiKey_GamepadFaceDown,
1420 KGGuiKey_GamepadDpadLeft,
1421 KGGuiKey_GamepadDpadRight,
1422 KGGuiKey_GamepadDpadUp,
1423 KGGuiKey_GamepadDpadDown,
1430 KGGuiKey_GamepadLStickLeft,
1431 KGGuiKey_GamepadLStickRight,
1432 KGGuiKey_GamepadLStickUp,
1433 KGGuiKey_GamepadLStickDown,
1434 KGGuiKey_GamepadRStickLeft,
1435 KGGuiKey_GamepadRStickRight,
1436 KGGuiKey_GamepadRStickUp,
1437 KGGuiKey_GamepadRStickDown,
1441 KGGuiKey_MouseLeft, KGGuiKey_MouseRight, KGGuiKey_MouseMiddle, KGGuiKey_MouseX1, KGGuiKey_MouseX2, KGGuiKey_MouseWheelX, KGGuiKey_MouseWheelY,
1444 KGGuiKey_ReservedForModCtrl, KGGuiKey_ReservedForModShift, KGGuiKey_ReservedForModAlt, KGGuiKey_ReservedForModSuper,
1456 KGGuiMod_Ctrl = 1 << 12,
1457 KGGuiMod_Shift = 1 << 13,
1458 KGGuiMod_Alt = 1 << 14,
1459 KGGuiMod_Super = 1 << 15,
1460 KGGuiMod_Shortcut = 1 << 11,
1461 KGGuiMod_Mask_ = 0xF800,
1465 KGGuiKey_NamedKey_BEGIN = 512,
1466 KGGuiKey_NamedKey_END = KGGuiKey_COUNT,
1467 KGGuiKey_NamedKey_COUNT = KGGuiKey_NamedKey_END - KGGuiKey_NamedKey_BEGIN,
1468#ifdef KARMAGUI_DISABLE_OBSOLETE_KEYIO
1469 KGGuiKey_KeysData_SIZE = KGGuiKey_NamedKey_COUNT,
1470 KGGuiKey_KeysData_OFFSET = KGGuiKey_NamedKey_BEGIN,
1472 KGGuiKey_KeysData_SIZE = KGGuiKey_COUNT,
1473 KGGuiKey_KeysData_OFFSET = 0,
1476#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1477 KGGuiKey_ModCtrl = KGGuiMod_Ctrl, KGGuiKey_ModShift = KGGuiMod_Shift, KGGuiKey_ModAlt = KGGuiMod_Alt, KGGuiKey_ModSuper = KGGuiMod_Super,
1478 KGGuiKey_KeyPadEnter = KGGuiKey_KeypadEnter,
1484enum KGGuiInputFlags_
1486 KGGuiInputFlags_None = 0,
1487 KGGuiInputFlags_Repeat = 1 << 0,
1500 KGGuiInputFlags_RouteFocused = 1 << 8,
1501 KGGuiInputFlags_RouteGlobalLow = 1 << 9,
1502 KGGuiInputFlags_RouteGlobal = 1 << 10,
1503 KGGuiInputFlags_RouteGlobalHigh = 1 << 11,
1504 KGGuiInputFlags_RouteAlways = 1 << 12,
1507 KGGuiInputFlags_RouteUnlessBgFocused= 1 << 13,
1510#ifndef KARMAGUI_DISABLE_OBSOLETE_KEYIO
1516 KGGuiNavInput_Activate, KGGuiNavInput_Cancel, KGGuiNavInput_Input, KGGuiNavInput_Menu, KGGuiNavInput_DpadLeft, KGGuiNavInput_DpadRight, KGGuiNavInput_DpadUp, KGGuiNavInput_DpadDown,
1517 KGGuiNavInput_LStickLeft, KGGuiNavInput_LStickRight, KGGuiNavInput_LStickUp, KGGuiNavInput_LStickDown, KGGuiNavInput_FocusPrev, KGGuiNavInput_FocusNext, KGGuiNavInput_TweakSlow, KGGuiNavInput_TweakFast,
1518 KGGuiNavInput_COUNT,
1523enum KGGuiConfigFlags_
1525 KGGuiConfigFlags_None = 0,
1526 KGGuiConfigFlags_NavEnableKeyboard = 1 << 0,
1527 KGGuiConfigFlags_NavEnableGamepad = 1 << 1,
1528 KGGuiConfigFlags_NavEnableSetMousePos = 1 << 2,
1529 KGGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3,
1530 KGGuiConfigFlags_NoMouse = 1 << 4,
1531 KGGuiConfigFlags_NoMouseCursorChange = 1 << 5,
1534 KGGuiConfigFlags_DockingEnable = 1 << 6,
1538 KGGuiConfigFlags_ViewportsEnable = 1 << 10,
1539 KGGuiConfigFlags_DpiEnableScaleViewports= 1 << 14,
1540 KGGuiConfigFlags_DpiEnableScaleFonts = 1 << 15,
1543 KGGuiConfigFlags_IsSRGB = 1 << 20,
1544 KGGuiConfigFlags_IsTouchScreen = 1 << 21,
1548enum KGGuiBackendFlags_
1550 KGGuiBackendFlags_None = 0,
1551 KGGuiBackendFlags_HasGamepad = 1 << 0,
1552 KGGuiBackendFlags_HasMouseCursors = 1 << 1,
1553 KGGuiBackendFlags_HasSetMousePos = 1 << 2,
1554 KGGuiBackendFlags_RendererHasVtxOffset = 1 << 3,
1557 KGGuiBackendFlags_PlatformHasViewports = 1 << 10,
1558 KGGuiBackendFlags_HasMouseHoveredViewport=1 << 11,
1559 KGGuiBackendFlags_RendererHasViewports = 1 << 12,
1566 KGGuiCol_TextDisabled,
1571 KGGuiCol_BorderShadow,
1573 KGGuiCol_FrameBgHovered,
1574 KGGuiCol_FrameBgActive,
1576 KGGuiCol_TitleBgActive,
1577 KGGuiCol_TitleBgCollapsed,
1579 KGGuiCol_ScrollbarBg,
1580 KGGuiCol_ScrollbarGrab,
1581 KGGuiCol_ScrollbarGrabHovered,
1582 KGGuiCol_ScrollbarGrabActive,
1584 KGGuiCol_SliderGrab,
1585 KGGuiCol_SliderGrabActive,
1587 KGGuiCol_ButtonHovered,
1588 KGGuiCol_ButtonActive,
1590 KGGuiCol_HeaderHovered,
1591 KGGuiCol_HeaderActive,
1593 KGGuiCol_SeparatorHovered,
1594 KGGuiCol_SeparatorActive,
1595 KGGuiCol_ResizeGrip,
1596 KGGuiCol_ResizeGripHovered,
1597 KGGuiCol_ResizeGripActive,
1599 KGGuiCol_TabHovered,
1601 KGGuiCol_TabUnfocused,
1602 KGGuiCol_TabUnfocusedActive,
1603 KGGuiCol_DockingPreview,
1604 KGGuiCol_DockingEmptyBg,
1606 KGGuiCol_PlotLinesHovered,
1607 KGGuiCol_PlotHistogram,
1608 KGGuiCol_PlotHistogramHovered,
1609 KGGuiCol_TableHeaderBg,
1610 KGGuiCol_TableBorderStrong,
1611 KGGuiCol_TableBorderLight,
1612 KGGuiCol_TableRowBg,
1613 KGGuiCol_TableRowBgAlt,
1614 KGGuiCol_TextSelectedBg,
1615 KGGuiCol_DragDropTarget,
1616 KGGuiCol_NavHighlight,
1617 KGGuiCol_NavWindowingHighlight,
1618 KGGuiCol_NavWindowingDimBg,
1619 KGGuiCol_ModalWindowDimBg,
1633 KGGuiStyleVar_Alpha,
1634 KGGuiStyleVar_DisabledAlpha,
1635 KGGuiStyleVar_WindowPadding,
1636 KGGuiStyleVar_WindowRounding,
1637 KGGuiStyleVar_WindowBorderSize,
1638 KGGuiStyleVar_WindowMinSize,
1639 KGGuiStyleVar_WindowTitleAlign,
1640 KGGuiStyleVar_ChildRounding,
1641 KGGuiStyleVar_ChildBorderSize,
1642 KGGuiStyleVar_PopupRounding,
1643 KGGuiStyleVar_PopupBorderSize,
1644 KGGuiStyleVar_FramePadding,
1645 KGGuiStyleVar_FrameRounding,
1646 KGGuiStyleVar_FrameBorderSize,
1647 KGGuiStyleVar_ItemSpacing,
1648 KGGuiStyleVar_ItemInnerSpacing,
1649 KGGuiStyleVar_IndentSpacing,
1650 KGGuiStyleVar_CellPadding,
1651 KGGuiStyleVar_ScrollbarSize,
1652 KGGuiStyleVar_ScrollbarRounding,
1653 KGGuiStyleVar_GrabMinSize,
1654 KGGuiStyleVar_GrabRounding,
1655 KGGuiStyleVar_TabRounding,
1656 KGGuiStyleVar_ButtonTextAlign,
1657 KGGuiStyleVar_SelectableTextAlign,
1662enum KGGuiButtonFlags_
1664 KGGuiButtonFlags_None = 0,
1665 KGGuiButtonFlags_MouseButtonLeft = 1 << 0,
1666 KGGuiButtonFlags_MouseButtonRight = 1 << 1,
1667 KGGuiButtonFlags_MouseButtonMiddle = 1 << 2,
1670 KGGuiButtonFlags_MouseButtonMask_ = KGGuiButtonFlags_MouseButtonLeft | KGGuiButtonFlags_MouseButtonRight | KGGuiButtonFlags_MouseButtonMiddle,
1671 KGGuiButtonFlags_MouseButtonDefault_ = KGGuiButtonFlags_MouseButtonLeft,
1675enum KGGuiColorEditFlags_
1677 KGGuiColorEditFlags_None = 0,
1678 KGGuiColorEditFlags_NoAlpha = 1 << 1,
1679 KGGuiColorEditFlags_NoPicker = 1 << 2,
1680 KGGuiColorEditFlags_NoOptions = 1 << 3,
1681 KGGuiColorEditFlags_NoSmallPreview = 1 << 4,
1682 KGGuiColorEditFlags_NoInputs = 1 << 5,
1683 KGGuiColorEditFlags_NoTooltip = 1 << 6,
1684 KGGuiColorEditFlags_NoLabel = 1 << 7,
1685 KGGuiColorEditFlags_NoSidePreview = 1 << 8,
1686 KGGuiColorEditFlags_NoDragDrop = 1 << 9,
1687 KGGuiColorEditFlags_NoBorder = 1 << 10,
1690 KGGuiColorEditFlags_AlphaBar = 1 << 16,
1691 KGGuiColorEditFlags_AlphaPreview = 1 << 17,
1692 KGGuiColorEditFlags_AlphaPreviewHalf= 1 << 18,
1693 KGGuiColorEditFlags_HDR = 1 << 19,
1694 KGGuiColorEditFlags_DisplayRGB = 1 << 20,
1695 KGGuiColorEditFlags_DisplayHSV = 1 << 21,
1696 KGGuiColorEditFlags_DisplayHex = 1 << 22,
1697 KGGuiColorEditFlags_Uint8 = 1 << 23,
1698 KGGuiColorEditFlags_Float = 1 << 24,
1699 KGGuiColorEditFlags_PickerHueBar = 1 << 25,
1700 KGGuiColorEditFlags_PickerHueWheel = 1 << 26,
1701 KGGuiColorEditFlags_InputRGB = 1 << 27,
1702 KGGuiColorEditFlags_InputHSV = 1 << 28,
1706 KGGuiColorEditFlags_DefaultOptions_ = KGGuiColorEditFlags_Uint8 | KGGuiColorEditFlags_DisplayRGB | KGGuiColorEditFlags_InputRGB | KGGuiColorEditFlags_PickerHueBar,
1709 KGGuiColorEditFlags_DisplayMask_ = KGGuiColorEditFlags_DisplayRGB | KGGuiColorEditFlags_DisplayHSV | KGGuiColorEditFlags_DisplayHex,
1710 KGGuiColorEditFlags_DataTypeMask_ = KGGuiColorEditFlags_Uint8 | KGGuiColorEditFlags_Float,
1711 KGGuiColorEditFlags_PickerMask_ = KGGuiColorEditFlags_PickerHueWheel | KGGuiColorEditFlags_PickerHueBar,
1712 KGGuiColorEditFlags_InputMask_ = KGGuiColorEditFlags_InputRGB | KGGuiColorEditFlags_InputHSV,
1721enum KGGuiSliderFlags_
1723 KGGuiSliderFlags_None = 0,
1724 KGGuiSliderFlags_AlwaysClamp = 1 << 4,
1725 KGGuiSliderFlags_Logarithmic = 1 << 5,
1726 KGGuiSliderFlags_NoRoundToFormat = 1 << 6,
1727 KGGuiSliderFlags_NoInput = 1 << 7,
1728 KGGuiSliderFlags_InvalidMask_ = 0x7000000F,
1731#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1732 KGGuiSliderFlags_ClampOnInput = KGGuiSliderFlags_AlwaysClamp,
1738enum KGGuiMouseButton_
1740 KGGuiMouseButton_Left = 0,
1741 KGGuiMouseButton_Right = 1,
1742 KGGuiMouseButton_Middle = 2,
1743 KGGuiMouseButton_COUNT = 5
1748enum KGGuiMouseCursor_
1750 KGGuiMouseCursor_None = -1,
1751 KGGuiMouseCursor_Arrow = 0,
1752 KGGuiMouseCursor_TextInput,
1753 KGGuiMouseCursor_ResizeAll,
1754 KGGuiMouseCursor_ResizeNS,
1755 KGGuiMouseCursor_ResizeEW,
1756 KGGuiMouseCursor_ResizeNESW,
1757 KGGuiMouseCursor_ResizeNWSE,
1758 KGGuiMouseCursor_Hand,
1759 KGGuiMouseCursor_NotAllowed,
1760 KGGuiMouseCursor_COUNT
1769 KGGuiCond_Always = 1 << 0,
1770 KGGuiCond_Once = 1 << 1,
1771 KGGuiCond_FirstUseEver = 1 << 2,
1772 KGGuiCond_Appearing = 1 << 3,
1786inline void*
operator new(size_t,
KGNewWrapper,
void* ptr) {
return ptr; }
1787inline void operator delete(
void*,
KGNewWrapper,
void*) {}
1788#define KG_ALLOC(_SIZE) Karma::KarmaGui::MemAlloc(_SIZE)
1789#define KG_FREE(_PTR) Karma::KarmaGui::MemFree(_PTR)
1790#define KG_PLACEMENT_NEW(_PTR) new(KGNewWrapper(), _PTR)
1791#define KG_NEW(_TYPE) new(KGNewWrapper(), Karma::KarmaGui::MemAlloc(sizeof(_TYPE))) _TYPE
1813 typedef T value_type;
1814 typedef value_type* iterator;
1815 typedef const value_type* const_iterator;
1818 inline KGVector() { Size = Capacity = 0; Data = NULL; }
1819 inline KGVector(
const KGVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
1820 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; }
1821 inline ~KGVector() {
if (Data) KG_FREE(Data); }
1823 inline void clear() {
if (Data) { Size = Capacity = 0; KG_FREE(Data); Data = NULL; } }
1824 inline void clear_delete() {
for (
int n = 0; n < Size; n++) KG_DELETE(Data[n]); clear(); }
1825 inline void clear_destruct() {
for (
int n = 0; n < Size; n++) Data[n].~T(); clear(); }
1827 inline bool empty()
const {
return Size == 0; }
1828 inline int size()
const {
return Size; }
1829 inline int size_in_bytes()
const {
return Size * (int)
sizeof(T); }
1830 inline int max_size()
const {
return 0x7FFFFFFF / (int)
sizeof(T); }
1831 inline int capacity()
const {
return Capacity; }
1832 inline T& operator[](
int i) { KR_CORE_ASSERT(i >= 0 && i < Size,
"");
return Data[i]; }
1833 inline const T& operator[](
int i)
const { KR_CORE_ASSERT(i >= 0 && i < Size,
"");
return Data[i]; }
1835 inline T* begin() {
return Data; }
1836 inline const T* begin()
const {
return Data; }
1837 inline T* end() {
return Data + Size; }
1838 inline const T* end()
const {
return Data + Size; }
1839 inline T& front() { KR_CORE_ASSERT(Size > 0,
"");
return Data[0]; }
1840 inline const T& front()
const { KR_CORE_ASSERT(Size > 0,
"");
return Data[0]; }
1841 inline T& back() { KR_CORE_ASSERT(Size > 0,
"");
return Data[Size - 1]; }
1842 inline const T& back()
const { KR_CORE_ASSERT(Size > 0,
"");
return Data[Size - 1]; }
1843 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; }
1845 inline int _grow_capacity(
int sz)
const {
int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8;
return new_capacity > sz ? new_capacity : sz; }
1846 inline void resize(
int new_size) {
if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
1847 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; }
1848 inline void shrink(
int new_size) { KR_CORE_ASSERT(new_size <= Size,
""); Size = new_size; }
1849 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; }
1850 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; }
1853 inline void push_back(
const T& v) {
if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v,
sizeof(v)); Size++; }
1854 inline void pop_back() { KR_CORE_ASSERT(Size > 0,
""); Size--; }
1855 inline void push_front(
const T& v) {
if (Size == 0) push_back(v);
else insert(Data, v); }
1856 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; }
1857 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; }
1858 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; }
1859 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; }
1860 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; }
1861 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; }
1862 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; }
1863 inline bool find_erase(
const T& v) {
const T* it = find(v);
if (it < Data + Size) { erase(it);
return true; }
return false; }
1864 inline bool find_erase_unsorted(
const T& v) {
const T* it = find(v);
if (it < Data + Size) { erase_unsorted(it);
return true; }
return false; }
1865 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; }
1879 float DisabledAlpha;
1881 float WindowRounding;
1882 float WindowBorderSize;
1885 KarmaGuiDir WindowMenuButtonPosition;
1886 float ChildRounding;
1887 float ChildBorderSize;
1888 float PopupRounding;
1889 float PopupBorderSize;
1891 float FrameRounding;
1892 float FrameBorderSize;
1896 KGVec2 TouchExtraPadding;
1897 float IndentSpacing;
1898 float ColumnsMinSpacing;
1899 float ScrollbarSize;
1900 float ScrollbarRounding;
1903 float LogSliderDeadzone;
1905 float TabBorderSize;
1906 float TabMinWidthForCloseButton;
1907 KarmaGuiDir ColorButtonPosition;
1909 KGVec2 SelectableTextAlign;
1910 KGVec2 DisplayWindowPadding;
1911 KGVec2 DisplaySafeAreaPadding;
1912 float MouseCursorScale;
1913 bool AntiAliasedLines;
1914 bool AntiAliasedLinesUseTex;
1915 bool AntiAliasedFill;
1916 float CurveTessellationTol;
1917 float CircleTessellationMaxError;
1918 KGVec4 Colors[KGGuiCol_COUNT];
1921 void ScaleAllSizes(
float scale_factor);
1937 float DownDurationPrev;
1947 KarmaGuiConfigFlags ConfigFlags;
1948 KarmaGuiBackendFlags BackendFlags;
1951 float IniSavingRate;
1952 const char* IniFilename;
1953 const char* LogFilename;
1954 float MouseDoubleClickTime;
1955 float MouseDoubleClickMaxDist;
1956 float MouseDragThreshold;
1957 float KeyRepeatDelay;
1958 float KeyRepeatRate;
1959 float HoverDelayNormal;
1960 float HoverDelayShort;
1964 float FontGlobalScale;
1965 bool FontAllowUserScaling;
1967 KGVec2 DisplayFramebufferScale;
1970 bool ConfigDockingNoSplit;
1971 bool ConfigDockingWithShift;
1972 bool ConfigDockingAlwaysTabBar;
1973 bool ConfigDockingTransparentPayload;
1976 bool ConfigViewportsNoAutoMerge;
1977 bool ConfigViewportsNoTaskBarIcon;
1978 bool ConfigViewportsNoDecoration;
1979 bool ConfigViewportsNoDefaultParent;
1982 bool MouseDrawCursor;
1983 bool ConfigMacOSXBehaviors;
1984 bool ConfigInputTrickleEventQueue;
1985 bool ConfigInputTextCursorBlink;
1986 bool ConfigInputTextEnterKeepActive;
1987 bool ConfigDragClickToInputText;
1988 bool ConfigWindowsResizeFromEdges;
1989 bool ConfigWindowsMoveFromTitleBarOnly;
1990 float ConfigMemoryCompactTimer;
1998 const char* BackendPlatformName;
1999 const char* BackendRendererName;
2000 void* BackendPlatformUserData;
2001 void* BackendRendererUserData;
2002 void* BackendLanguageUserData;
2006 const char* (*GetClipboardTextFn)(
void* user_data);
2007 void (*SetClipboardTextFn)(
void* user_data,
const char* text);
2008 void* ClipboardUserData;
2013#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2014 void* ImeWindowHandle;
2016 void* _UnusedPadding;
2024 void AddKeyEvent(KarmaGuiKey key,
bool down);
2025 void AddKeyAnalogEvent(KarmaGuiKey key,
bool down,
float v);
2026 void AddMousePosEvent(
float x,
float y);
2027 void AddMouseButtonEvent(
int button,
bool down);
2028 void AddMouseWheelEvent(
float wh_x,
float wh_y);
2029 void AddMouseViewportEvent(KGGuiID
id);
2030 void AddFocusEvent(
bool focused);
2031 void AddInputCharacter(
unsigned int c);
2032 void AddInputCharacterUTF16(KGWchar16 c);
2033 void AddInputCharactersUTF8(
const char* str);
2035 void SetKeyEventNativeData(KarmaGuiKey key,
int native_keycode,
int native_scancode,
int native_legacy_index = -1);
2036 void SetAppAcceptingEvents(
bool accepting_events);
2037 void ClearInputCharacters();
2038 void ClearInputKeys();
2046 bool WantCaptureMouse;
2047 bool WantCaptureKeyboard;
2049 bool WantSetMousePos;
2050 bool WantSaveIniSettings;
2054 int MetricsRenderVertices;
2055 int MetricsRenderIndices;
2056 int MetricsRenderWindows;
2057 int MetricsActiveWindows;
2058 int MetricsActiveAllocations;
2064#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
2065 int KeyMap[KGGuiKey_COUNT];
2066 bool KeysDown[KGGuiKey_COUNT];
2067 float NavInputs[KGGuiNavInput_COUNT];
2081 KGGuiID MouseHoveredViewport;
2088 KarmaGuiKeyChord KeyMods;
2090 bool WantCaptureMouseUnlessPopupClose;
2092 KGVec2 MouseClickedPos[5];
2093 double MouseClickedTime[5];
2094 bool MouseClicked[5];
2095 bool MouseDoubleClicked[5];
2096 KGU16 MouseClickedCount[5];
2097 KGU16 MouseClickedLastCount[5];
2098 bool MouseReleased[5];
2099 bool MouseDownOwned[5];
2100 bool MouseDownOwnedUnlessPopupClose[5];
2101 float MouseDownDuration[5];
2102 float MouseDownDurationPrev[5];
2103 KGVec2 MouseDragMaxDistanceAbs[5];
2104 float MouseDragMaxDistanceSqr[5];
2107 bool AppAcceptingEvents;
2108 KGS8 BackendUsingLegacyKeyArrays;
2109 bool BackendUsingLegacyNavInputArray;
2110 KGWchar16 InputQueueSurrogate;
2131 KarmaGuiInputTextFlags EventFlag;
2132 KarmaGuiInputTextFlags Flags;
2139 KarmaGuiKey EventKey;
2150 KarmaGuiInputTextCallbackData();
2151 void DeleteChars(
int pos,
int bytes_count);
2152 void InsertChars(
int pos,
const char* text,
const char* text_end = NULL);
2153 void SelectAll() { SelectionStart = 0; SelectionEnd = BufTextLen; }
2154 void ClearSelection() { SelectionStart = SelectionEnd = BufTextLen; }
2155 bool HasSelection()
const {
return SelectionStart != SelectionEnd; }
2178 KGGuiID ParentViewportId;
2179 KarmaGuiViewportFlags ViewportFlagsOverrideSet;
2180 KarmaGuiViewportFlags ViewportFlagsOverrideClear;
2181 KarmaGuiTabItemFlags TabItemFlagsOverrideSet;
2182 KarmaGuiDockNodeFlags DockNodeFlagsOverrideSet;
2183 bool DockingAlwaysTabBar;
2184 bool DockingAllowUnclassed;
2186 KarmaGuiWindowClass() { memset(
this, 0,
sizeof(*
this)); ParentViewportId = (KGGuiID)-1; DockingAllowUnclassed =
true; }
2198 KGGuiID SourceParentId;
2200 char DataType[32 + 1];
2204 KarmaGuiPayload() { Clear(); }
2205 void Clear() { SourceId = SourceParentId = 0; Data = NULL; DataSize = 0; memset(DataType, 0,
sizeof(DataType)); DataFrameCount = -1; Preview = Delivery =
false; }
2206 bool IsDataType(
const char* type)
const {
return DataFrameCount != -1 && strcmp(type, DataType) == 0; }
2207 bool IsPreview()
const {
return Preview; }
2208 bool IsDelivery()
const {
return Delivery; }
2214 KGGuiID ColumnUserID;
2217 KarmaGuiSortDirection SortDirection : 8;
2219 KarmaGuiTableColumnSortSpecs() { memset(
this, 0,
sizeof(*
this)); }
2232 KarmaGuiTableSortSpecs() { memset(
this, 0,
sizeof(*
this)); }
2240#define KG_UNICODE_CODEPOINT_INVALID 0xFFFD
2241#define KG_UNICODE_CODEPOINT_MAX 0xFFFF
2248 KarmaGuiOnceUponAFrame() { RefFrame = -1; }
2249 mutable int RefFrame;
2250 operator bool()
const {
int current_frame = Karma::KarmaGui::GetFrameCount();
if (RefFrame == current_frame)
return false; RefFrame = current_frame;
return true; }
2256 KarmaGuiTextFilter(
const char* default_filter =
"");
2257 bool Draw(
const char* label =
"Filter (inc,-exc)",
float width = 0.0f);
2258 bool PassFilter(
const char* text,
const char* text_end = NULL)
const;
2260 void Clear() { InputBuf[0] = 0; Build(); }
2261 bool IsActive()
const {
return !Filters.empty(); }
2269 ImGuiTextRange() { b = e = NULL; }
2270 ImGuiTextRange(
const char* _b,
const char* _e) { b = _b; e = _e; }
2271 bool empty()
const {
return b == e; }
2284 static char EmptyString[1];
2286 KarmaGuiTextBuffer() { }
2287 inline char operator[](
int i)
const { KR_CORE_ASSERT(Buf.Data != NULL,
"");
return Buf.Data[i]; }
2288 const char* begin()
const {
return Buf.Data ? &Buf.front() : EmptyString; }
2289 const char* end()
const {
return Buf.Data ? &Buf.back() : EmptyString; }
2290 int size()
const {
return Buf.Size ? Buf.Size - 1 : 0; }
2291 bool empty()
const {
return Buf.Size <= 1; }
2292 void clear() { Buf.clear(); }
2293 void reserve(
int capacity) { Buf.reserve(capacity); }
2294 const char* c_str()
const {
return Buf.Data ? Buf.Data : EmptyString; }
2295 void append(
const char* str,
const char* str_end = NULL);
2296 void appendf(
const char* fmt, ...) KG_FMTARGS(2);
2297 void appendfv(
const char* fmt, va_list args) KG_FMTLIST(2);
2311 struct ImGuiStoragePair
2314 union {
int val_i;
float val_f;
void* val_p; };
2315 ImGuiStoragePair(KGGuiID _key,
int _val_i) { key = _key; val_i = _val_i; }
2316 ImGuiStoragePair(KGGuiID _key,
float _val_f) { key = _key; val_f = _val_f; }
2317 ImGuiStoragePair(KGGuiID _key,
void* _val_p) { key = _key; val_p = _val_p; }
2325 void Clear() { Data.clear(); }
2326 int GetInt(KGGuiID key,
int default_val = 0)
const;
2327 void SetInt(KGGuiID key,
int val);
2328 bool GetBool(KGGuiID key,
bool default_val =
false)
const;
2329 void SetBool(KGGuiID key,
bool val);
2330 float GetFloat(KGGuiID key,
float default_val = 0.0f)
const;
2331 void SetFloat(KGGuiID key,
float val);
2332 void* GetVoidPtr(KGGuiID key)
const;
2333 void SetVoidPtr(KGGuiID key,
void* val);
2339 int* GetIntRef(KGGuiID key,
int default_val = 0);
2340 bool* GetBoolRef(KGGuiID key,
bool default_val =
false);
2341 float* GetFloatRef(KGGuiID key,
float default_val = 0.0f);
2342 void** GetVoidPtrRef(KGGuiID key,
void* default_val = NULL);
2345 void SetAllInt(
int val);
2348 void BuildSortByKey();
2382 KarmaGuiListClipper();
2383 ~KarmaGuiListClipper();
2384 void Begin(
int items_count,
float items_height = -1.0f);
2389 void ForceDisplayRangeByIndices(
int item_min,
int item_max);
2390 inline KarmaGuiListClipper(
int items_count,
float items_height = -1.0f) { memset(
this, 0,
sizeof(*
this)); ItemsCount = -1; Begin(items_count, items_height); }
2395#ifndef KG_COL32_R_SHIFT
2396#define KG_COL32_R_SHIFT 0
2397#define KG_COL32_G_SHIFT 8
2398#define KG_COL32_B_SHIFT 16
2399#define KG_COL32_A_SHIFT 24
2400#define KG_COL32_A_MASK 0xFF000000
2402#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))
2403#define KG_COL32_WHITE KG_COL32(255,255,255,255)
2404#define KG_COL32_BLACK KG_COL32(0,0,0,255)
2405#define KG_COL32_BLACK_TRANS KG_COL32(0,0,0,0)
2415 constexpr KGColor() { }
2416 constexpr KGColor(
float r,
float g,
float b,
float a = 1.0f) : Value(r, g, b, a) { }
2417 constexpr KGColor(
const KGVec4& col) : Value(col) {}
2418 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; }
2419 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; }
2420 inline operator KGU32()
const {
return Karma::KarmaGui::ColorConvertFloat4ToU32(Value); }
2421 inline operator KGVec4()
const {
return Value; }
2424 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; }
2425 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); }
2434#ifndef KG_DRAWLIST_TEX_LINES_WIDTH_MAX
2435#define KG_DRAWLIST_TEX_LINES_WIDTH_MAX (63)
2445#ifndef KGDrawCallback
2453#define KGDrawCallback_ResetRenderState (KGDrawCallback)(-1)
2463 KGTextureID TextureId;
2464 unsigned int VtxOffset;
2465 unsigned int IdxOffset;
2466 unsigned int ElemCount;
2467 KGDrawCallback UserCallback;
2468 void* UserCallbackData;
2470 KGDrawCmd() { memset(
this, 0,
sizeof(*
this)); }
2473 inline KGTextureID GetTexID()
const {
return TextureId; }
2478#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
2490IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
2497 KGTextureID TextureId;
2498 unsigned int VtxOffset;
2517 inline KGDrawListSplitter() { memset(
this, 0,
sizeof(*
this)); }
2518 inline ~KGDrawListSplitter() { ClearFreeMemory(); }
2519 inline void Clear() { _Current = 0; _Count = 1; }
2520 void ClearFreeMemory();
2521 void Split(
KGDrawList* draw_list,
int count);
2523 void SetCurrentChannel(
KGDrawList* draw_list,
int channel_idx);
2530 KGDrawFlags_None = 0,
2531 KGDrawFlags_Closed = 1 << 0,
2532 KGDrawFlags_RoundCornersTopLeft = 1 << 4,
2533 KGDrawFlags_RoundCornersTopRight = 1 << 5,
2534 KGDrawFlags_RoundCornersBottomLeft = 1 << 6,
2535 KGDrawFlags_RoundCornersBottomRight = 1 << 7,
2536 KGDrawFlags_RoundCornersNone = 1 << 8,
2537 KGDrawFlags_RoundCornersTop = KGDrawFlags_RoundCornersTopLeft | KGDrawFlags_RoundCornersTopRight,
2538 KGDrawFlags_RoundCornersBottom = KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersBottomRight,
2539 KGDrawFlags_RoundCornersLeft = KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersTopLeft,
2540 KGDrawFlags_RoundCornersRight = KGDrawFlags_RoundCornersBottomRight | KGDrawFlags_RoundCornersTopRight,
2541 KGDrawFlags_RoundCornersAll = KGDrawFlags_RoundCornersTopLeft | KGDrawFlags_RoundCornersTopRight | KGDrawFlags_RoundCornersBottomLeft | KGDrawFlags_RoundCornersBottomRight,
2542 KGDrawFlags_RoundCornersDefault_ = KGDrawFlags_RoundCornersAll,
2543 KGDrawFlags_RoundCornersMask_ = KGDrawFlags_RoundCornersAll | KGDrawFlags_RoundCornersNone,
2548enum KGDrawListFlags_
2550 KGDrawListFlags_None = 0,
2551 KGDrawListFlags_AntiAliasedLines = 1 << 0,
2552 KGDrawListFlags_AntiAliasedLinesUseTex = 1 << 1,
2553 KGDrawListFlags_AntiAliasedFill = 1 << 2,
2554 KGDrawListFlags_AllowVtxOffset = 1 << 3,
2576 KGDrawListFlags Flags;
2579 unsigned int _VtxCurrentIdx;
2581 const char* _OwnerName;
2583 KGDrawIdx* _IdxWritePtr;
2592 KGDrawList(
KGDrawListSharedData* shared_data) { memset(
this, 0,
sizeof(*
this)); _Data = shared_data; }
2594 ~KGDrawList() { _ClearFreeMemory(); }
2595 void PushClipRect(
const KGVec2& clip_rect_min,
const KGVec2& clip_rect_max,
bool intersect_with_current_clip_rect =
false);
2596 void PushClipRectFullScreen();
2598 void PushTextureID(KGTextureID texture_id);
2599 void PopTextureID();
2600 inline KGVec2 GetClipRectMin()
const {
const KGVec4& cr = _ClipRectStack.back();
return KGVec2(cr.x, cr.y); }
2601 inline KGVec2 GetClipRectMax()
const {
const KGVec4& cr = _ClipRectStack.back();
return KGVec2(cr.z, cr.w); }
2610 void AddLine(
const KGVec2& p1,
const KGVec2& p2, KGU32 col,
float thickness = 1.0f);
2611 void AddRect(
const KGVec2& p_min,
const KGVec2& p_max, KGU32 col,
float rounding = 0.0f, KGDrawFlags flags = 0,
float thickness = 1.0f);
2612 void AddRectFilled(
const KGVec2& p_min,
const KGVec2& p_max, KGU32 col,
float rounding = 0.0f, KGDrawFlags flags = 0);
2613 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);
2614 void AddQuad(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4, KGU32 col,
float thickness = 1.0f);
2616 void AddTriangle(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col,
float thickness = 1.0f);
2617 void AddTriangleFilled(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col);
2618 void AddCircle(
const KGVec2& center,
float radius, KGU32 col,
int num_segments = 0,
float thickness = 1.0f);
2619 void AddCircleFilled(
const KGVec2& center,
float radius, KGU32 col,
int num_segments = 0);
2620 void AddNgon(
const KGVec2& center,
float radius, KGU32 col,
int num_segments,
float thickness = 1.0f);
2621 void AddNgonFilled(
const KGVec2& center,
float radius, KGU32 col,
int num_segments);
2622 void AddText(
const KGVec2& pos, KGU32 col,
const char* text_begin,
const char* text_end = NULL);
2623 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);
2624 void AddPolyline(
const KGVec2* points,
int num_points, KGU32 col, KGDrawFlags flags,
float thickness);
2625 void AddConvexPolyFilled(
const KGVec2* points,
int num_points, KGU32 col);
2626 void AddBezierCubic(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4, KGU32 col,
float thickness,
int num_segments = 0);
2627 void AddBezierQuadratic(
const KGVec2& p1,
const KGVec2& p2,
const KGVec2& p3, KGU32 col,
float thickness,
int num_segments = 0);
2633 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);
2634 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);
2635 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);
2638 void SetWindowBackgroundColor(
KGVec4 bgColor);
2642 inline void PathClear() { _Path.Size = 0; }
2643 inline void PathLineTo(
const KGVec2& pos) { _Path.push_back(pos); }
2644 inline void PathLineToMergeDuplicate(
const KGVec2& pos) {
if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }
2645 inline void PathFillConvex(KGU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; }
2646 inline void PathStroke(KGU32 col, KGDrawFlags flags = 0,
float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, flags, thickness); _Path.Size = 0; }
2647 void PathArcTo(
const KGVec2& center,
float radius,
float a_min,
float a_max,
int num_segments = 0);
2648 void PathArcToFast(
const KGVec2& center,
float radius,
int a_min_of_12,
int a_max_of_12);
2649 void PathBezierCubicCurveTo(
const KGVec2& p2,
const KGVec2& p3,
const KGVec2& p4,
int num_segments = 0);
2650 void PathBezierQuadraticCurveTo(
const KGVec2& p2,
const KGVec2& p3,
int num_segments = 0);
2651 void PathRect(
const KGVec2& rect_min,
const KGVec2& rect_max,
float rounding = 0.0f, KGDrawFlags flags = 0);
2654 void AddCallback(KGDrawCallback callback,
void* callback_data);
2656 KGDrawList* CloneOutput()
const;
2664 inline void ChannelsSplit(
int count) { _Splitter.Split(
this, count); }
2665 inline void ChannelsMerge() { _Splitter.Merge(
this); }
2666 inline void ChannelsSetCurrent(
int n) { _Splitter.SetCurrentChannel(
this, n); }
2671 void PrimReserve(
int idx_count,
int vtx_count);
2672 void PrimUnreserve(
int idx_count,
int vtx_count);
2673 void PrimRect(
const KGVec2& a,
const KGVec2& b, KGU32 col);
2676 inline void PrimWriteVtx(
const KGVec2& pos,
const KGVec2& uv, KGU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
2677 inline void PrimWriteIdx(KGDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
2678 inline void PrimVtx(
const KGVec2& pos,
const KGVec2& uv, KGU32 col) { PrimWriteIdx((KGDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }
2681 void _ResetForNewFrame();
2682 void _ClearFreeMemory();
2683 void _PopUnusedDrawCmd();
2684 void _TryMergeDrawCmds();
2685 void _OnChangedClipRect();
2686 void _OnChangedTextureID();
2687 void _OnChangedVtxOffset();
2688 int _CalcCircleAutoSegmentCount(
float radius)
const;
2689 void _PathArcToFastEx(
const KGVec2& center,
float radius,
int a_min_sample,
int a_max_sample,
int a_step);
2690 void _PathArcToN(
const KGVec2& center,
float radius,
float a_min,
float a_max,
int num_segments);
2709 KGDrawData() { Clear(); }
2710 void Clear() { memset(
this, 0,
sizeof(*
this)); }
2711 void DeIndexAllBuffers();
2712 void ScaleClipRects(
const KGVec2& fb_scale);
2723 bool FontDataOwnedByAtlas;
2729 KGVec2 GlyphExtraSpacing;
2731 const KGWchar* GlyphRanges;
2732 float GlyphMinAdvanceX;
2733 float GlyphMaxAdvanceX;
2735 unsigned int FontBuilderFlags;
2736 float RasterizerMultiply;
2737 KGWchar EllipsisChar;
2750 unsigned int Colored : 1;
2751 unsigned int Visible : 1;
2752 unsigned int Codepoint : 30;
2754 float X0, Y0, X1, Y1;
2755 float U0, V0, U1, V1;
2764 KGFontGlyphRangesBuilder() { Clear(); }
2765 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); }
2766 inline bool GetBit(
size_t n)
const {
int off = (int)(n >> 5); KGU32 mask = 1u << (n & 31);
return (UsedChars[off] & mask) != 0; }
2767 inline void SetBit(
size_t n) {
int off = (int)(n >> 5); KGU32 mask = 1u << (n & 31); UsedChars[off] |= mask; }
2768 inline void AddChar(KGWchar c) { SetBit(c); }
2769 void AddText(
const char* text,
const char* text_end = NULL);
2770 void AddRanges(
const KGWchar* ranges);
2777 unsigned short Width, Height;
2778 unsigned short X, Y;
2779 unsigned int GlyphID;
2780 float GlyphAdvanceX;
2783 KGFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset =
KGVec2(0, 0); Font = NULL; }
2784 bool IsPacked()
const {
return X != 0xFFFF; }
2788enum KGFontAtlasFlags_
2790 KGFontAtlasFlags_None = 0,
2791 KGFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0,
2792 KGFontAtlasFlags_NoMouseCursors = 1 << 1,
2793 KGFontAtlasFlags_NoBakedLines = 1 << 2,
2819 KGFont* AddFontFromFileTTF(
const char* filename,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2820 KGFont* AddFontFromMemoryTTF(
void* font_data,
int font_size,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2821 KGFont* AddFontFromMemoryCompressedTTF(
const void* compressed_font_data,
int compressed_font_size,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2822 KGFont* AddFontFromMemoryCompressedBase85TTF(
const char* compressed_font_data_base85,
float size_pixels,
const KGFontConfig* font_cfg = NULL,
const KGWchar* glyph_ranges = NULL);
2823 void ClearInputData();
2824 void ClearTexData();
2834 void GetTexDataAsAlpha8(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2835 void GetTexDataAsRGBA32(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2836 bool IsBuilt()
const {
return Fonts.Size > 0 && TexReady; }
2837 void SetTexID(KGTextureID
id) { TexID = id; }
2846 static const KGWchar* GetGlyphRangesDefault();
2847 static const KGWchar* GetGlyphRangesGreek();
2848 static const KGWchar* GetGlyphRangesKorean();
2849 static const KGWchar* GetGlyphRangesJapanese();
2850 static const KGWchar* GetGlyphRangesChineseFull();
2851 static const KGWchar* GetGlyphRangesChineseSimplifiedCommon();
2852 static const KGWchar* GetGlyphRangesCyrillic();
2853 static const KGWchar* GetGlyphRangesThai();
2854 static const KGWchar* GetGlyphRangesVietnamese();
2867 int AddCustomRectRegular(
int width,
int height);
2868 int AddCustomRectFontGlyph(
KGFont* font, KGWchar
id,
int width,
int height,
float advance_x,
const KGVec2& offset =
KGVec2(0, 0));
2869 KGFontAtlasCustomRect* GetCustomRectByIndex(
int index) { KR_CORE_ASSERT(index >= 0,
"");
return &CustomRects[index]; }
2873 bool GetMouseCursorTexData(KarmaGuiMouseCursor cursor,
KGVec2* out_offset,
KGVec2* out_size,
KGVec2 out_uv_border[2],
KGVec2 out_uv_fill[2]);
2879 KGFontAtlasFlags Flags;
2881 int TexDesiredWidth;
2882 int TexGlyphPadding;
2889 bool TexPixelsUseColors;
2890 unsigned char* TexPixelsAlpha8;
2891 unsigned int* TexPixelsRGBA32;
2899 KGVec4 TexUvLines[KG_DRAWLIST_TEX_LINES_WIDTH_MAX + 1];
2903 unsigned int FontBuilderFlags;
2906 int PackIdMouseCursors;
2920 float FallbackAdvanceX;
2931 short ConfigDataCount;
2932 KGWchar FallbackChar;
2933 KGWchar EllipsisChar;
2935 bool DirtyLookupTables;
2937 float Ascent, Descent;
2938 int MetricsTotalSurface;
2939 KGU8 Used4kPagesMap[(KG_UNICODE_CODEPOINT_MAX+1)/4096/8];
2945 const KGFontGlyph*FindGlyphNoFallback(KGWchar c)
const;
2946 float GetCharAdvance(KGWchar c)
const {
return ((
int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; }
2947 bool IsLoaded()
const {
return ContainerAtlas != NULL; }
2948 const char* GetDebugName()
const {
return ConfigData ? ConfigData->Name :
"<unknown>"; }
2952 KGVec2 CalcTextSizeA(
float size,
float max_width,
float wrap_width,
const char* text_begin,
const char* text_end = NULL,
const char** remaining = NULL)
const;
2953 const char* CalcWordWrapPositionA(
float scale,
const char* text,
const char* text_end,
float wrap_width)
const;
2954 void RenderChar(
KGDrawList* draw_list,
float size,
const KGVec2& pos, KGU32 col, KGWchar c)
const;
2955 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;
2958 void BuildLookupTable();
2959 void ClearOutputData();
2960 void GrowIndex(
int new_size);
2961 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);
2962 void AddRemapChar(KGWchar dst, KGWchar src,
bool overwrite_dst =
true);
2963 void SetGlyphVisible(KGWchar c,
bool visible);
2964 bool IsGlyphRangeUnused(
unsigned int c_begin,
unsigned int c_last);
2972enum KGGuiViewportFlags_
2974 KGGuiViewportFlags_None = 0,
2975 KGGuiViewportFlags_IsPlatformWindow = 1 << 0,
2976 KGGuiViewportFlags_IsPlatformMonitor = 1 << 1,
2977 KGGuiViewportFlags_OwnedByApp = 1 << 2,
2978 KGGuiViewportFlags_NoDecoration = 1 << 3,
2979 KGGuiViewportFlags_NoTaskBarIcon = 1 << 4,
2980 KGGuiViewportFlags_NoFocusOnAppearing = 1 << 5,
2981 KGGuiViewportFlags_NoFocusOnClick = 1 << 6,
2982 KGGuiViewportFlags_NoInputs = 1 << 7,
2983 KGGuiViewportFlags_NoRendererClear = 1 << 8,
2984 KGGuiViewportFlags_TopMost = 1 << 9,
2985 KGGuiViewportFlags_Minimized = 1 << 10,
2986 KGGuiViewportFlags_NoAutoMerge = 1 << 11,
2987 KGGuiViewportFlags_CanHostOtherWindows = 1 << 12,
3007 KarmaGuiViewportFlags Flags;
3013 KGGuiID ParentViewportId;
3021 void* RendererUserData;
3022 void* PlatformUserData;
3023 void* PlatformHandle;
3024 void* PlatformHandleRaw;
3025 bool PlatformWindowCreated;
3026 bool PlatformRequestMove;
3027 bool PlatformRequestResize;
3028 bool PlatformRequestClose;
3030 KarmaGuiViewport() { memset(
this, 0,
sizeof(*
this)); }
3031 ~KarmaGuiViewport() { KR_CORE_ASSERT(PlatformUserData == NULL && RendererUserData == NULL,
""); }
3034 KGVec2 GetCenter()
const {
return KGVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); }
3035 KGVec2 GetWorkCenter()
const {
return KGVec2(WorkPos.x + WorkSize.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); }
3125 int (*Platform_CreateVkSurface)(
KarmaGuiViewport* vp, KGU64 vk_inst,
const void* vk_allocators, KGU64* out_vk_surface);
3172 KarmaGuiPlatformIO() { memset(
this, 0,
sizeof(*
this)); }
3179 KGVec2 MainPos, MainSize;
3180 KGVec2 WorkPos, WorkSize;
3182 KarmaGuiPlatformMonitor() { MainPos = MainSize = WorkPos = WorkSize =
KGVec2(0, 0); DpiScale = 1.0f; }
3190 float InputLineHeight;
3192 KarmaGuiPlatformImeData() { memset(
this, 0,
sizeof(*
this)); }
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
Definition KarmaGui.h:178
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:2412
Definition KarmaGui.h:2503
Definition KarmaGui.h:2461
Definition KarmaGui.h:2697
Draw command list.
Definition KarmaGui.h:2571
Definition KarmaGuiInternal.h:633
Definition KarmaGui.h:2512
Definition KarmaGui.h:2480
Definition KarmaGui.h:2776
Definition KarmaGui.h:2814
Definition KarmaGuiInternal.h:3370
Definition KarmaGui.h:2720
Definition KarmaGui.h:2749
Definition KarmaGui.h:2761
Definition KarmaGui.h:2917
Definition KarmaGui.h:1785
Definition KarmaGui.h:156
Definition KarmaGui.h:166
Definition KarmaGui.h:1807
Definition KarmaGuiInternal.h:1735
Definition KarmaGui.h:1942
Definition KarmaGui.h:2130
Definition KarmaGui.h:1934
Definition KarmaGui.h:2372
Definition KarmaGui.h:2247
Definition KarmaGui.h:2191
Definition KarmaGui.h:2161
Definition KarmaGui.h:2309
Definition KarmaGui.h:1877
Definition KarmaGui.h:2213
Definition KarmaGui.h:2227
Definition KarmaGui.h:2282
Definition KarmaGui.h:2255
A Platform Window (always 1 unless multi-viewport are enabled. One per platform window to output to)....
Definition KarmaGui.h:3005
Definition KarmaGui.h:2176