mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge branch 'master' into navigation
# Conflicts: # imgui_demo.cpp
This commit is contained in:
@ -80,7 +80,7 @@ static void ShowExampleAppLongText(bool* p_open);
|
||||
static void ShowExampleAppAutoResize(bool* p_open);
|
||||
static void ShowExampleAppConstrainedResize(bool* p_open);
|
||||
static void ShowExampleAppFixedOverlay(bool* p_open);
|
||||
static void ShowExampleAppManipulatingWindowTitle(bool* p_open);
|
||||
static void ShowExampleAppWindowTitles(bool* p_open);
|
||||
static void ShowExampleAppCustomRendering(bool* p_open);
|
||||
static void ShowExampleAppMainMenuBar();
|
||||
static void ShowExampleMenuFile();
|
||||
@ -133,34 +133,34 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
static bool show_app_auto_resize = false;
|
||||
static bool show_app_constrained_resize = false;
|
||||
static bool show_app_fixed_overlay = false;
|
||||
static bool show_app_manipulating_window_title = false;
|
||||
static bool show_app_window_titles = false;
|
||||
static bool show_app_custom_rendering = false;
|
||||
static bool show_app_style_editor = false;
|
||||
|
||||
static bool show_app_metrics = false;
|
||||
static bool show_app_about = false;
|
||||
|
||||
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
|
||||
if (show_app_console) ShowExampleAppConsole(&show_app_console);
|
||||
if (show_app_log) ShowExampleAppLog(&show_app_log);
|
||||
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
|
||||
if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor);
|
||||
if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text);
|
||||
if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize);
|
||||
if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize);
|
||||
if (show_app_fixed_overlay) ShowExampleAppFixedOverlay(&show_app_fixed_overlay);
|
||||
if (show_app_manipulating_window_title) ShowExampleAppManipulatingWindowTitle(&show_app_manipulating_window_title);
|
||||
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
||||
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
|
||||
if (show_app_console) ShowExampleAppConsole(&show_app_console);
|
||||
if (show_app_log) ShowExampleAppLog(&show_app_log);
|
||||
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
|
||||
if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor);
|
||||
if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text);
|
||||
if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize);
|
||||
if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize);
|
||||
if (show_app_fixed_overlay) ShowExampleAppFixedOverlay(&show_app_fixed_overlay);
|
||||
if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles);
|
||||
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
||||
|
||||
if (show_app_metrics) ImGui::ShowMetricsWindow(&show_app_metrics);
|
||||
if (show_app_style_editor) { ImGui::Begin("Style Editor", &show_app_style_editor); ImGui::ShowStyleEditor(); ImGui::End(); }
|
||||
if (show_app_metrics) { ImGui::ShowMetricsWindow(&show_app_metrics); }
|
||||
if (show_app_style_editor) { ImGui::Begin("Style Editor", &show_app_style_editor); ImGui::ShowStyleEditor(); ImGui::End(); }
|
||||
if (show_app_about)
|
||||
{
|
||||
ImGui::Begin("About ImGui", &show_app_about, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Begin("About Dear ImGui", &show_app_about, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Text("dear imgui, %s", ImGui::GetVersion());
|
||||
ImGui::Separator();
|
||||
ImGui::Text("By Omar Cornut and all github contributors.");
|
||||
ImGui::Text("ImGui is licensed under the MIT License, see LICENSE for more information.");
|
||||
ImGui::Text("By Omar Cornut and all dear imgui contributors.");
|
||||
ImGui::Text("Dear ImGui is licensed under the MIT License, see LICENSE for more information.");
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@ -170,6 +170,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
static bool no_move = false;
|
||||
static bool no_resize = false;
|
||||
static bool no_collapse = false;
|
||||
static bool no_close = false;
|
||||
static bool no_nav = false;
|
||||
|
||||
// Demonstrate the various window flags. Typically you would just use the default.
|
||||
@ -181,6 +182,8 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
if (no_resize) window_flags |= ImGuiWindowFlags_NoResize;
|
||||
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
||||
if (no_nav) window_flags |= ImGuiWindowFlags_NoNavInputs;
|
||||
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(550,680), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("ImGui Demo", p_open, window_flags))
|
||||
{
|
||||
@ -213,7 +216,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::MenuItem("Auto-resizing window", NULL, &show_app_auto_resize);
|
||||
ImGui::MenuItem("Constrained-resizing window", NULL, &show_app_constrained_resize);
|
||||
ImGui::MenuItem("Simple overlay", NULL, &show_app_fixed_overlay);
|
||||
ImGui::MenuItem("Manipulating window title", NULL, &show_app_manipulating_window_title);
|
||||
ImGui::MenuItem("Manipulating window titles", NULL, &show_app_window_titles);
|
||||
ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@ -221,7 +224,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
{
|
||||
ImGui::MenuItem("Metrics", NULL, &show_app_metrics);
|
||||
ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor);
|
||||
ImGui::MenuItem("About ImGui", NULL, &show_app_about);
|
||||
ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
@ -243,6 +246,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::Checkbox("No move", &no_move); ImGui::SameLine(150);
|
||||
ImGui::Checkbox("No resize", &no_resize); ImGui::SameLine(300);
|
||||
ImGui::Checkbox("No collapse", &no_collapse);
|
||||
ImGui::Checkbox("No close", &no_close); ImGui::SameLine(150);
|
||||
ImGui::Checkbox("No nav", &no_nav);
|
||||
|
||||
if (ImGui::TreeNode("Style"))
|
||||
@ -251,7 +255,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Logging"))
|
||||
if (ImGui::TreeNode("Capture/Logging"))
|
||||
{
|
||||
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.");
|
||||
ImGui::LogButtons();
|
||||
@ -2303,8 +2307,8 @@ static void ShowExampleAppFixedOverlay(bool* p_open)
|
||||
}
|
||||
|
||||
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
|
||||
// Read section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." about ID.
|
||||
static void ShowExampleAppManipulatingWindowTitle(bool*)
|
||||
// This apply to regular items as well. Read FAQ section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." for details.
|
||||
static void ShowExampleAppWindowTitles(bool*)
|
||||
{
|
||||
// By default, Windows are uniquely identified by their title.
|
||||
// You can use the "##" and "###" markers to manipulate the display/ID.
|
||||
@ -2322,7 +2326,7 @@ static void ShowExampleAppManipulatingWindowTitle(bool*)
|
||||
|
||||
// Using "###" to display a changing title but keep a static identifier "AnimatedTitle"
|
||||
char buf[128];
|
||||
sprintf(buf, "Animated title %c %d###AnimatedTitle", "|/-\\"[(int)(ImGui::GetTime()/0.25f)&3], rand());
|
||||
sprintf(buf, "Animated title %c %d###AnimatedTitle", "|/-\\"[(int)(ImGui::GetTime()/0.25f)&3], ImGui::GetFrameCount());
|
||||
ImGui::SetNextWindowPos(ImVec2(100,300), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin(buf);
|
||||
ImGui::Text("This window has a changing title.");
|
||||
@ -2811,7 +2815,7 @@ static void ShowExampleAppLog(bool* p_open)
|
||||
if (time - last_time >= 0.20f && !ImGui::GetIO().KeyCtrl)
|
||||
{
|
||||
const char* random_words[] = { "system", "info", "warning", "error", "fatal", "notice", "log" };
|
||||
log.AddLog("[%s] Hello, time is %.1f, rand() %d\n", random_words[rand() % IM_ARRAYSIZE(random_words)], time, (int)rand());
|
||||
log.AddLog("[%s] Hello, time is %.1f, frame count is %d\n", random_words[rand() % IM_ARRAYSIZE(random_words)], time, ImGui::GetFrameCount());
|
||||
last_time = time;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user