From 4b353ce482eccde65d426513f26f2ab11dbae384 Mon Sep 17 00:00:00 2001 From: Tesla Ice Zhang Date: Sat, 15 Sep 2018 15:41:07 -0400 Subject: [PATCH 01/10] Fix file names (#2083) --- docs/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index 06b8cb40..8dd9eed6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,9 +25,9 @@ Dear ImGui is self-contained within a few files that you can easily copy and com - imgui_widgets.cpp - imgui_internal.h - imconfig.h (empty by default, user-editable) -- stb_rect_pack.h -- stb_textedit.h -- stb_truetype.h +- imstb_rect_pack.h +- imstb_textedit.h +- imstb_truetype.h No specific build process is required. You can add the .cpp files to your project or #include them from an existing file. From 571676ebd2d0c687eb438382e40028ae7008bffc Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 17 Sep 2018 13:15:57 +0200 Subject: [PATCH 02/10] Added Fonts readme details and links to Sweet16 font. (#2085) --- misc/fonts/README.txt | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/misc/fonts/README.txt b/misc/fonts/README.txt index 06e74e9b..a40bb3d1 100644 --- a/misc/fonts/README.txt +++ b/misc/fonts/README.txt @@ -1,9 +1,11 @@ -The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' (by Tristan Grimmer) that is used by default. -We embed the font in source code so you can use Dear ImGui without any file system access. +The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' (by Tristan Grimmer), +a 13 pixels high, pixel-perfect font used by default. +We embed it font in source code so you can use Dear ImGui without any file system access. + You may also load external .TTF/.OTF files. The files in this folder are suggested fonts, provided as a convenience. -(Note: .OTF support in stb_truetype.h currently doesn't appear to load every font) +(Note: .OTF support in imstb_truetype.h currently doesn't appear to load every font) Fonts are rasterized in a single texture at the time of calling either of io.Fonts->GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build(). Also read dear imgui FAQ in imgui.cpp! @@ -11,6 +13,7 @@ Also read dear imgui FAQ in imgui.cpp! If you have other loading/merging/adding fonts, you can post on the Dear ImGui "Getting Started" forum: https://discourse.dearimgui.org/c/getting-started + --------------------------------------- INDEX: --------------------------------------- @@ -35,7 +38,7 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui " u8"hello" u8"こんにちは" // this will be encoded as UTF-8 - If you want to include a backslash \ character in your string literal, you need to double them e.g. "folder\\filename". - - Please use the Discourse forum (https://discourse.dearimgui.org) and not the Github issue tracker. + - Please use the Discourse forum (https://discourse.dearimgui.org) and not the Github issue tracker for basic font loading questions. --------------------------------------- @@ -68,7 +71,11 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui " io.Fonts->AddFontFromFileTTF("fonts/fontawesome-webfont.ttf", 13.0f, &config, icon_ranges); // Usage, e.g. - ImGui::Button(ICON_FA_SEARCH " Search"); // C string literals can be concatenated at compilation time, this is the same as "A" "B" becoming "AB" + ImGui::Button(ICON_FA_SEARCH " Search"); + // C string _literals_ can be concatenated at compilation time, e.g. "hello" " world" + // ICON_FA_SEARCH is defined as a string literal so this is the same as "A" "B" becoming "AB" + + // Usage, e.g. ImGui::Text("%s among %d items", ICON_FA_SEARCH, count); See Links below for other icons fonts and related tools. @@ -124,12 +131,13 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui " // Add character ranges and merge into the previous font // The ranges array is not copied by the AddFont* functions and is used lazily - // so ensure it is available for duration of font usage - static const ImWchar icons_ranges[] = { 0xf000, 0xf3ff, 0 }; // will not be copied by AddFont* so keep in scope. + // so ensure it is available at the time of building or calling GetTexDataAsRGBA32(). + static const ImWchar icons_ranges[] = { 0xf000, 0xf3ff, 0 }; // Will not be copied by AddFont* so keep in scope. ImFontConfig config; config.MergeMode = true; io.Fonts->AddFontFromFileTTF("DroidSans.ttf", 18.0f, &config, io.Fonts->GetGlyphRangesJapanese()); io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 18.0f, &config, icons_ranges); + io.Fonts->Build(); Add a fourth parameter to bake specific font ranges only: @@ -153,12 +161,15 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui " FREETYPE RASTERIZER, SMALL FONT SIZES --------------------------------------- - Dear Imgui uses stb_truetype.h to rasterize fonts (with optional oversampling). - This technique and implementation are not ideal for fonts rendered at _small sizes_, which may appear a little blurry. + Dear ImGui uses imstb_truetype.h to rasterize fonts (with optional oversampling). + This technique and its implementation are not ideal for fonts rendered at _small sizes_, which may appear a + little blurry or hard to read. + There is an implementation of the ImFontAtlas builder using FreeType that you can use in the misc/freetype/ folder. FreeType supports auto-hinting which tends to improve the readability of small fonts. - Note that this code currently creates textures that are unoptimally too large (could be fixed with some work) + Note that this code currently creates textures that are unoptimally too large (could be fixed with some work). + Also note that correct sRGB space blending will have an important effect on your font rendering quality. --------------------------------------- @@ -174,7 +185,9 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui " builder.AddChar(0x7262); // Add a specific character builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted) + io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, ranges.Data); + io.Fonts->Build(); // Build the atlas while 'ranges' is still in scope and not deleted. --------------------------------------- @@ -242,6 +255,10 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui " (Icons) IcoMoon - Custom Icon font builder https://icomoon.io/app + (Pixel perfect) Sweet16, Sweet16 Mono, by Martin Sedlak (Latin + Supplemental + Extended A) + https://github.com/kmar/Sweet16Font + Also include .inl file to use directly in dear imgui. + (Regular) Open Sans Fonts https://fonts.google.com/specimen/Open+Sans From 0b190f11b9b8d7dfa7acafe99d941acde02ddf90 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 18 Sep 2018 18:04:32 +0200 Subject: [PATCH 03/10] Contributing, Issue Template --- .github/CONTRIBUTING.md | 6 +++--- .github/issue_template.md | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c438fc23..4fe220b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -18,7 +18,7 @@ You may use the Issue Tracker to submit bug reports, feature requests or suggest **Guidelines to report an issue or ask a question:** - Please provide your imgui version number. - Please state if you have made substantial modifications to your copy of imgui. -- Try to be explicit with your expectations and what you have tried. What you have in mind or in your code is not obvious to other people. +- Try to be explicit with your Goals, your Expectations and what you have Tried. What you have in mind or in your code is not obvious to other people. People frequently discuss problems without first mentioning their goal. - If you are discussing an assert or a crash, please provide a debugger callstack. Never state "it crashes" without additional information. If you don't know how to use a debugger and retrieve a callstack, learning about it will be useful. - Please make sure that your compilation settings have asserts enabled. Calls to IM_ASSERT() are scattered in the code to help catch common issues. By default IM_ASSERT() calls the standard assert() function. To verify that your asserts are enabled, add the line `IM_ASSERT(false);` in your main() function. Your application should display an error message and abort. If your application report an error, it means that your asserts are disabled. Please make sure they are enabled. - When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of the example back-ends (imgui_impl_XXX files), or a modified one, or if you built your own. @@ -27,10 +27,10 @@ You may use the Issue Tracker to submit bug reports, feature requests or suggest - When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.). **Some unfortunate words of warning** -- If you are or were involved in cheating schemes (e.g. DLL injection) for competitive online multi-player games, please don't post here. We won't answer and you will be blocked. We've had too many of you. Please stop. +- If you are or were involved in cheating schemes (e.g. DLL injection) for competitive online multi-player games, please don't post here. We won't answer and you will be blocked. We've had too many of you. - Due to frequent abuse of this service from aforementioned users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and incomplete questions may be dismissed. -If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users or members of the community will know what information are useful in a given context. +If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users or members of the community will know which information are useful in a given context. ## How to create an Pull Request - When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.). diff --git a/.github/issue_template.md b/.github/issue_template.md index 7aedc959..e434a545 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -1,13 +1,13 @@ -IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS, please post on the "Getting Started" Discourse forum: +(Click "Preview" to turn any http URL into a clickable link) + +1. IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS, please post on the "Getting Started" Discourse forum: https://discourse.dearimgui.org/c/getting-started -Otherwise, you may use this Issue Tracker to ask for help and submit bug reports, feature requests or suggestions. PLEASE CAREFULLY READ THIS DOCUMENT before submitting any issue: -https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md -(Click "Preview" to turn the URL above into a clickable link) +2. You may use this Issue Tracker to ask for help and submit bug reports, feature requests or suggestions that don't fit in any category of (1). PLEASE CAREFULLY READ THE CONTRIBUTING DOCUMENT before submitting any issue: https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md -PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of ShowDemoWindow() including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the CONTRIBUTING.md file linked above. +3. PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of ShowDemoWindow() including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the CONTRIBUTING.md file linked above. -(Delete everything above this section before submitting your issue.) +4. Delete points 1-4 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue. ---- @@ -23,6 +23,8 @@ Compiler: XXX _(if the question is related to building)_ **My Issue/Question:** _(please provide context)_ +XXX + **Standalone, minimal, complete and verifiable example:** _(see CONTRIBUTING.md)_ ``` ImGui::Begin("Example Bug"); From 3d318a65777c48d2c1839e8d02dcd3f2da32c308 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 20 Sep 2018 10:24:29 +0200 Subject: [PATCH 04/10] ArrowButton(): Fixed arrow shape being horizontally misaligned by (FramePadding.y-FramePadding.x) if they are different. Demo: Added extra usage of AlignTextToFramePadding() in a more visible section. --- docs/CHANGELOG.txt | 3 ++- imgui_demo.cpp | 10 ++++++++-- imgui_widgets.cpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index fc378283..0c422723 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -46,7 +46,8 @@ Other Changes: - DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024) - DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024) - BeginMenu(): Fixed menu popup horizontal offset being off the item in the menu bar when WindowPadding=0.0f. - +- ArrowButton(): Fixed arrow shape being horizontally misaligned by (FramePadding.y-FramePadding.x) if they are different. + ----------------------------------------------------------------------- VERSION 1.65 (Released 2018-09-06) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index c3aa63a3..ee536121 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -389,7 +389,8 @@ void ImGui::ShowDemoWindow(bool* p_open) // Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style. for (int i = 0; i < 7; i++) { - if (i > 0) ImGui::SameLine(); + if (i > 0) + ImGui::SameLine(); ImGui::PushID(i); ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.6f)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.7f)); @@ -399,7 +400,12 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::PopID(); } - // Arrow buttons + // Use AlignTextToFramePadding() to align text baseline to the baseline of framed elements (otherwise a Text+SameLine+Button sequence will have the text a little too high by default) + ImGui::AlignTextToFramePadding(); + ImGui::Text("Hold to repeat:"); + ImGui::SameLine(); + + // Arrow buttons with Repeater static int counter = 0; float spacing = ImGui::GetStyle().ItemInnerSpacing.x; ImGui::PushButtonRepeat(true); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 2f559579..67650e2d 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -626,7 +626,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); RenderNavHighlight(bb, id); RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding); - RenderArrow(bb.Min + ImVec2(ImMax(0.0f, size.x - g.FontSize - g.Style.FramePadding.x), ImMax(0.0f, size.y - g.FontSize - g.Style.FramePadding.y)), dir); + RenderArrow(bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), dir); return pressed; } From 7c3b9172adbedb2ebf6e97b5d4ae47814900bc5a Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 20 Sep 2018 10:37:55 +0200 Subject: [PATCH 05/10] Examples: Referring to missing gamepad support in back-end that are missing it. --- examples/imgui_impl_allegro5.cpp | 4 ++-- examples/imgui_impl_allegro5.h | 5 +++-- examples/imgui_impl_freeglut.cpp | 1 + examples/imgui_impl_freeglut.h | 1 + examples/imgui_impl_glfw.cpp | 2 +- examples/imgui_impl_glfw.h | 2 +- examples/imgui_impl_sdl.cpp | 1 + examples/imgui_impl_sdl.h | 1 + examples/imgui_impl_win32.cpp | 2 ++ examples/imgui_impl_win32.h | 2 ++ 10 files changed, 15 insertions(+), 6 deletions(-) diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp index ef99bf15..9a9c5801 100644 --- a/examples/imgui_impl_allegro5.cpp +++ b/examples/imgui_impl_allegro5.cpp @@ -5,9 +5,9 @@ // [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. // [X] Platform: Clipboard support (from Allegro 5.1.12) // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. - // Issues: -// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert the format of vertices. +// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually. +// [ ] Platform: Missing gamepad support. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. diff --git a/examples/imgui_impl_allegro5.h b/examples/imgui_impl_allegro5.h index a7792bcc..bc995a5a 100644 --- a/examples/imgui_impl_allegro5.h +++ b/examples/imgui_impl_allegro5.h @@ -3,10 +3,11 @@ // Implemented features: // [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. +// [X] Platform: Clipboard support (from Allegro 5.1.12) // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. // Issues: -// [ ] Renderer: The renderer is suboptimal as we need to convert vertices. -// [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text. +// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually. +// [ ] Platform: Missing gamepad support. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp index 983bfd68..4058876a 100644 --- a/examples/imgui_impl_freeglut.cpp +++ b/examples/imgui_impl_freeglut.cpp @@ -3,6 +3,7 @@ // Issues: // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I +// [ ] Platform: Missing gamepad support. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. diff --git a/examples/imgui_impl_freeglut.h b/examples/imgui_impl_freeglut.h index fc030bb9..6289ed4d 100644 --- a/examples/imgui_impl_freeglut.h +++ b/examples/imgui_impl_freeglut.h @@ -3,6 +3,7 @@ // Issues: // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I +// [ ] Platform: Missing gamepad support. // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp index 82ccb7a2..753909ed 100644 --- a/examples/imgui_impl_glfw.cpp +++ b/examples/imgui_impl_glfw.cpp @@ -4,7 +4,7 @@ // Implemented features: // [X] Platform: Clipboard support. -// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. +// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE). diff --git a/examples/imgui_impl_glfw.h b/examples/imgui_impl_glfw.h index 0b5bc89e..a9bab99d 100644 --- a/examples/imgui_impl_glfw.h +++ b/examples/imgui_impl_glfw.h @@ -4,7 +4,7 @@ // Implemented features: // [X] Platform: Clipboard support. -// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. +// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE). diff --git a/examples/imgui_impl_sdl.cpp b/examples/imgui_impl_sdl.cpp index 0189468c..fed0c831 100644 --- a/examples/imgui_impl_sdl.cpp +++ b/examples/imgui_impl_sdl.cpp @@ -8,6 +8,7 @@ // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). // Missing features: // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. +// [ ] Platform: Gamepad support (need to use SDL_GameController API to fill the io.NavInputs[] value when ImGuiConfigFlags_NavEnableGamepad is set). // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. diff --git a/examples/imgui_impl_sdl.h b/examples/imgui_impl_sdl.h index ec75af42..7fb2b864 100644 --- a/examples/imgui_impl_sdl.h +++ b/examples/imgui_impl_sdl.h @@ -8,6 +8,7 @@ // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). // Missing features: // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. +// [ ] Platform: Gamepad support (need to use SDL_GameController API to fill the io.NavInputs[] value when ImGuiConfigFlags_NavEnableGamepad is set). // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index d6935a4b..6cf8d630 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -5,6 +5,8 @@ // [X] Platform: Clipboard support (for Win32 this is actually part of core imgui) // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). +// Missing features: +// [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice). #include "imgui.h" #include "imgui_impl_win32.h" diff --git a/examples/imgui_impl_win32.h b/examples/imgui_impl_win32.h index 6b91f48b..ed4f419b 100644 --- a/examples/imgui_impl_win32.h +++ b/examples/imgui_impl_win32.h @@ -5,6 +5,8 @@ // [X] Platform: Clipboard support (for Win32 this is actually part of core imgui) // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). +// Missing features: +// [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice). IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); From 5719b23e013125711ae040db3758e519657eaf6d Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 21 Sep 2018 10:00:26 +0200 Subject: [PATCH 06/10] ImDrawList: Fixed AddConvexPolyFilled() undefined behavior when passing points_count smaller than 3, in particular, points_count==0 could lead to a memory stomp if the draw list was previously empty. --- docs/CHANGELOG.txt | 2 ++ imgui_draw.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 0c422723..e43262c8 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -47,6 +47,8 @@ Other Changes: - DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024) - BeginMenu(): Fixed menu popup horizontal offset being off the item in the menu bar when WindowPadding=0.0f. - ArrowButton(): Fixed arrow shape being horizontally misaligned by (FramePadding.y-FramePadding.x) if they are different. +- ImDrawList: Fixed AddConvexPolyFilled() undefined behavior when passing points_count smaller than 3, + in particular, points_count==0 could lead to a memory stomp if the draw list was previously empty. ----------------------------------------------------------------------- diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 12f094db..658aab0c 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -822,6 +822,9 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col) { + if (points_count < 3) + return; + const ImVec2 uv = _Data->TexUvWhitePixel; if (Flags & ImDrawListFlags_AntiAliasedFill) From 788febf04497d960cd1d71ad46c77848d5c8593c Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 24 Sep 2018 10:13:01 +0200 Subject: [PATCH 07/10] Examples: Vulkan: Fixed some minor discrepency in the SDL+Vulkan example to match the Glfw+Vulkan example. (cc #2097) --- examples/example_glfw_vulkan/main.cpp | 4 ++-- examples/example_sdl_vulkan/main.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/example_glfw_vulkan/main.cpp b/examples/example_glfw_vulkan/main.cpp index 8e875fe1..adaa45d5 100644 --- a/examples/example_glfw_vulkan/main.cpp +++ b/examples/example_glfw_vulkan/main.cpp @@ -189,12 +189,12 @@ static void SetupVulkanWindowData(ImGui_ImplVulkanH_WindowData* wd, VkSurfaceKHR exit(-1); } - // Get Surface Format + // Select Surface Format const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM }; const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR; wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace); - // Get Present Mode + // Select Present Mode #ifdef IMGUI_UNLIMITED_FRAME_RATE VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR }; #else diff --git a/examples/example_sdl_vulkan/main.cpp b/examples/example_sdl_vulkan/main.cpp index 0af71bec..dc7da3ea 100644 --- a/examples/example_sdl_vulkan/main.cpp +++ b/examples/example_sdl_vulkan/main.cpp @@ -186,18 +186,19 @@ static void SetupVulkanWindowData(ImGui_ImplVulkanH_WindowData* wd, VkSurfaceKHR exit(-1); } - // Get Surface Format + // Select Surface Format const VkFormat requestSurfaceImageFormat[] = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8_UNORM, VK_FORMAT_R8G8B8_UNORM }; const VkColorSpaceKHR requestSurfaceColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR; wd->SurfaceFormat = ImGui_ImplVulkanH_SelectSurfaceFormat(g_PhysicalDevice, wd->Surface, requestSurfaceImageFormat, (size_t)IM_ARRAYSIZE(requestSurfaceImageFormat), requestSurfaceColorSpace); - // Get Present Mode + // Select Present Mode #ifdef IMGUI_UNLIMITED_FRAME_RATE - VkPresentModeKHR present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR; + VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR }; #else - VkPresentModeKHR present_mode = VK_PRESENT_MODE_FIFO_KHR; + VkPresentModeKHR present_modes[] = { VK_PRESENT_MODE_FIFO_KHR }; #endif - wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_mode, 1); + wd->PresentMode = ImGui_ImplVulkanH_SelectPresentMode(g_PhysicalDevice, wd->Surface, &present_modes[0], IM_ARRAYSIZE(present_modes)); + //printf("[vulkan] Selected PresentMode = %d\n", wd->PresentMode); // Create SwapChain, RenderPass, Framebuffer, etc. ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(g_PhysicalDevice, g_Device, g_QueueFamily, wd, g_Allocator); From 781a7950d764c44ab59b520f01b2946adcce313a Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 24 Sep 2018 11:33:26 +0200 Subject: [PATCH 08/10] ImVector: Fixed a oddly unqualified return type in the assignment operator (I assume C++ handles it nicely as this never warned anywhere, but it is completely unintentional). --- imgui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.h b/imgui.h index 3372e80f..2a35aa11 100644 --- a/imgui.h +++ b/imgui.h @@ -1255,7 +1255,7 @@ public: inline ImVector() { Size = Capacity = 0; Data = NULL; } inline ~ImVector() { if (Data) ImGui::MemFree(Data); } inline ImVector(const ImVector& src) { Size = Capacity = 0; Data = NULL; operator=(src); } - inline ImVector& operator=(const ImVector& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; } + inline ImVector& operator=(const ImVector& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; } inline bool empty() const { return Size == 0; } inline int size() const { return Size; } From a7d3ae8937a9c7cd5b3cd3f7d55c906a24f7d6ad Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 26 Sep 2018 21:23:42 +0200 Subject: [PATCH 09/10] BeginChild(): Fixed BeginChild(const char*, ...) variation erroneously not applying the ID stack to the provided string to uniquely identify the child window. This was undoing an intentional change introduced in 1.50 and broken in 1.60. (#1698, #894, #713) + reworked the Begin/BeginChild comments in imgui.h. --- docs/CHANGELOG.txt | 7 ++++++- imgui.cpp | 4 ++-- imgui.h | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e43262c8..f74db7f8 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -45,6 +45,9 @@ Other Changes: erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075). - DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024) - DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024) +- BeginChild(): Fixed BeginChild(const char*, ...) variation erroneously not applying the ID stack + to the provided string to uniquely identify the child window. This was undoing an intentional change + introduced in 1.50 and broken in 1.60. (#1698, #894, #713). - BeginMenu(): Fixed menu popup horizontal offset being off the item in the menu bar when WindowPadding=0.0f. - ArrowButton(): Fixed arrow shape being horizontally misaligned by (FramePadding.y-FramePadding.x) if they are different. - ImDrawList: Fixed AddConvexPolyFilled() undefined behavior when passing points_count smaller than 3, @@ -336,6 +339,9 @@ Breaking Changes: - Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now. - Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData. - Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it should be easy to replicate on your side (you can find the code in 1.53). +- [EDITED] Window: BeginChild() with an explicit name doesn't include the hash within the internal window name. (#1698) + This change was erroneously introduced, undoing the change done for #894, #713, and not documented properly in the original + 1.60 release Changelog. It was fixed on 2018-09-28 (1.66) and I wrote this paragraph the same day. Other Changes: @@ -544,7 +550,6 @@ Other Changes: - Window: Using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. (#1380, #1502) - Window: Active Modal window always set the WantCaptureKeyboard flag. (#744) - Window: Moving window doesn't use accumulating MouseDelta so straying out of imgui boundaries keeps moved imgui window at the same cursor-relative position. -- Window: BeginChild() which an explicit name doesn't include the hash within the internal window name. (#1698) - IsWindowFocused(): Added ImGuiFocusedFlags_ChildWindows flag to include child windows in the focused test. (#1382). - IsWindowFocused(): Added ImGuiFocusedFlags_RootWindow flag to start focused test from the root (top-most) window. Obsolete IsRootWindowFocused(). (#1382) - IsWindowHovered(): Added ImGuiHoveredFlags_ChildWindows flag to include child windows in the hovered test. (#1382). diff --git a/imgui.cpp b/imgui.cpp index ffe5b407..d46fb3d7 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4036,10 +4036,10 @@ static bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size size.y = ImMax(content_avail.y + size.y, 4.0f); SetNextWindowSize(size); - // Name + // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value. char title[256]; if (name) - ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s", parent_window->Name, name); + ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s_%08X", parent_window->Name, name, id); else ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id); diff --git a/imgui.h b/imgui.h index 2a35aa11..4b9c074c 100644 --- a/imgui.h +++ b/imgui.h @@ -189,14 +189,20 @@ namespace ImGui IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font // Windows - // (Begin = push window to the stack and start appending to it. End = pop window from the stack. You may append multiple times to the same window during the same frame) - // Begin()/BeginChild() return false to indicate the window being collapsed or fully clipped, so you may early out and omit submitting anything to the window. - // You need to always call a matching End()/EndChild() for a Begin()/BeginChild() call, regardless of its return value (this is due to legacy reason and is inconsistent with BeginMenu/EndMenu, BeginPopup/EndPopup and other functions where the End call should only be called if the corresponding Begin function returned true.) - // Passing 'bool* p_open != NULL' shows a close widget in the upper-right corner of the window, which when clicking will set the boolean to false. - // Use child windows to introduce independent scrolling/clipping regions within a host window. Child windows can embed their own child. + // - Begin() = push window to the stack and start appending to it. End() = pop window from the stack. + // - You may append multiple times to the same window during the same frame. + // - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked. + // - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. + // Always call a matching End() for each Begin() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.] IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); IMGUI_API void End(); - IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0); // Begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400). + + // Child Windows + // - Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child. + // - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400). + // - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. + // Always call a matching EndChild() for each BeginChild() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.] + IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0); IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0); IMGUI_API void EndChild(); From 61d94ff88e480e9a76c85709de68b59b0906cb3a Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 26 Sep 2018 21:30:37 +0200 Subject: [PATCH 10/10] Renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete). --- docs/CHANGELOG.txt | 4 ++++ imgui.cpp | 9 +++++---- imgui.h | 8 +++++--- imgui_demo.cpp | 12 ++++++------ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index f74db7f8..67422c4f 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -33,6 +33,10 @@ HOW TO UPDATE? VERSION 1.66 (In Progress) ----------------------------------------------------------------------- +Breaking Changes: + +- Renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete). + Other Changes: - Fixed calling DestroyContext() always saving .ini data with the current context instead diff --git a/imgui.cpp b/imgui.cpp index d46fb3d7..3245ac2e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -342,6 +342,7 @@ CODE When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. + - 2018/09/28 (1.66) - renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete). - 2018/09/06 (1.65) - renamed stb_truetype.h to imstb_truetype.h, stb_textedit.h to imstb_textedit.h, and stb_rect_pack.h to imstb_rectpack.h. If you were conveniently using the imgui copy of those STB headers in your project you will have to update your include paths. - 2018/09/05 (1.65) - renamed io.OptCursorBlink/io.ConfigCursorBlink to io.ConfigInputTextCursorBlink. (#1427) @@ -1992,12 +1993,12 @@ void ImGuiTextBuffer::appendf(const char* fmt, ...) static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height) { - // Set cursor position and a few other things so that SetScrollHere() and Columns() can work when seeking cursor. + // Set cursor position and a few other things so that SetScrollHereY() and Columns() can work when seeking cursor. // FIXME: It is problematic that we have to do that here, because custom/equivalent end-user code would stumble on the same issue. // The clipper should probably have a 4th step to display the last item in a regular manner. ImGui::SetCursorPosY(pos_y); ImGuiWindow* window = ImGui::GetCurrentWindow(); - window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y - line_height; // Setting those fields so that SetScrollHere() can properly function after the end of our clipper usage. + window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y - line_height; // Setting those fields so that SetScrollHereY() can properly function after the end of our clipper usage. window->DC.PrevLineSize.y = (line_height - GImGui->Style.ItemSpacing.y); // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list. if (window->DC.ColumnsSet) window->DC.ColumnsSet->LineMinY = window->DC.CursorPos.y; // Setting this so that cell Y position are set properly @@ -6013,7 +6014,7 @@ void ImGui::SetScrollFromPosY(float pos_y, float center_y_ratio) } // center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item. -void ImGui::SetScrollHere(float center_y_ratio) +void ImGui::SetScrollHereY(float center_y_ratio) { ImGuiWindow* window = GetCurrentWindow(); float target_y = window->DC.CursorPosPrevLine.y - window->Pos.y; // Top of last item, in window space @@ -6048,7 +6049,7 @@ void ImGui::SetItemDefaultFocus() g.NavInitResultRectRel = ImRect(g.NavWindow->DC.LastItemRect.Min - g.NavWindow->Pos, g.NavWindow->DC.LastItemRect.Max - g.NavWindow->Pos); NavUpdateAnyRequestFlag(); if (!IsItemVisible()) - SetScrollHere(); + SetScrollHereY(); } } diff --git a/imgui.h b/imgui.h index 4b9c074c..616a805e 100644 --- a/imgui.h +++ b/imgui.h @@ -247,7 +247,7 @@ namespace ImGui IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()] IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()] - IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. + IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. // Parameters stacks (shared) @@ -521,8 +521,8 @@ namespace ImGui IMGUI_API void PopClipRect(); // Focus, Activation - // (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHere()" when applicable, to make your code more forward compatible when navigation branch is merged) - IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item". + // (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item") + IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. // Utilities @@ -1210,6 +1210,8 @@ struct ImGuiIO #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS namespace ImGui { + // OBSOLETED in 1.66 (from Sep 2018) + static inline void SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); } // OBSOLETED in 1.63 (from Aug 2018) static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); } // OBSOLETED in 1.61 (from Apr 2018) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index ee536121..18178f28 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1511,10 +1511,10 @@ void ImGui::ShowDemoWindow(bool* p_open) { ImGui::Text("%04d: scrollable region", i); if (goto_line && line == i) - ImGui::SetScrollHere(); + ImGui::SetScrollHereY(); } if (goto_line && line >= 100) - ImGui::SetScrollHere(); + ImGui::SetScrollHereY(); ImGui::EndChild(); } @@ -1773,7 +1773,7 @@ void ImGui::ShowDemoWindow(bool* p_open) if (ImGui::TreeNode("Scrolling")) { - ImGui::TextWrapped("(Use SetScrollHere() or SetScrollFromPosY() to scroll to a given position.)"); + ImGui::TextWrapped("(Use SetScrollHereY() or SetScrollFromPosY() to scroll to a given position.)"); static bool track = true; static int track_line = 50, scroll_to_px = 200; ImGui::Checkbox("Track", &track); @@ -1797,7 +1797,7 @@ void ImGui::ShowDemoWindow(bool* p_open) if (track && line == track_line) { ImGui::TextColored(ImColor(255,255,0), "Line %d", line); - ImGui::SetScrollHere(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom + ImGui::SetScrollHereY(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom } else { @@ -2892,7 +2892,7 @@ struct ExampleAppConsole if (copy_to_clipboard) ImGui::LogFinish(); if (ScrollToBottom) - ImGui::SetScrollHere(1.0f); + ImGui::SetScrollHereY(1.0f); ScrollToBottom = false; ImGui::PopStyleVar(); ImGui::EndChild(); @@ -3134,7 +3134,7 @@ struct ExampleAppLog } if (ScrollToBottom) - ImGui::SetScrollHere(1.0f); + ImGui::SetScrollHereY(1.0f); ScrollToBottom = false; ImGui::EndChild(); ImGui::End();