diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 6b5f13d12..2474bcf8e 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -94,21 +94,22 @@ Other changes: ----------------------------------------------------------------------- - VERSION 1.69 (In Progress) + VERSION 1.69 (Released 2019-03-13) ----------------------------------------------------------------------- Breaking Changes: - Renamed ColorEdit/ColorPicker's ImGuiColorEditFlags_RGB/_HSV/_HEX flags to respectively - ImGuiColorEditFlags_DisplayRGB/_DisplayHSV/_DisplayHex. This is anticipation of adding new - flags to ColorEdit/ColorPicker functions which would make those ambiguous. (#2384) [@haldean] + ImGuiColorEditFlags_DisplayRGB/_DisplayHSV/_DisplayHex. This is because the addition of + new flag ImGuiColorEditFlags_InputHSV makes the earlier one ambiguous. + Keep redirection enum values (will obsolete). (#2384) [@haldean] - Renamed GetOverlayDrawList() to GetForegroundDrawList(). Kept redirection function (will obsolete). (#2391) Other Changes: - Added GetBackgroundDrawList() helper to quickly get access to a ImDrawList that will be rendered - behind every other windows. (#2391) -- DragScalar, InputScalar, SliderScalar: Added support for u8/s8/u16/s16 data types. + behind every other windows. (#2391, #545) +- DragScalar, InputScalar, SliderScalar: Added support for u8/s8/u16/s16 data types (ImGuiDataType_S8, etc.) We are reusing function instances of larger types to reduce code size. (#643, #320, #708, #1011) - Added InputTextWithHint() to display a description/hint in the text box when no text has been entered. (#2400) [@Organic-Code, @ocornut] @@ -134,17 +135,22 @@ Other Changes: - ColorEdit: Fixed tooltip not honoring the ImGuiColorEditFlags_NoAlpha contract of never reading the 4th float in the array (value was read and discarded). (#2384) [@haldean] - MenuItem, Selectable: Fixed disabled widget interfering with navigation (fix c2db7f63 in 1.67). -- TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371) +- TabBar: Fixed a crash when using many BeginTabBar() recursively (didn't affect docking). (#2371) - TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to hard crashes any more, facilitating integration with scripting languages. (#1651) - TabBar: Fixed ImGuiTabItemFlags_SetSelected being ignored if the tab is not visible (with scrolling policy enabled) or if is currently appearing. -- Text: Fixed large Text/TextUnformatted call not declaring its size when starting below the - lower point of the current clipping rectangle. Somehow this bug has been there since v1.0! +- TabBar: Fixed Tab tooltip code making drag and drop tooltip disappear during the frame where + the drag payload activate a tab. +- TabBar: Reworked scrolling policy (when ImGuiTabBarFlags_FittingPolicyScroll is set) to + teleport the view when aiming at a tab far away the visible section, and otherwise accelerate + the scrolling speed to cap the scrolling time to 0.3 seconds. +- Text: Fixed large Text/TextUnformatted calls not feeding their size into layout when starting + below the lower point of the current clipping rectangle. This bug has been there since v1.0! It was hardly noticeable but would affect the scrolling range, which in turn would affect - some scrolling request functions when called during the opening frame of a window. + some scrolling request functions when called during the appearing frame of a window. - Plot: Fixed divide-by-zero in PlotLines() when passing a count of 1. (#2387) [@Lectem] -- Log/Capture: Fixed extraneous leading carriage return. +- Log/Capture: Fixed LogXXX functions emitting extraneous leading carriage return. - Log/Capture: Fixed an issue when empty string on a new line would not emit a carriage return. - Log/Capture: Fixed LogXXX functions 'auto_open_depth' parameter being treated as an absolute tree depth instead of a relative one. @@ -632,7 +638,7 @@ Other Changes: - InputFloat,InputFloat2,InputFloat3,InputFloat4: Added variations taking a more flexible and consistent optional "const char* format" parameter instead of "int decimal_precision". This allow using custom formats to display values in scientific notation, and is generally more consistent with other API. - Obsoleted functions using the optional "int decimal_precision" parameter. (#648) + Obsoleted functions using the optional "int decimal_precision" parameter. (#648, #712) - DragFloat, DragInt: Cancel mouse tweak when current value is initially past the min/max boundaries and mouse is pushing in the same direction (keyboard/gamepad version already did this). - DragFloat, DragInt: Honor natural type limits (e.g. INT_MAX, FLT_MAX) instead of wrapping around. (#708, #320) diff --git a/docs/README.md b/docs/README.md index 96d3e6d82..88f562dbc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -305,10 +305,10 @@ Ongoing dear imgui development is financially supported by users and private spo - Media Molecule, Mobigame, Aras Pranckevičius, Greggman, DotEmu, Nadeo, Supercell, Runner, Aiden Koss, Kylotonn. **Salty caramel supporters** -- Recognition Robotics, ikrima, Geoffrey Evans, Mercury Labs, Singularity Demo Group, Lionel Landwerlin, Ron Gilbert, Brandon Townsend, Nikhil Deshpande, Cort Stratton, drudru, Harfang 3D, Jeff Roberts, Rainway inc, Ondra Voves, Mesh Consultants. +- Recognition Robotics, ikrima, Geoffrey Evans, Mercury Labs, Singularity Demo Group, Lionel Landwerlin, Ron Gilbert, Brandon Townsend, Nikhil Deshpande, Cort Stratton, drudru, Harfang 3D, Jeff Roberts, Rainway inc, Ondra Voves, Mesh Consultants, Unit 2 Games. **Caramel supporters** -- Jerome Lanquetot, Daniel Collin, Ctrl Alt Ninja, Neil Henning, Neil Blakey-Milner, Aleksei, NeiloGD, Eric, Game Atelier, Vincent Hamm, Colin Riley, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, Josh Faust, Martin Donlon, Codecat, Doug McNabb, Emmanuel Julien, Guillaume Chereau, Jeffrey Slutter, Jeremiah Deckard, r-lyeh, Nekith, Joshua Fisher, Malte Hoffmann, Mustafa Karaalioglu, Merlyn Morgan-Graham, Per Vognsen, Fabian Giesen, Jan Staubach, Matt Hargett, John Shearer, Jesse Chounard, kingcoopa, Jonas Bernemann, Johan Andersson, Michael Labbe, Tomasz Golebiowski, Louis Schnellbach, Jimmy Andrews, Bojan Endrovski, Robin Berg Pettersen, Rachel Crawford, Andrew Johnson, Sean Hunter, Jordan Mellow, Nefarius Software Solutions, Laura Wieme, Robert Nix, Mick Honey, Steven Kah Hien Wong, Bartosz Bielecki, Oscar Penas, A M, Liam Moynihan, Artometa, Mark Lee, Dimitri Diakopoulos, Pete Goodwin. +- Jerome Lanquetot, Daniel Collin, Ctrl Alt Ninja, Neil Henning, Neil Blakey-Milner, Aleksei, NeiloGD, Eric, Game Atelier, Vincent Hamm, Colin Riley, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, Josh Faust, Martin Donlon, Codecat, Doug McNabb, Emmanuel Julien, Guillaume Chereau, Jeffrey Slutter, Jeremiah Deckard, r-lyeh, Nekith, Joshua Fisher, Malte Hoffmann, Mustafa Karaalioglu, Merlyn Morgan-Graham, Per Vognsen, Fabian Giesen, Jan Staubach, Matt Hargett, John Shearer, Jesse Chounard, kingcoopa, Jonas Bernemann, Johan Andersson, Michael Labbe, Tomasz Golebiowski, Louis Schnellbach, Jimmy Andrews, Bojan Endrovski, Robin Berg Pettersen, Rachel Crawford, Andrew Johnson, Sean Hunter, Jordan Mellow, Nefarius Software Solutions, Laura Wieme, Robert Nix, Mick Honey, Steven Kah Hien Wong, Bartosz Bielecki, Oscar Penas, A M, Liam Moynihan, Artometa, Mark Lee, Dimitri Diakopoulos, Pete Goodwin, Johnathan Roatch, nyu lea, Oswald Hurlem. And all other past and present supporters; THANK YOU! (Please contact me if you would like to be added or removed from this list) diff --git a/docs/TODO.txt b/docs/TODO.txt index 13a97c4b5..220528df3 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -59,6 +59,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - widgets: alignment options in style (e.g. center Selectable, Right-Align within Button, etc.) #1260 - widgets: activate by identifier (trigger button, focus given id) - widgets: a way to represent "mixed" values, so e.g. all values replaced with **, including check-boxes, colors, etc. with support for multi-components widgets (e.g. SliderFloat3, make only "Y" mixed) + - widgets: selectable: generic BeginSelectable()/EndSelectable() mechanism. + - widgets: selectable: a way to visualize partial/mixed selection (e.g. parent tree node has children with mixed selection) - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile. - input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541) diff --git a/examples/README.txt b/examples/README.txt index 946807a4b..3a25fcf7e 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1,3 +1,5 @@ +----------------------------------------------------------------------- + dear imgui, v1.69 ----------------------------------------------------------------------- examples/README.txt (This is the README file for the examples/ folder. See docs/ for more documentation) @@ -27,7 +29,7 @@ This folder contains two things: They are the in the XXXX_example/ sub-folders. You can find binaries of some of those example applications at: - http://www.miracleworld.net/imgui/binaries + http://www.dearimgui.org/binaries --------------------------------------- diff --git a/examples/example_allegro5/README.md b/examples/example_allegro5/README.md index 1a83fe894..fb58fdbec 100644 --- a/examples/example_allegro5/README.md +++ b/examples/example_allegro5/README.md @@ -1,7 +1,7 @@ # Configuration -Dear ImGui outputs 16-bit vertex indices by default. +Dear ImGui outputs 16-bit vertex indices by default. Allegro doesn't support them natively, so we have two solutions: convert the indices manually in imgui_impl_allegro5.cpp, or compile imgui with 32-bit indices. You can either modify imconfig.h that comes with Dear ImGui (easier), or set a C++ preprocessor option IMGUI_USER_CONFIG to find to a filename. We are providing `imconfig_allegro5.h` that enables 32-bit indices. @@ -9,14 +9,24 @@ Note that the back-end supports _BOTH_ 16-bit and 32-bit indices, but 32-bit ind # How to Build -- On Ubuntu 14.04+ +### On Ubuntu 14.04+ ```bash g++ -DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" -I .. -I ../.. main.cpp ../imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_primitives -o allegro5_example ``` -- On Windows with Visual Studio's CLI +### On Windows with Visual Studio's CLI +You may install Allegro using vcpkg: +``` +git clone https://github.com/Microsoft/vcpkg +cd vcpkg +.\bootstrap-vcpkg.bat +.\vcpkg install allegro5 +.\vcpkg integrate install ; optional, automatically register include/libs in Visual Studio +``` + +Build: ``` set ALLEGRODIR=path_to_your_allegro5_folder cl /Zi /MD /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" /I .. /I ..\.. main.cpp ..\imgui_impl_allegro5.cpp ..\..\imgui*.cpp /link /LIBPATH:%ALLEGRODIR%\lib allegro-5.0.10-monolith-md.lib user32.lib diff --git a/examples/imgui_impl_opengl3.cpp b/examples/imgui_impl_opengl3.cpp index c16b37148..34a845fa5 100644 --- a/examples/imgui_impl_opengl3.cpp +++ b/examples/imgui_impl_opengl3.cpp @@ -43,7 +43,7 @@ // version version string //---------------------------------------- // 2.0 110 "#version 110" -// 2.1 110 "#version 120" +// 2.1 120 "#version 120" // 3.0 130 "#version 130" // 3.1 140 "#version 140" // 3.2 150 "#version 150" diff --git a/imgui.cpp b/imgui.cpp index 89b553565..4bbb4f4d1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.69 WIP +// dear imgui, v1.69 // (main code and documentation) // Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code. @@ -8003,7 +8003,7 @@ static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, con // Process Move Request (scoring for navigation) // FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRectScreen + scoring from a rect wrapped according to current wrapping policy) - if ((g.NavId != id || (g.NavMoveRequestFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) && !(item_flags & ImGuiItemFlags_NoNav)) + if ((g.NavId != id || (g.NavMoveRequestFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) && !(item_flags & (ImGuiItemFlags_Disabled|ImGuiItemFlags_NoNav))) { ImGuiNavMoveResult* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; #if IMGUI_DEBUG_NAV_SCORING diff --git a/imgui.h b/imgui.h index 7fe6cf6b7..95b4a1fc6 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.69 WIP +// dear imgui, v1.69 // (headers) // See imgui.cpp file for documentation. @@ -46,8 +46,8 @@ Index of this file: // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) -#define IMGUI_VERSION "1.69 WIP" -#define IMGUI_VERSION_NUM 16899 +#define IMGUI_VERSION "1.69" +#define IMGUI_VERSION_NUM 16900 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert)) #define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch #define IMGUI_HAS_DOCK 1 // Docking WIP branch diff --git a/imgui_demo.cpp b/imgui_demo.cpp index dad6bc48d..56bc9f623 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.69 WIP +// dear imgui, v1.69 // (demo code) // Message to the person tempted to delete this file when integrating Dear ImGui into their code base: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 824d01a62..8e546b40c 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.69 WIP +// dear imgui, v1.69 // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index 26b2c5b06..24a868369 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.69 WIP +// dear imgui, v1.69 // (internal structures/api) // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! @@ -1508,6 +1508,8 @@ struct ImGuiTabBar float OffsetNextTab; // Distance from BarRect.Min.x, incremented with each BeginTabItem() call, not used if ImGuiTabBarFlags_Reorderable if set. float ScrollingAnim; float ScrollingTarget; + float ScrollingTargetDistToVisibility; + float ScrollingSpeed; ImGuiTabBarFlags Flags; ImGuiID ReorderRequestTabId; int ReorderRequestDir; diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index d9ebc9dfb..0bea66817 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.69 WIP +// dear imgui, v1.69 // (widgets code) /* @@ -5310,7 +5310,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl if (flags & ImGuiSelectableFlags_Disabled) { ImGuiItemFlags backup_item_flags = window->DC.ItemFlags; - window->DC.ItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus; + window->DC.ItemFlags |= ImGuiItemFlags_Disabled | ImGuiItemFlags_NoNavDefaultFocus; item_add = ItemAdd(bb, id); window->DC.ItemFlags = backup_item_flags; } @@ -6100,7 +6100,7 @@ ImGuiTabBar::ImGuiTabBar() CurrFrameVisible = PrevFrameVisible = -1; ContentsHeight = 0.0f; OffsetMax = OffsetNextTab = 0.0f; - ScrollingAnim = ScrollingTarget = 0.0f; + ScrollingAnim = ScrollingTarget = ScrollingTargetDistToVisibility = ScrollingSpeed = 0.0f; Flags = ImGuiTabBarFlags_None; ReorderRequestTabId = 0; ReorderRequestDir = 0; @@ -6406,9 +6406,19 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) TabBarScrollToTab(tab_bar, scroll_track_selected_tab); tab_bar->ScrollingAnim = TabBarScrollClamp(tab_bar, tab_bar->ScrollingAnim); tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget); - const float scrolling_speed = (tab_bar->PrevFrameVisible + 1 < g.FrameCount) ? FLT_MAX : (g.IO.DeltaTime * g.FontSize * 70.0f); if (tab_bar->ScrollingAnim != tab_bar->ScrollingTarget) - tab_bar->ScrollingAnim = ImLinearSweep(tab_bar->ScrollingAnim, tab_bar->ScrollingTarget, scrolling_speed); + { + // Scrolling speed adjust itself so we can always reach our target in 1/3 seconds. + // Teleport if we are aiming far off the visible line + tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, 70.0f * g.FontSize); + tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, ImFabs(tab_bar->ScrollingTarget - tab_bar->ScrollingAnim) / 0.3f); + const bool teleport = (tab_bar->PrevFrameVisible + 1 < g.FrameCount) || (tab_bar->ScrollingTargetDistToVisibility > 10.0f * g.FontSize); + tab_bar->ScrollingAnim = teleport ? tab_bar->ScrollingTarget : ImLinearSweep(tab_bar->ScrollingAnim, tab_bar->ScrollingTarget, g.IO.DeltaTime * tab_bar->ScrollingSpeed); + } + else + { + tab_bar->ScrollingSpeed = 0.0f; + } // Clear name buffers if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0) @@ -6504,10 +6514,17 @@ static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) int order = tab_bar->GetTabOrder(tab); float tab_x1 = tab->Offset + (order > 0 ? -margin : 0.0f); float tab_x2 = tab->Offset + tab->Width + (order + 1 < tab_bar->Tabs.Size ? margin : 1.0f); + tab_bar->ScrollingTargetDistToVisibility = 0.0f; if (tab_bar->ScrollingTarget > tab_x1) + { + tab_bar->ScrollingTargetDistToVisibility = ImMax(tab_bar->ScrollingAnim - tab_x2, 0.0f); tab_bar->ScrollingTarget = tab_x1; - if (tab_bar->ScrollingTarget + tab_bar->BarRect.GetWidth() < tab_x2) + } + else if (tab_bar->ScrollingTarget < tab_x2 - tab_bar->BarRect.GetWidth()) + { + tab_bar->ScrollingTargetDistToVisibility = ImMax((tab_x1 - tab_bar->BarRect.GetWidth()) - tab_bar->ScrollingAnim, 0.0f); tab_bar->ScrollingTarget = tab_x2 - tab_bar->BarRect.GetWidth(); + } } void ImGui::TabBarQueueChangeTabOrder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int dir) @@ -6899,7 +6916,8 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, window->DC.CursorPos = backup_main_cursor_pos; // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer) - if (g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > 0.50f) + // We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar (which g.HoveredId ignores) + if (g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > 0.50f && IsItemHovered()) if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip)) SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label); diff --git a/misc/fonts/README.txt b/misc/fonts/README.txt index 37a095a93..7122e3ade 100644 --- a/misc/fonts/README.txt +++ b/misc/fonts/README.txt @@ -1,3 +1,7 @@ +dear imgui, v1.69 +(Font Readme) + +--------------------------------------- The code in imgui.cpp embeds a copy of 'ProggyClean.ttf' (by Tristan Grimmer), a 13 pixels high, pixel-perfect font used by default. @@ -5,7 +9,6 @@ We embed it font in source code so you can use Dear ImGui without any file syste You may also load external .TTF/.OTF files. The files in this folder are suggested fonts, provided as a convenience. -(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! @@ -32,7 +35,8 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui " README FIRST / FAQ --------------------------------------- -- You can use the style editor ImGui::ShowStyleEditor() to browse your fonts and understand what's going on if you have an issue. +- You can use the style editor ImGui::ShowStyleEditor() in the "Fonts" section to browse your fonts + and understand what's going on if you have an issue. - Make sure your font ranges data are persistent (available during the call to GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build(). - Use C++11 u8"my text" syntax to encode literal strings as UTF-8. e.g.: u8"hello" @@ -201,7 +205,8 @@ For example: for a game where your script is known, if you can feed your entire Compile and use 'binary_to_compressed_c.cpp' to create a compressed C style array that you can embed in source code. See the documentation in binary_to_compressed_c.cpp for instruction on how to use the tool. You may find a precompiled version binary_to_compressed_c.exe for Windows instead of demo binaries package (see README). -The tool optionally used Base85 encoding to reduce the size of _source code_ but the read-only arrays will be about 20% bigger. +The tool can optionally output Base85 encoding to reduce the size of _source code_ but the read-only arrays in the +actual binary will be about 20% bigger. Then load the font with: ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels, ...);