mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-12 15:59:54 +02:00
Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt # examples/imgui_impl_dx10.cpp # examples/imgui_impl_dx10.h # examples/imgui_impl_dx11.cpp # examples/imgui_impl_dx11.h # examples/imgui_impl_dx12.cpp # examples/imgui_impl_dx12.h # examples/imgui_impl_dx9.cpp # examples/imgui_impl_dx9.h # examples/imgui_impl_metal.h # examples/imgui_impl_metal.mm # examples/imgui_impl_opengl3.cpp # examples/imgui_impl_opengl3.h # examples/imgui_impl_vulkan.cpp # imgui.cpp # imgui.h # imgui_internal.h
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.74 WIP
|
||||
// dear imgui, v1.74
|
||||
// (demo code)
|
||||
|
||||
// Message to the person tempted to delete this file when integrating Dear ImGui into their code base:
|
||||
@ -139,7 +139,7 @@ static void ShowExampleAppCustomRendering(bool* p_open);
|
||||
static void ShowExampleMenuFile();
|
||||
|
||||
// Helper to display a little (?) mark which shows a tooltip when hovered.
|
||||
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see misc/fonts/README.txt)
|
||||
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.txt)
|
||||
static void HelpMarker(const char* desc)
|
||||
{
|
||||
ImGui::TextDisabled("(?)");
|
||||
@ -169,25 +169,28 @@ void ImGui::ShowUserGuide()
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui::BulletText("Double-click on title bar to collapse window.");
|
||||
ImGui::BulletText("Click and drag on lower corner to resize window\n(double-click to auto fit window to its contents).");
|
||||
if (io.ConfigWindowsMoveFromTitleBarOnly)
|
||||
ImGui::BulletText("Click and drag on title bar to move window.");
|
||||
else
|
||||
ImGui::BulletText("Click and drag on any empty space to move window.");
|
||||
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||
ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
||||
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||
if (io.FontAllowUserScaling)
|
||||
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
||||
ImGui::BulletText("Mouse Wheel to scroll.");
|
||||
ImGui::BulletText("While editing text:\n");
|
||||
ImGui::BulletText("While inputing text:\n");
|
||||
ImGui::Indent();
|
||||
ImGui::BulletText("Hold SHIFT or use mouse to select text.");
|
||||
ImGui::BulletText("CTRL+Left/Right to word jump.");
|
||||
ImGui::BulletText("CTRL+A or double-click to select all.");
|
||||
ImGui::BulletText("CTRL+X,CTRL+C,CTRL+V to use clipboard.");
|
||||
ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
|
||||
ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo.");
|
||||
ImGui::BulletText("ESCAPE to revert.");
|
||||
ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract.");
|
||||
ImGui::Unindent();
|
||||
ImGui::BulletText("With keyboard navigation enabled:");
|
||||
ImGui::Indent();
|
||||
ImGui::BulletText("Arrow keys to navigate.");
|
||||
ImGui::BulletText("Space to activate a widget.");
|
||||
ImGui::BulletText("Return to input text into a widget.");
|
||||
ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
|
||||
ImGui::BulletText("Alt to jump to the menu layer of a window.");
|
||||
ImGui::BulletText("CTRL+Tab to select a window.");
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -334,12 +337,20 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
if (ImGui::CollapsingHeader("Help"))
|
||||
{
|
||||
ImGui::Text("ABOUT THIS DEMO:");
|
||||
ImGui::BulletText("Sections below are demonstrating many aspects of the library.");
|
||||
ImGui::BulletText("The \"Examples\" menu above leads to more demo contents.");
|
||||
ImGui::BulletText("The \"Tools\" menu above gives access to: About Box, Style Editor,\n"
|
||||
"and Metrics (general purpose Dear ImGui debugging tool).");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("PROGRAMMER GUIDE:");
|
||||
ImGui::BulletText("Please see the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!");
|
||||
ImGui::BulletText("Please see the comments in imgui.cpp.");
|
||||
ImGui::BulletText("Please see the examples/ application.");
|
||||
ImGui::BulletText("Enable 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls.");
|
||||
ImGui::BulletText("Enable 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls.");
|
||||
ImGui::BulletText("See the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!");
|
||||
ImGui::BulletText("See comments in imgui.cpp.");
|
||||
ImGui::BulletText("See example applications in the examples/ folder.");
|
||||
ImGui::BulletText("Read the FAQ at http://www.dearimgui.org/faq/");
|
||||
ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls.");
|
||||
ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls.");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("USER GUIDE:");
|
||||
@ -416,7 +427,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
if (ImGui::TreeNode("Backend Flags"))
|
||||
{
|
||||
HelpMarker("Those flags are set by the back-ends (imgui_impl_xxx files) to specify their capabilities.");
|
||||
HelpMarker("Those flags are set by the back-ends (imgui_impl_xxx files) to specify their capabilities.\nHere we expose then as read-only fields to avoid breaking interactions with your back-end.");
|
||||
ImGuiBackendFlags backend_flags = io.BackendFlags; // Make a local copy to avoid modifying actual back-end flags.
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasGamepad);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseCursors);
|
||||
@ -431,6 +442,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
if (ImGui::TreeNode("Style"))
|
||||
{
|
||||
HelpMarker("The same contents can be accessed in 'Tools->Style Editor' or by calling the ShowStyleEditor() function.");
|
||||
ImGui::ShowStyleEditor();
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
@ -813,14 +825,14 @@ static void ShowDemoWindowWidgets()
|
||||
if (ImGui::TreeNode("UTF-8 Text"))
|
||||
{
|
||||
// UTF-8 test with Japanese characters
|
||||
// (Needs a suitable font, try Noto, or Arial Unicode, or M+ fonts. Read misc/fonts/README.txt for details.)
|
||||
// (Needs a suitable font, try Noto, or Arial Unicode, or M+ fonts. Read docs/FONTS.txt for details.)
|
||||
// - From C++11 you can use the u8"my text" syntax to encode literal strings as UTF-8
|
||||
// - For earlier compiler, you may be able to encode your sources as UTF-8 (e.g. Visual Studio save your file as 'UTF-8 without signature')
|
||||
// - FOR THIS DEMO FILE ONLY, BECAUSE WE WANT TO SUPPORT OLD COMPILERS, WE ARE *NOT* INCLUDING RAW UTF-8 CHARACTERS IN THIS SOURCE FILE.
|
||||
// Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application!
|
||||
// Please use u8"text in any language" in your application!
|
||||
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
||||
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->AddFontFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details.");
|
||||
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->AddFontFromFileTTF() manually to load extra character ranges. Read docs/FONTS.txt for details.");
|
||||
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
||||
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
||||
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
||||
@ -3164,11 +3176,17 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
||||
#ifdef IMGUI_DISABLE_WIN32_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_WIN32_FUNCTIONS");
|
||||
#endif
|
||||
#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS");
|
||||
#ifdef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS");
|
||||
#endif
|
||||
#ifdef IMGUI_DISABLE_MATH_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_MATH_FUNCTIONS");
|
||||
#ifdef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS");
|
||||
#endif
|
||||
#ifdef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS");
|
||||
#endif
|
||||
#ifdef IMGUI_DISABLE_FILE_FUNCTIONS
|
||||
ImGui::Text("define: IMGUI_DISABLE_FILE_FUNCTIONS");
|
||||
#endif
|
||||
#ifdef IMGUI_DISABLE_DEFAULT_ALLOCATORS
|
||||
ImGui::Text("define: IMGUI_DISABLE_DEFAULT_ALLOCATORS");
|
||||
@ -3316,7 +3334,7 @@ void ImGui::ShowFontSelector(const char* label)
|
||||
HelpMarker(
|
||||
"- Load additional fonts with io.Fonts->AddFontFromFileTTF().\n"
|
||||
"- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
|
||||
"- Read FAQ and documentation in misc/fonts/ for more details.\n"
|
||||
"- Read FAQ and docs/FONTS.txt for more details.\n"
|
||||
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
||||
}
|
||||
|
||||
@ -3444,7 +3462,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0)
|
||||
{
|
||||
// Tips: in a real user application, you may want to merge and use an icon font into the main font, so instead of "Save"/"Revert" you'd use icons.
|
||||
// Read the FAQ and misc/fonts/README.txt about using icon fonts. It's really easy and super convenient!
|
||||
// Read the FAQ and docs/FONTS.txt about using icon fonts. It's really easy and super convenient!
|
||||
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Save")) ref->Colors[i] = style.Colors[i];
|
||||
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Revert")) style.Colors[i] = ref->Colors[i];
|
||||
}
|
||||
@ -3462,7 +3480,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImFontAtlas* atlas = io.Fonts;
|
||||
HelpMarker("Read FAQ and misc/fonts/README.txt for details on font loading.");
|
||||
HelpMarker("Read FAQ and docs/FONTS.txt for details on font loading.");
|
||||
ImGui::PushItemWidth(120);
|
||||
for (int i = 0; i < atlas->Fonts.Size; i++)
|
||||
{
|
||||
@ -3482,17 +3500,17 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
ImGui::Text("Fallback character: '%c' (U+%04X)", font->FallbackChar, font->FallbackChar);
|
||||
ImGui::Text("Ellipsis character: '%c' (U+%04X)", font->EllipsisChar, font->EllipsisChar);
|
||||
const float surface_sqrt = sqrtf((float)font->MetricsTotalSurface);
|
||||
ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)surface_sqrt, (int)surface_sqrt);
|
||||
ImGui::Text("Texture Area: about %d px ~%dx%d px", font->MetricsTotalSurface, (int)surface_sqrt, (int)surface_sqrt);
|
||||
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
||||
if (const ImFontConfig* cfg = &font->ConfigData[config_i])
|
||||
ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH);
|
||||
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
||||
{
|
||||
// Display all glyphs of the fonts in separate pages of 256 characters
|
||||
for (int base = 0; base < 0x10000; base += 256)
|
||||
for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base += 256)
|
||||
{
|
||||
int count = 0;
|
||||
for (int n = 0; n < 256; n++)
|
||||
for (unsigned int n = 0; n < 256; n++)
|
||||
count += font->FindGlyphNoFallback((ImWchar)(base + n)) ? 1 : 0;
|
||||
if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base + 255, count, count > 1 ? "glyphs" : "glyph"))
|
||||
{
|
||||
@ -3500,7 +3518,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
float cell_spacing = style.ItemSpacing.y;
|
||||
ImVec2 base_pos = ImGui::GetCursorScreenPos();
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
for (int n = 0; n < 256; n++)
|
||||
for (unsigned int n = 0; n < 256; n++)
|
||||
{
|
||||
ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));
|
||||
ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);
|
||||
|
Reference in New Issue
Block a user