21 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 22 #define _CRT_SECURE_NO_WARNINGS 30 #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier 37 #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen 38 #define snprintf _snprintf 41 #pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. 42 #pragma clang diagnostic ignored "-Wdeprecated-declarations" // warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code) 43 #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' 44 #pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal 45 #pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. 46 #if __has_warning("-Wreserved-id-macro") 47 #pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // 49 #elif defined(__GNUC__) 50 #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size 51 #pragma GCC diagnostic ignored "-Wformat-security" // warning : format string is not a string literal (potentially insecure) 52 #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function 53 #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value 55 #pragma GCC diagnostic ignored "-Wmisleading-indentation" // warning: this 'if' clause does not guard this statement // GCC 6.0+ only. See #883 on github. 61 #define IM_NEWLINE "\r\n" 63 #define IM_NEWLINE "\n" 66 #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) 67 #define IM_MAX(_A,_B) (((_A) >= (_B)) ? (_A) : (_B)) 73 #ifndef IMGUI_DISABLE_TEST_WINDOWS 75 static void ShowExampleAppConsole(
bool* p_open);
76 static void ShowExampleAppLog(
bool* p_open);
77 static void ShowExampleAppLayout(
bool* p_open);
78 static void ShowExampleAppPropertyEditor(
bool* p_open);
79 static void ShowExampleAppLongText(
bool* p_open);
80 static void ShowExampleAppAutoResize(
bool* p_open);
81 static void ShowExampleAppConstrainedResize(
bool* p_open);
82 static void ShowExampleAppFixedOverlay(
bool* p_open);
83 static void ShowExampleAppManipulatingWindowTitle(
bool* p_open);
84 static void ShowExampleAppCustomRendering(
bool* p_open);
85 static void ShowExampleAppMainMenuBar();
86 static void ShowExampleMenuFile();
88 static void ShowHelpMarker(
const char* desc)
112 "While editing text:\n" 113 "- Hold SHIFT or use mouse to select text\n" 114 "- CTRL+Left/Right to word jump\n" 115 "- CTRL+A or double-click to select all\n" 116 "- CTRL+X,CTRL+C,CTRL+V clipboard\n" 117 "- CTRL+Z,CTRL+Y undo/redo\n" 118 "- ESCAPE to revert\n" 119 "- You can apply arithmetic operators +,*,/ on numerical values.\n" 120 " Use +- to subtract.\n");
127 static bool show_app_main_menu_bar =
false;
128 static bool show_app_console =
false;
129 static bool show_app_log =
false;
130 static bool show_app_layout =
false;
131 static bool show_app_property_editor =
false;
132 static bool show_app_long_text =
false;
133 static bool show_app_auto_resize =
false;
134 static bool show_app_constrained_resize =
false;
135 static bool show_app_fixed_overlay =
false;
136 static bool show_app_manipulating_window_title =
false;
137 static bool show_app_custom_rendering =
false;
138 static bool show_app_style_editor =
false;
140 static bool show_app_metrics =
false;
141 static bool show_app_about =
false;
143 if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
144 if (show_app_console) ShowExampleAppConsole(&show_app_console);
145 if (show_app_log) ShowExampleAppLog(&show_app_log);
146 if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
147 if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor);
148 if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text);
149 if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize);
150 if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize);
151 if (show_app_fixed_overlay) ShowExampleAppFixedOverlay(&show_app_fixed_overlay);
152 if (show_app_manipulating_window_title) ShowExampleAppManipulatingWindowTitle(&show_app_manipulating_window_title);
153 if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
162 ImGui::Text(
"By Omar Cornut and all github contributors.");
163 ImGui::Text(
"ImGui is licensed under the MIT License, see LICENSE for more information.");
167 static bool no_titlebar =
false;
168 static bool no_border =
true;
169 static bool no_resize =
false;
170 static bool no_move =
false;
171 static bool no_scrollbar =
false;
172 static bool no_collapse =
false;
173 static bool no_menu =
false;
202 ShowExampleMenuFile();
214 ImGui::MenuItem(
"Constrained-resizing window", NULL, &show_app_constrained_resize);
216 ImGui::MenuItem(
"Manipulating window title", NULL, &show_app_manipulating_window_title);
233 ImGui::TextWrapped(
"This window is being created by the ShowTestWindow() function. Please refer to the code for programming reference.\n\nUser Guide:");
255 ImGui::TextWrapped(
"The logging API redirects all text output so you can easily capture the content of a window or a block. Tree nodes can be automatically expanded. You can also call ImGui::LogText() to output directly to the log without a visual output.");
265 static int clicked = 0;
274 static bool check =
true;
283 for (
int i = 0; i < 7; i++)
305 static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
321 ImGui::Combo(
"combo", &item,
"aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
323 const char* items[] = {
"AAAA",
"BBBB",
"CCCC",
"DDDD",
"EEEE",
"FFFF",
"GGGG",
"HHHH",
"IIII",
"JJJJ",
"KKKK" };
324 static int item2 = -1;
328 static char str0[128] =
"Hello, world!";
330 static float f0=0.001f;
332 ImGui::SameLine(); ShowHelpMarker(
"Hold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n");
335 ImGui::SameLine(); ShowHelpMarker(
"You can apply arithmetic operators +,*,/ on numerical values.\n e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\nUse +- to subtract.\n");
339 static float vec4a[4] = { 0.10f, 0.20f, 0.30f, 0.44f };
344 static int i1=50, i2=42;
346 ImGui::SameLine(); ShowHelpMarker(
"Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+click to input value.");
350 static float f1=1.00f, f2=0.0067f;
360 static float f1=0.123f, f2=0.0f;
363 static float angle = 0.0f;
367 static float col1[3] = { 1.0f,0.0f,0.2f };
368 static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
370 ImGui::SameLine(); ShowHelpMarker(
"Click on the colored square to open a color picker.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
374 const char* listbox_items[] = {
"Apple",
"Banana",
"Cherry",
"Kiwi",
"Mango",
"Orange",
"Pineapple",
"Strawberry",
"Watermelon" };
375 static int listbox_item_current = 1;
390 for (
int i = 0; i < 5; i++)
403 ShowHelpMarker(
"This is a more standard looking tree with selectable nodes.\nClick to select, CTRL+Click to toggle, click on arrows or double-click to open.");
404 static bool align_label_with_current_x_position =
false;
405 ImGui::Checkbox(
"Align label with current X position)", &align_label_with_current_x_position);
407 if (align_label_with_current_x_position)
410 static int selection_mask = (1 << 2);
411 int node_clicked = -1;
413 for (
int i = 0; i < 6; i++)
420 bool node_open =
ImGui::TreeNodeEx((
void*)(intptr_t)i, node_flags,
"Selectable Node %d", i);
437 if (node_clicked != -1)
441 selection_mask ^= (1 << node_clicked);
443 selection_mask = (1 << node_clicked);
446 if (align_label_with_current_x_position)
455 static bool closable_group =
true;
459 for (
int i = 0; i < 5; i++)
464 for (
int i = 0; i < 5; i++)
487 ImGui::SameLine(); ShowHelpMarker(
"The TextDisabled color is stored in ImGuiStyle.");
494 ImGui::TextWrapped(
"This text should automatically wrap on the edge of the window. The current implementation for text wrapping follows simple rules suitable for English and possibly other languages.");
497 static float wrap_width = 200.0f;
504 ImGui::Text(
"The lazy dog is a good dog. This paragraph is made to fit within %.0f pixels. Testing a 1 character word. The quick brown fox jumps over the lazy dog.", wrap_width);
512 ImGui::Text(
"aaaaaaaa bbbbbbbb, c cccccccc,dddddddd. d eeeeeeee ffffffff. gggggggg!hhhhhhhh");
528 ImGui::TextWrapped(
"CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->LoadFromFileTTF() manually to load extra character ranges.");
529 ImGui::Text(
"Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)");
530 ImGui::Text(
"Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
531 static char buf[32] =
"\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
540 ImGui::TextWrapped(
"Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!");
546 ImGui::Image(tex_id,
ImVec2(tex_w, tex_h),
ImVec2(0,0),
ImVec2(1,1),
ImColor(255,255,255,255),
ImColor(255,255,255,128));
550 float focus_sz = 32.0f;
551 float focus_x =
ImGui::GetMousePos().
x - tex_screen_pos.
x - focus_sz * 0.5f;
if (focus_x < 0.0f) focus_x = 0.0f;
else if (focus_x > tex_w - focus_sz) focus_x = tex_w - focus_sz;
552 float focus_y =
ImGui::GetMousePos().
y - tex_screen_pos.
y - focus_sz * 0.5f;
if (focus_y < 0.0f) focus_y = 0.0f;
else if (focus_y > tex_h - focus_sz) focus_y = tex_h - focus_sz;
553 ImGui::Text(
"Min: (%.2f, %.2f)", focus_x, focus_y);
554 ImGui::Text(
"Max: (%.2f, %.2f)", focus_x + focus_sz, focus_y + focus_sz);
555 ImVec2 uv0 =
ImVec2((focus_x) / tex_w, (focus_y) / tex_h);
556 ImVec2 uv1 =
ImVec2((focus_x + focus_sz) / tex_w, (focus_y + focus_sz) / tex_h);
557 ImGui::Image(tex_id,
ImVec2(128,128), uv0, uv1,
ImColor(255,255,255,255),
ImColor(255,255,255,128));
561 static int pressed_count = 0;
562 for (
int i = 0; i < 8; i++)
565 int frame_padding = -1 + i;
566 if (
ImGui::ImageButton(tex_id,
ImVec2(32,32),
ImVec2(0,0),
ImVec2(32.0f/tex_w,32/tex_h), frame_padding,
ImColor(0,0,0,255)))
580 static bool selected[4] = {
false,
true,
false,
false };
587 selected[3] = !selected[3];
592 static bool selected[3] = {
false,
false,
false };
601 static bool selected[16] = { 0 };
602 for (
int i = 0; i < 16; i++)
604 char label[32]; sprintf(label,
"Item %d", i);
613 static bool selected[16] = {
true,
false,
false,
false,
false,
true,
false,
false,
false,
false,
true,
false,
false,
false,
false,
true };
614 for (
int i = 0; i < 16; i++)
619 int x = i % 4, y = i / 4;
620 if (x > 0) selected[i - 1] ^= 1;
621 if (x < 3) selected[i + 1] ^= 1;
622 if (y > 0) selected[i - 4] ^= 1;
623 if (y < 3) selected[i + 4] ^= 1;
644 static char bufpass[64] =
"password123";
646 ImGui::SameLine(); ShowHelpMarker(
"Display all characters as '*'.\nDisable clipboard cut and copy.\nDisable logging.\n");
654 static bool read_only =
false;
655 static char text[1024*16] =
657 " The Pentium F00F bug, shorthand for F0 0F C7 C8,\n" 658 " the hexadecimal encoding of one offending instruction,\n" 659 " more formally, the invalid operand with locked CMPXCHG8B\n" 660 " instruction bug, is a design flaw in the majority of\n" 661 " Intel Pentium, Pentium MMX, and Pentium OverDrive\n" 662 " processors (all in the P5 microarchitecture).\n" 665 "\tlock cmpxchg8b eax\n";
677 static bool animate =
true;
680 static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
685 static float values[90] = { 0 };
686 static int values_offset = 0;
687 static float refresh_time = 0.0f;
688 if (!animate || refresh_time == 0.0f)
692 static float phase = 0.0f;
693 values[values_offset] = cosf(phase);
694 values_offset = (values_offset+1) %
IM_ARRAYSIZE(values);
695 phase += 0.10f*values_offset;
696 refresh_time += 1.0f/60.0f;
705 static float Sin(
void*,
int i) {
return sinf(i * 0.1f); }
706 static float Saw(
void*,
int i) {
return (i & 1) ? 1.0f : -1.0f; }
708 static int func_type = 0, display_count = 70;
713 float (*func)(
void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw;
719 static float progress = 0.0f, progress_dir = 1.0f;
723 if (progress >= +1.1f) { progress = +1.1f; progress_dir *= -1.0f; }
724 if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; }
732 float progress_saturated = (progress < 0.0f) ? 0.0f : (progress > 1.0f) ? 1.0f : progress;
734 sprintf(buf,
"%d/%d", (
int)(progress_saturated*1753), 1753);
743 static bool hdr =
false;
744 static bool alpha_preview =
true;
745 static bool alpha_half_preview =
false;
746 static bool options_menu =
true;
750 ImGui::Checkbox(
"With Options Menu", &options_menu);
ImGui::SameLine(); ShowHelpMarker(
"Right-click on the individual color widget to show options.");
754 ImGui::SameLine(); ShowHelpMarker(
"Click on the colored square to open a color picker.\nCTRL+click on individual component to input value.\n");
764 ImGui::SameLine(); ShowHelpMarker(
"With the ImGuiColorEditFlags_NoInputs flag you can hide all the slider/text inputs.\nWith the ImGuiColorEditFlags_NoLabel flag you can pass a non-empty label which will only be used for the tooltip and picker popup.");
767 ImGui::Text(
"Color button with Custom Picker Popup:");
768 static bool saved_palette_inited =
false;
769 static ImVec4 saved_palette[32];
770 static ImVec4 backup_color;
771 if (!saved_palette_inited)
780 backup_color = color;
785 ImGui::Text(
"MY CUSTOM COLOR PICKER WITH AN AMAZING PALETTE!");
794 color = backup_color;
803 color =
ImVec4(saved_palette[n].x, saved_palette[n].y, saved_palette[n].z, color.
w);
814 static bool alpha =
true;
815 static bool alpha_bar =
true;
816 static bool side_preview =
true;
817 static bool ref_color =
false;
818 static ImVec4 ref_color_v(1.0f,0.0f,1.0f,0.5f);
819 static int inputs_mode = 2;
820 static int picker_mode = 0;
834 ImGui::Combo(
"Inputs Mode", &inputs_mode,
"All Inputs\0No Inputs\0RGB Input\0HSV Input\0HEX Input\0");
835 ImGui::Combo(
"Picker Mode", &picker_mode,
"Auto/Current\0Hue bar + SV rect\0Hue wheel + SV triangle\0");
836 ImGui::SameLine(); ShowHelpMarker(
"User can right-click the picker to change mode.");
849 ImGui::Text(
"Programmatically set defaults/options:");
850 ImGui::SameLine(); ShowHelpMarker(
"SetColorEditOptions() is designed to allow you to set boot-time default.\nWe don't have Push/Pop functions because you can force options on a per-widget basis if needed, and the user can change non-forced ones with the options menu.\nWe don't have a getter to avoid encouraging you to persistently save values that aren't forward-compatible.");
862 static float begin = 10, end = 90;
863 static int begin_i = 100, end_i = 1000;
865 ImGui::DragIntRange2(
"range int (no bounds)", &begin_i, &end_i, 5, 0, 0,
"Min: %.0f units",
"Max: %.0f units");
871 static float vec4f[4] = { 0.10f, 0.20f, 0.30f, 0.44f };
872 static int vec4i[4] = { 1, 5, 100, 255 };
902 const float spacing = 4;
905 static int int_value = 0;
909 static float values[7] = { 0.0f, 0.60f, 0.35f, 0.9f, 0.70f, 0.20f, 0.0f };
911 for (
int i = 0; i < 7; i++)
929 static float values2[4] = { 0.20f, 0.80f, 0.40f, 0.25f };
931 const ImVec2 small_slider_size(18, (160.0f-(rows-1)*spacing)/rows);
932 for (
int nx = 0; nx < 4; nx++)
936 for (
int ny = 0; ny < rows; ny++)
950 for (
int i = 0; i < 4; i++)
970 static int line = 50;
977 for (
int i = 0; i < 100; i++)
980 if (goto_line && line == i)
983 if (goto_line && line >= 100)
993 for (
int i = 0; i < 100; i++)
998 sprintf(buf,
"%08x", i*5731);
1009 static float f = 0.0f;
1016 ImGui::Text(
"PushItemWidth(GetWindowWidth() * 0.5f)");
1022 ImGui::Text(
"PushItemWidth(GetContentRegionAvailWidth() * 0.5f)");
1023 ImGui::SameLine(); ShowHelpMarker(
"Half of available width.\n(~ right-cursor_pos)\n(works within a column set)");
1045 ImGui::TextWrapped(
"(Use ImGui::SameLine() to keep adding items to the right of the preceding item)");
1076 static bool c1=
false,c2=
false,c3=
false,c4=
false;
1083 static float f0=1.0f, f1=2.0f, f2=3.0f;
1085 const char* items[] = {
"AAAA",
"BBBB",
"CCCC",
"DDDD" };
1086 static int item = -1;
1095 static int selection[4] = { 0, 1, 2, 3 };
1096 for (
int i = 0; i < 4; i++)
1117 ImGui::TextWrapped(
"(Using ImGui::BeginGroup()/EndGroup() to layout items. BeginGroup() basically locks the horizontal position. EndGroup() bundles the whole group so that you can use functions such as IsItemHovered() on it.)");
1137 const float values[5] = { 0.5f, 0.20f, 0.80f, 0.60f, 0.25f };
1159 ImGui::TextWrapped(
"(This is testing the vertical alignment that occurs on text to keep it at the same baseline as widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets)");
1214 ImGui::TextWrapped(
"(Use SetScrollHere() or SetScrollFromPosY() to scroll to a given position.)");
1215 static bool track =
true;
1216 static int track_line = 50, scroll_to_px = 200;
1223 if (scroll_to) track =
false;
1225 for (
int i = 0; i < 5; i++)
1229 ImGui::Text(
"%s", i == 0 ?
"Top" : i == 1 ?
"25%" : i == 2 ?
"Center" : i == 3 ?
"75%" :
"Bottom");
1233 for (
int line = 0; line < 100; line++)
1235 if (track && line == track_line)
1255 ImGui::Bullet();
ImGui::TextWrapped(
"Horizontal scrolling for a window has to be enabled explicitly via the ImGuiWindowFlags_HorizontalScrollbar flag.");
1257 static int lines = 7;
1262 for (
int line = 0; line < lines; line++)
1266 int num_buttons = 10 + ((line & 1) ? line * 9 : line * 3);
1267 for (
int n = 0; n < num_buttons; n++)
1272 const char* label = (!(n%15)) ?
"FizzBuzz" : (!(n%3)) ?
"Fizz" : (!(n%5)) ?
"Buzz" : (sprintf(num_buf,
"%d", n), num_buf);
1273 float hue = n*0.05f;
1285 float scroll_x_delta = 0.0f;
1290 if (scroll_x_delta != 0.0f)
1301 static ImVec2 size(100, 100), offset(50, 20);
1302 ImGui::TextWrapped(
"On a per-widget basis we are occasionally clipping text CPU-side if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost.");
1306 ImVec4 clip_rect(pos.
x, pos.
y, pos.
x+size.x, pos.
y+size.y);
1310 ImGui::GetWindowDrawList()->
AddText(
ImGui::GetFont(),
ImGui::GetFontSize()*2.0f,
ImVec2(pos.
x+offset.
x,pos.
y+offset.
y),
ImColor(255,255,255,255),
"Line 1 hello\nLine 2 clip me!", NULL, 0.0f, &clip_rect);
1319 ImGui::TextWrapped(
"When a popup is active, it inhibits interacting with windows that are behind the popup. Clicking outside the popup closes it.");
1321 static int selected_fish = -1;
1322 const char* names[] = {
"Bream",
"Haddock",
"Mackerel",
"Pollock",
"Tilefish" };
1323 static bool toggles[] = {
true,
false,
false,
false,
false };
1330 ImGui::Text(selected_fish == -1 ?
"<None>" : names[selected_fish]);
1379 ShowExampleMenuFile();
1384 ImGui::TextWrapped(
"Below we are testing adding menu items to a regular window. It's rather unusual but should work!");
1393 ShowExampleMenuFile();
1404 static float value = 0.5f;
1405 ImGui::Text(
"Value = %.3f (<-- right-click here)", value);
1414 static char name[32] =
"Label1";
1415 char buf[64]; sprintf(buf,
"Button: %s###Button", name);
1432 ImGui::TextWrapped(
"Modal windows are like popups but the user cannot close them by clicking outside the window.");
1438 ImGui::Text(
"All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n");
1444 static bool dont_ask_me_next_time =
false;
1459 ImGui::Text(
"Hello from Stacked The First\nUsing style.Colors[ImGuiCol_ModalWindowDarkening] for darkening.");
1460 static int item = 1;
1461 ImGui::Combo(
"Combo", &item,
"aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
1492 for (
int n = 0; n < 14; n++)
1495 sprintf(label,
"Item %d", n);
1511 const char* names[3] = {
"One",
"Two",
"Three" };
1512 const char* paths[3] = {
"/path/one",
"/path/two",
"/path/three" };
1513 static int selected = -1;
1514 for (
int i = 0; i < 3; i++)
1517 sprintf(label,
"%04d", i);
1543 static float foo = 1.0f;
1550 static float bar = 1.0f;
1580 static bool h_borders =
true;
1581 static bool v_borders =
true;
1586 for (
int i = 0; i < 4*3; i++)
1631 for (
int i = 0; i < 20; i++)
1632 for (
int j = 0; j < 10; j++)
1643 ImGui::SameLine(); ShowHelpMarker(
"NB: Tree node must be poped before ending the cell. There's no storage of state per-cell.");
1661 " \"\" display all lines\n" 1662 " \"xxx\" display lines containing \"xxx\"\n" 1663 " \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n" 1664 " \"-xxx\" hide lines containing \"xxx\"");
1666 const char* lines[] = {
"aaa1.c",
"bbb1.c",
"ccc1.c",
"aaa2.cpp",
"bbb2.cpp",
"ccc2.cpp",
"abc.h",
"hello, world" };
1676 ImGui::SameLine(); ShowHelpMarker(
"Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via regular GPU rendering will feel more laggy than hardware cursor, but will be more in sync with your other visuals.");
1698 ImGui::Button(
"Hovering me sets the\nkeyboard capture flag");
1702 ImGui::Button(
"Holding me clears the\nthe keyboard capture flag");
1711 ImGui::Text(
"Use TAB/SHIFT+TAB to cycle through keyboard editable fields.");
1712 static char buf[32] =
"dummy";
1730 static char buf[128] =
"click on a button to set focus";
1749 ImGui::TextWrapped(
"Cursor & selection are preserved when refocusing last used item in code.");
1755 ImGui::TextWrapped(
"You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget.");
1767 ImGui::SameLine();
ImGui::Text(
"Raw (%.1f, %.1f), WithLockThresold (%.1f, %.1f), MouseDelta (%.1f, %.1f)", value_raw.
x, value_raw.
y, value_with_lock_threshold.
x, value_with_lock_threshold.
y, mouse_delta.
x, mouse_delta.
y);
1775 ImGui::SameLine(); ShowHelpMarker(
"Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, otherwise your backend needs to handle it.");
1779 sprintf(label,
"Mouse cursor %d", i);
1798 style = ref ? *ref : default_style;
1844 static int output_dest = 0;
1845 static bool output_only_modified =
false;
1848 if (output_dest == 0)
1857 if (!output_only_modified || memcmp(&col, (ref ? &ref->
Colors[i] : &default_style.
Colors[i]),
sizeof(
ImVec4)) != 0)
1858 ImGui::LogText(
"colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE, name, 23-(
int)strlen(name),
"", col.
x, col.
y, col.
z, col.
w);
1865 ImGui::Text(
"Tip: Left-click on colored square to open color picker,\nRight-click to open edit options menu.");
1868 filter.
Draw(
"Filter colors", 200);
1898 ImGui::SameLine(); ShowHelpMarker(
"Tip: Load fonts with io.Fonts->AddFontFromFileTTF()\nbefore calling io.Fonts->GetTex* functions.");
1904 ImGui::Image(atlas->
TexID,
ImVec2((
float)atlas->
TexWidth, (
float)atlas->
TexHeight),
ImVec2(0,0),
ImVec2(1,1),
ImColor(255,255,255,255),
ImColor(255,255,255,128));
1908 for (
int i = 0; i < atlas->
Fonts.
Size; i++)
1913 if (font_details_opened)
1916 ImGui::Text(
"The quick brown fox jumps over the lazy dog");
1919 ImGui::SameLine(); ShowHelpMarker(
"Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
1933 for (
int base = 0; base < 0x10000; base += 256)
1936 for (
int n = 0; n < 256; n++)
1938 if (count > 0 &&
ImGui::TreeNode((
void*)(intptr_t)base,
"U+%04X..U+%04X (%d %s)", base, base+255, count, count > 1 ?
"glyphs" :
"glyph"))
1944 for (
int n = 0; n < 256; n++)
1946 ImVec2 cell_p1(base_pos.
x + (n % 16) * (cell_size.
x + cell_spacing), base_pos.
y + (n / 16) * (cell_size.
y + cell_spacing));
1947 ImVec2 cell_p2(cell_p1.
x + cell_size.
x, cell_p1.
y + cell_size.
y);
1972 static float window_scale = 1.0f;
1973 ImGui::DragFloat(
"this window scale", &window_scale, 0.005f, 0.3f, 2.0f,
"%.1f");
1984 static void ShowExampleAppMainMenuBar()
1990 ShowExampleMenuFile();
2007 static void ShowExampleMenuFile()
2023 ShowExampleMenuFile();
2035 static bool enabled =
true;
2038 for (
int i = 0; i < 10; i++)
2041 static float f = 0.5f;
2043 static bool b =
true;
2065 static void ShowExampleAppAutoResize(
bool* p_open)
2073 static int lines = 10;
2074 ImGui::Text(
"Window will resize every-frame to the size of its content.\nNote that you probably don't want to query the window size to\noutput your content because that would create a feedback loop.");
2076 for (
int i = 0; i < lines; i++)
2082 static void ShowExampleAppConstrainedResize(
bool* p_open)
2084 struct CustomConstraints
2090 static int type = 0;
2098 if (
ImGui::Begin(
"Example: Constrained Resize", p_open))
2100 const char* desc[] =
2102 "Resize vertical only",
2103 "Resize horizontal only",
2104 "Width > 100, Height > 100",
2106 "Custom: Always Square",
2107 "Custom: Fixed Steps (100)",
2113 for (
int i = 0; i < 10; i++)
2114 ImGui::Text(
"Hello, sailor! Making this line long enough for the example.");
2120 static void ShowExampleAppFixedOverlay(
bool* p_open)
2122 const float DISTANCE = 10.0f;
2123 static int corner = 0;
2125 ImVec2 window_pos_pivot =
ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f);
2130 ImGui::Text(
"Simple overlay\nin the corner of the screen.\n(right-click to change position)");
2148 static void ShowExampleAppManipulatingWindowTitle(
bool*)
2156 ImGui::Text(
"This is window 1.\nMy title is the same as window 2, but my identifier is unique.");
2161 ImGui::Text(
"This is window 2.\nMy title is the same as window 1, but my identifier is unique.");
2166 sprintf(buf,
"Animated title %c %d###AnimatedTitle",
"|/-\\"[(
int)(
ImGui::GetTime()/0.25f)&3], rand());
2174 static void ShowExampleAppCustomRendering(
bool* p_open)
2177 if (!
ImGui::Begin(
"Example: Custom rendering", p_open))
2191 static float sz = 36.0f;
2198 float x = p.
x + 4.0f, y = p.
y + 4.0f, spacing = 8.0f;
2199 for (
int n = 0; n < 2; n++)
2201 float thickness = (n == 0) ? 1.0f : 4.0f;
2202 draw_list->
AddCircle(
ImVec2(x+sz*0.5f, y+sz*0.5f), sz*0.5f, col32, 20, thickness); x += sz+spacing;
2203 draw_list->
AddRect(
ImVec2(x, y),
ImVec2(x+sz, y+sz), col32, 0.0f, ~0, thickness); x += sz+spacing;
2204 draw_list->
AddRect(
ImVec2(x, y),
ImVec2(x+sz, y+sz), col32, 10.0f, ~0, thickness); x += sz+spacing;
2217 draw_list->
AddRectFilledMultiColor(
ImVec2(x, y),
ImVec2(x+sz, y+sz),
ImColor(0,0,0),
ImColor(255,0,0),
ImColor(255,255,0),
ImColor(0,255,0));
2223 static bool adding_line =
false;
2227 ImGui::Text(
"Left-click and drag to add lines,\nRight-click to undo");
2234 if (canvas_size.
x < 50.0f) canvas_size.
x = 50.0f;
2235 if (canvas_size.
y < 50.0f) canvas_size.
y = 50.0f;
2236 draw_list->
AddRectFilledMultiColor(canvas_pos,
ImVec2(canvas_pos.
x + canvas_size.
x, canvas_pos.
y + canvas_size.
y),
ImColor(50,50,50),
ImColor(50,50,60),
ImColor(60,60,70),
ImColor(50,50,60));
2237 draw_list->
AddRect(canvas_pos,
ImVec2(canvas_pos.
x + canvas_size.
x, canvas_pos.
y + canvas_size.
y),
ImColor(255,255,255));
2239 bool adding_preview =
false;
2244 adding_preview =
true;
2247 adding_line = adding_preview =
false;
2258 adding_line = adding_preview =
false;
2264 for (
int i = 0; i < points.
Size - 1; i += 2)
2265 draw_list->
AddLine(
ImVec2(canvas_pos.
x + points[i].x, canvas_pos.
y + points[i].y),
ImVec2(canvas_pos.
x + points[i+1].x, canvas_pos.
y + points[i+1].y),
IM_COL32(255,255,0,255), 2.0f);
2287 memset(InputBuf, 0,
sizeof(InputBuf));
2293 AddLog(
"Welcome to ImGui!");
2298 for (
int i = 0; i < History.
Size; i++)
2303 static int Stricmp(
const char* str1,
const char* str2) {
int d;
while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; }
return d; }
2304 static int Strnicmp(
const char* str1,
const char* str2,
int n) {
int d = 0;
while (n > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; n--; }
return d; }
2305 static char*
Strdup(
const char *str) {
size_t len = strlen(str) + 1;
void* buff = malloc(len);
return (
char*)memcpy(buff, (
const void*)str, len); }
2309 for (
int i = 0; i < Items.
Size; i++)
2312 ScrollToBottom =
true;
2319 va_start(args, fmt);
2324 ScrollToBottom =
true;
2327 void Draw(
const char* title,
bool* p_open)
2336 ImGui::TextWrapped(
"This example implements a console with basic coloring, completion and history. A more elaborate implementation may want to store entries along with extra data such as timestamp, emitter, etc.");
2352 filter.
Draw(
"Filter (\"incl,-excl\") (\"error\")", 180);
2375 if (copy_to_clipboard)
2377 for (
int i = 0; i < Items.
Size; i++)
2379 const char* item = Items[i];
2383 if (strstr(item,
"[error]")) col =
ImColor(1.0f,0.4f,0.4f,1.0f);
2384 else if (strncmp(item,
"# ", 2) == 0) col =
ImColor(1.0f,0.78f,0.58f,1.0f);
2389 if (copy_to_clipboard)
2393 ScrollToBottom =
false;
2401 char* input_end = InputBuf+strlen(InputBuf);
2402 while (input_end > InputBuf && input_end[-1] ==
' ') { input_end--; } *input_end = 0;
2404 ExecCommand(InputBuf);
2405 strcpy(InputBuf,
"");
2417 AddLog(
"# %s\n", command_line);
2421 for (
int i = History.
Size-1; i >= 0; i--)
2422 if (Stricmp(History[i], command_line) == 0)
2428 History.
push_back(Strdup(command_line));
2431 if (Stricmp(command_line,
"CLEAR") == 0)
2435 else if (Stricmp(command_line,
"HELP") == 0)
2437 AddLog(
"Commands:");
2438 for (
int i = 0; i < Commands.
Size; i++)
2439 AddLog(
"- %s", Commands[i]);
2441 else if (Stricmp(command_line,
"HISTORY") == 0)
2443 int first = History.
Size - 10;
2444 for (
int i = first > 0 ? first : 0; i < History.
Size; i++)
2445 AddLog(
"%3d: %s\n", i, History[i]);
2449 AddLog(
"Unknown command: '%s'\n", command_line);
2470 const char* word_start = word_end;
2471 while (word_start > data->
Buf)
2473 const char c = word_start[-1];
2474 if (c ==
' ' || c ==
'\t' || c ==
',' || c ==
';')
2481 for (
int i = 0; i < Commands.
Size; i++)
2482 if (Strnicmp(Commands[i], word_start, (
int)(word_end-word_start)) == 0)
2485 if (candidates.
Size == 0)
2488 AddLog(
"No match for \"%.*s\"!\n", (
int)(word_end-word_start), word_start);
2490 else if (candidates.
Size == 1)
2493 data->
DeleteChars((
int)(word_start-data->
Buf), (
int)(word_end-word_start));
2500 int match_len = (int)(word_end - word_start);
2504 bool all_candidates_matches =
true;
2505 for (
int i = 0; i < candidates.
Size && all_candidates_matches; i++)
2507 c = toupper(candidates[i][match_len]);
2508 else if (c == 0 || c != toupper(candidates[i][match_len]))
2509 all_candidates_matches =
false;
2510 if (!all_candidates_matches)
2517 data->
DeleteChars((
int)(word_start - data->
Buf), (
int)(word_end-word_start));
2522 AddLog(
"Possible matches:\n");
2523 for (
int i = 0; i < candidates.
Size; i++)
2524 AddLog(
"- %s\n", candidates[i]);
2532 const int prev_history_pos = HistoryPos;
2535 if (HistoryPos == -1)
2536 HistoryPos = History.
Size - 1;
2537 else if (HistoryPos > 0)
2542 if (HistoryPos != -1)
2543 if (++HistoryPos >= History.
Size)
2548 if (prev_history_pos != HistoryPos)
2559 static void ShowExampleAppConsole(
bool* p_open)
2562 console.
Draw(
"Example: Console", p_open);
2580 int old_size = Buf.
size();
2582 va_start(args, fmt);
2585 for (
int new_size = Buf.
size(); old_size < new_size; old_size++)
2586 if (Buf[old_size] ==
'\n')
2588 ScrollToBottom =
true;
2591 void Draw(
const char* title,
bool* p_open = NULL)
2599 Filter.
Draw(
"Filter", -100.0f);
2606 const char* buf_begin = Buf.
begin();
2607 const char* line = buf_begin;
2608 for (
int line_no = 0; line != NULL; line_no++)
2610 const char* line_end = (line_no < LineOffsets.
Size) ? buf_begin + LineOffsets[line_no] : NULL;
2613 line = line_end && line_end[1] ? line_end + 1 : NULL;
2623 ScrollToBottom =
false;
2630 static void ShowExampleAppLog(
bool* p_open)
2635 static float last_time = -1.0f;
2637 if (time - last_time >= 0.20f && !
ImGui::GetIO().KeyCtrl)
2639 const char* random_words[] = {
"system",
"info",
"warning",
"error",
"fatal",
"notice",
"log" };
2640 log.
AddLog(
"[%s] Hello, time is %.1f, rand() %d\n", random_words[rand() %
IM_ARRAYSIZE(random_words)], time, (
int)rand());
2644 log.
Draw(
"Example: Log", p_open);
2648 static void ShowExampleAppLayout(
bool* p_open)
2664 static int selected = 0;
2666 for (
int i = 0; i < 100; i++)
2669 sprintf(label,
"MyObject %d", i);
2681 ImGui::TextWrapped(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
2694 static void ShowExampleAppPropertyEditor(
bool* p_open)
2703 ShowHelpMarker(
"This example shows how you may implement a property editor using two columns.\nAll objects/fields data are dummies here.\nRemember that in many simple cases, you can use ImGui::SameLine(xxx) to position\nyour cursor horizontally instead of using the Columns() API.");
2711 static void ShowDummyObject(
const char* prefix,
int uid)
2722 static float dummy_members[8] = { 0.0f,0.0f,1.0f,3.1416f,100.0f,999.0f };
2723 for (
int i = 0; i < 8; i++)
2728 ShowDummyObject(
"Child", 424242);
2736 sprintf(label,
"Field_%d", i);
2757 for (
int obj_i = 0; obj_i < 3; obj_i++)
2758 funcs::ShowDummyObject(
"Object", obj_i);
2767 static void ShowExampleAppLongText(
bool* p_open)
2770 if (!
ImGui::Begin(
"Example: Long text display", p_open))
2776 static int test_type = 0;
2778 static int lines = 0;
2779 ImGui::Text(
"Printing unusually long amount of text.");
2780 ImGui::Combo(
"Test type", &test_type,
"Single call to TextUnformatted()\0Multiple calls to Text(), clipped manually\0Multiple calls to Text(), not clipped\0");
2781 ImGui::Text(
"Buffer contents: %d lines, %d bytes", lines, log.
size());
2786 for (
int i = 0; i < 1000; i++)
2787 log.
append(
"%i The quick brown fox jumps over the lazy dog\n", lines+i);
2802 while (clipper.
Step())
2804 ImGui::Text(
"%i The quick brown fox jumps over the lazy dog", i);
2811 for (
int i = 0; i < lines; i++)
2812 ImGui::Text(
"%i The quick brown fox jumps over the lazy dog", i);
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val)
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
ImVector< char * > History
IMGUI_API ImVec2 GetCursorStartPos()
IMGUI_API void SetTooltip(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API bool IsMouseReleased(int button)
IMGUI_API bool RadioButton(const char *label, bool active)
IMGUI_API ImVec2 GetCursorPos()
IMGUI_API bool BeginPopupContextItem(const char *str_id, int mouse_button=1)
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio=0.5f)
IMGUI_API float GetFontSize()
IMGUI_API void AddCircle(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12, float thickness=1.0f)
IMGUI_API void AddRectFilledMultiColor(const ImVec2 &a, const ImVec2 &b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
IMGUI_API void ProgressBar(float fraction, const ImVec2 &size_arg=ImVec2(-1, 0), const char *overlay=NULL)
int TextEditCallback(ImGuiTextEditCallbackData *data)
IMGUI_API void PopClipRect()
IMGUI_API void DeleteChars(int pos, int bytes_count)
IMGUI_API bool InputTextMultiline(const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
IMGUI_API bool InputInt3(const char *label, int v[3], ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool IsMouseClicked(int button, bool repeat=false)
IMGUI_API bool IsItemClicked(int mouse_button=0)
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat=true)
float CurveTessellationTol
IMGUI_API void PopTextWrapPos()
IMGUI_API const ImFontGlyph * FindGlyph(ImWchar c) const
IMGUI_API void AddBezierCurve(const ImVec2 &pos0, const ImVec2 &cp0, const ImVec2 &cp1, const ImVec2 &pos1, ImU32 col, float thickness, int num_segments=0)
ImVector< ImFontGlyph > Glyphs
IMGUI_API ImVec2 GetItemRectMin()
IMGUI_API bool IsItemActive()
IMGUI_API bool ColorPicker4(const char *label, float col[4], ImGuiColorEditFlags flags=0, const float *ref_col=NULL)
IMGUI_API void append(const char *fmt,...) IM_FMTARGS(2)
IMGUI_API ImVec2 GetMouseDragDelta(int button=0, float lock_threshold=-1.0f)
IMGUI_API void EndTooltip()
IMGUI_API bool InputInt4(const char *label, int v[4], ImGuiInputTextFlags extra_flags=0)
IMGUI_API void LogButtons()
IMGUI_API void SetScrollHere(float center_y_ratio=0.5f)
IMGUI_API void PopAllowKeyboardFocus()
IMGUI_API bool SmallButton(const char *label)
IMGUI_API bool IsMouseHoveringRect(const ImVec2 &r_min, const ImVec2 &r_max, bool clip=true)
IMGUI_API bool BeginChild(const char *str_id, const ImVec2 &size=ImVec2(0, 0), bool border=false, ImGuiWindowFlags extra_flags=0)
IMGUI_API void ShowMetricsWindow(bool *p_open=NULL)
IMGUI_API bool Draw(const char *label="Filter (inc,-exc)", float width=0.0f)
IMGUI_API void BeginTooltip()
IMGUI_API bool TreeNodeEx(const char *label, ImGuiTreeNodeFlags flags=0)
float KeysDownDuration[512]
const ImFontGlyph * FallbackGlyph
IMGUI_API void Indent(float indent_w=0.0f)
IMGUI_API void AddTriangleFilled(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col)
IMGUI_API void PushTextWrapPos(float wrap_pos_x=0.0f)
IMGUI_API float GetColumnOffset(int column_index=-1)
IMGUI_API void AddLine(const ImVec2 &a, const ImVec2 &b, ImU32 col, float thickness=1.0f)
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect=false)
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
ImVector< ImFont * > Fonts
IMGUI_API ImVec2 GetItemRectSize()
IMGUI_API float GetWindowWidth()
IMGUI_API bool TreeNode(const char *label)
IMGUI_API bool ColorEdit4(const char *label, float col[4], ImGuiColorEditFlags flags=0)
IMGUI_API bool BeginMenuBar()
IMGUI_API void AlignFirstTextHeightToWidgets()
IMGUI_API 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, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API ImVec2 GetMousePos()
IMGUI_API bool InputFloat3(const char *label, float v[3], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool PassFilter(const char *text, const char *text_end=NULL) const
void AddLog(const char *fmt,...) IM_FMTARGS(2)
IMGUI_API bool BeginPopup(const char *str_id)
IMGUI_API void SameLine(float pos_x=0.0f, float spacing_w=-1.0f)
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type)
IMGUI_API bool SliderFloat2(const char *label, float v[2], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API ImVec2 GetContentRegionAvail()
IMGUI_API void CaptureKeyboardFromApp(bool capture=true)
ImGuiInputTextFlags EventFlag
IMGUI_API float GetScrollMaxY()
IMGUI_API ImDrawList * GetWindowDrawList()
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
IMGUI_API bool InputInt2(const char *label, int v[2], ImGuiInputTextFlags extra_flags=0)
void Draw(const char *title, bool *p_open)
IMGUI_API void PopStyleVar(int count=1)
ImVector< const char * > Commands
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
IMGUI_API void AddTriangle(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, ImU32 col, float thickness=1.0f)
IMGUI_API bool BeginPopupContextWindow(const char *str_id=NULL, int mouse_button=1, bool also_over_items=true)
IMGUI_API bool ListBoxHeader(const char *label, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API void Dummy(const ImVec2 &size)
IMGUI_API void BulletText(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API const char * GetStyleColorName(ImGuiCol idx)
IMGUI_API bool IsMouseDragging(int button=0, float lock_threshold=-1.0f)
IMGUI_API void TextUnformatted(const char *text, const char *text_end=NULL)
IMGUI_API 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 *display_format="%.3f", float power=1.0f)
float MouseDownDuration[5]
IMGUI_API void SetNextWindowContentWidth(float width)
static char * Strdup(const char *str)
IMGUI_API void Unindent(float indent_w=0.0f)
#define IM_COL32(R, G, B, A)
IMGUI_API bool SliderAngle(const char *label, float *v_rad, float v_degrees_min=-360.0f, float v_degrees_max=+360.0f)
IMGUI_API bool ColorEdit3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
IMGUI_API void AddText(const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL)
IMGUI_API bool SliderFloat3(const char *label, float v[3], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API ImGuiIO & GetIO()
IMGUI_API bool DragInt4(const char *label, int v[4], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API bool InputFloat2(const char *label, float v[2], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API bool IsRootWindowOrAnyChildFocused()
IMGUI_API bool InputFloat4(const char *label, float v[4], int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API ImFont * GetFont()
IMGUI_API void EndGroup()
IMGUI_API float GetTime()
static int Strnicmp(const char *str1, const char *str2, int n)
IMGUI_API int GetColumnIndex()
IMGUI_API bool IsKeyReleased(int user_key_index)
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2 &size_min, const ImVec2 &size_max, ImGuiSizeConstraintCallback custom_callback=NULL, void *custom_callback_data=NULL)
IMGUI_API bool InputFloat(const char *label, float *v, float step=0.0f, float step_fast=0.0f, int decimal_precision=-1, ImGuiInputTextFlags extra_flags=0)
IMGUI_API void ShowTestWindow(bool *p_open=NULL)
IMGUI_API void ShowStyleEditor(ImGuiStyle *ref=NULL)
IMGUI_API float GetContentRegionAvailWidth()
IMGUI_API void PushItemWidth(float item_width)
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API float GetItemsLineHeightWithSpacing()
IMGUI_API void Separator()
IMGUI_API void BeginGroup()
IMGUI_API 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 *display_format="%.3f", const char *display_format_max=NULL, float power=1.0f)
IMGUI_API bool SliderFloat4(const char *label, float v[4], float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API void AddCircleFilled(const ImVec2 ¢re, float radius, ImU32 col, int num_segments=12)
IMGUI_API float GetScrollX()
IMGUI_API bool SliderInt4(const char *label, int v[4], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API bool DragFloat(const char *label, float *v, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *display_format="%.3f", float power=1.0f)
IMGUI_API float GetColumnWidth(int column_index=-1)
IMGUI_API void EndPopup()
IMGUI_API void appendv(const char *fmt, va_list args) IM_FMTLIST(2)
IMGUI_API float GetTreeNodeToLabelSpacing()
IMGUI_API void NextColumn()
IMGUI_API bool ColorButton(const char *desc_id, const ImVec4 &col, ImGuiColorEditFlags flags=0, ImVec2 size=ImVec2(0, 0))
IMGUI_API 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 *display_format="%.3f", float power=1.0f)
IMGUI_API bool BeginMainMenuBar()
IMGUI_API void PushFont(ImFont *font)
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
IMGUI_API bool InvisibleButton(const char *str_id, const ImVec2 &size)
IMGUI_API void EndChild()
IMGUI_API float GetWindowContentRegionWidth()
IMGUI_API float GetScrollMaxX()
IMGUI_API bool BeginMenu(const char *label, bool enabled=true)
IMGUI_API void TextWrapped(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void ListBoxFooter()
IMGUI_API void TextColored(const ImVec4 &col, const char *fmt,...) IM_FMTARGS(2)
ImVec4 Colors[ImGuiCol_COUNT]
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void LogToTTY(int max_depth=-1)
IMGUI_API ImVec2 GetCursorScreenPos()
IMGUI_API bool SliderInt3(const char *label, int v[3], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API void RenderChar(ImDrawList *draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *display_format="%.0f")
void push_back(const value_type &v)
IMGUI_API void PopItemWidth()
static int Stricmp(const char *str1, const char *str2)
iterator erase(const_iterator it)
IMGUI_API void LogText(const char *fmt,...) IM_FMTARGS(1)
void ExecCommand(const char *command_line)
IMGUI_API float GetTextLineHeight()
IMGUI_API bool SliderInt2(const char *label, int v[2], int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
IMGUI_API void LabelText(const char *label, const char *fmt,...) IM_FMTARGS(2)
IMGUI_API bool MenuItem(const char *label, const char *shortcut=NULL, bool selected=false, bool enabled=true)
IMGUI_API bool BeginPopupModal(const char *name, bool *p_open=NULL, ImGuiWindowFlags extra_flags=0)
IMGUI_API bool Selectable(const char *label, bool selected=false, ImGuiSelectableFlags flags=0, const ImVec2 &size=ImVec2(0, 0))
static int TextEditCallbackStub(ImGuiTextEditCallbackData *data)
IMGUI_API bool Checkbox(const char *label, bool *v)
IMGUI_API bool VSliderInt(const char *label, const ImVec2 &size, int *v, int v_min, int v_max, const char *display_format="%.0f")
IMGUI_API ImVec2 GetItemRectMax()
IMGUI_API float GetScrollY()
IMGUI_API void LogToClipboard(int max_depth=-1)
const char * begin() const
IMGUI_API void EndMenuBar()
IMGUI_API const char * GetVersion()
IMGUI_API void PushID(const char *str_id)
IMGUI_API 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 *display_format="%.0f", const char *display_format_max=NULL)
IMGUI_API ImGuiID GetID(const char *str_id)
ImVector< int > LineOffsets
IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus)
IMGUI_API bool ListBox(const char *label, int *current_item, const char *const *items, int items_count, int height_in_items=-1)
IMGUI_API bool DragInt2(const char *label, int v[2], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API ImGuiStyle & GetStyle()
IMGUI_API bool Combo(const char *label, int *current_item, const char *const *items, int items_count, int height_in_items=-1)
IMGUI_API void CloseCurrentPopup()
IMGUI_API void PushClipRectFullScreen()
IMGUI_API void OpenPopup(const char *str_id)
void AddLog(const char *fmt,...) IM_FMTARGS(2)
IMGUI_API bool DragInt3(const char *label, int v[3], float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API 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 *display_format="%.3f", float power=1.0f)
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API void AddRectFilled(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=~0)
IMGUI_API void AddRect(const ImVec2 &a, const ImVec2 &b, ImU32 col, float rounding=0.0f, int rounding_corners_flags=~0, float thickness=1.0f)
IMGUI_API void TextDisabled(const char *fmt,...) IM_FMTARGS(1)
IMGUI_API void ShowUserGuide()
ImFontConfig * ConfigData
IMGUI_API void Columns(int count=1, const char *id=NULL, bool border=true)
IMGUI_API void SetWindowFontScale(float scale)
#define IM_ARRAYSIZE(_ARR)
IMGUI_API void InsertChars(int pos, const char *text, const char *text_end=NULL)
IMGUI_API bool DragInt(const char *label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0, const char *display_format="%.0f")
IMGUI_API bool IsMouseDoubleClicked(int button)
IMGUI_API bool IsAnyItemActive()
float ChildWindowRounding
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float &out_r, float &out_g, float &out_b)
IMGUI_API 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, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags)
IMGUI_API bool IsItemHovered()
IMGUI_API void SetKeyboardFocusHere(int offset=0)
IMGUI_API void LogFinish()
static ImColor HSV(float h, float s, float v, float a=1.0f)
IMGUI_API void SetScrollX(float scroll_x)
void Draw(const char *title, bool *p_open=NULL)
IMGUI_API bool InputInt(const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags extra_flags=0)
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul=1.0f)
IMGUI_API void PopStyleColor(int count=1)
IMGUI_API void EndMainMenuBar()
IMGUI_API bool VSliderFloat(const char *label, const ImVec2 &size, float *v, float v_min, float v_max, const char *display_format="%.3f", float power=1.0f)
IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2 &pos, bool on_edge=false, float outward=+0.0f)
IMGUI_API void SetWindowSize(const ImVec2 &size, ImGuiCond cond=0)