diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..2aa08b44 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: ['https://github.com/ocornut/imgui/wiki/Sponsors'] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a15d5e23..a8db3199 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -179,14 +179,6 @@ jobs: shell: cmd run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release' - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - Linux: runs-on: ubuntu-20.04 steps: @@ -318,15 +310,6 @@ jobs: - name: Build example_sdl_opengl3 run: make -C examples/example_sdl_opengl3 - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - MacOS: runs-on: macOS-latest steps: @@ -382,15 +365,6 @@ jobs: - name: Build example_apple_opengl2 run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2 - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - iOS: runs-on: macOS-latest steps: @@ -403,15 +377,6 @@ jobs: # Code signing is required, but we disable it because it is irrelevant for CI builds. xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_ios CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} - Emscripten: runs-on: ubuntu-18.04 steps: @@ -434,11 +399,33 @@ jobs: popd make -C examples/example_emscripten - # Use https://github.com/marketplace/actions/actions-status-discord to send status to Discord - - uses: sarisia/actions-status-discord@v1 - if: failure() + Discord-CI: + runs-on: ubuntu-18.04 + if: always() + needs: [Windows, Linux, MacOS, iOS, Emscripten] + steps: + - uses: dearimgui/github_discord_notifier@latest with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} + discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} + github-token: ${{ github.token }} + action-task: discord-jobs + discord-filter: "'{{ github.branch }}'.match(/master|docking|tables/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" + discord-username: GitHub Actions + discord-job-new-failure-message: '' + discord-job-fixed-failure-message: '' + discord-job-new-failure-embed: | + { + "title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!", + "description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke [{{ job.name }}]({{ job.url }}) build job.\nFailing steps: {{ failing_steps }}", + "url": "{{ job.url }}", + "color": "0xFF0000", + "timestamp": "{{ run.updated_at }}" + } + discord-job-fixed-failure-embed: | + { + "title": "`{{ github.branch }}` branch is no longer failing!", + "description": "Build failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.", + "color": "0x00FF00", + "url": "{{ github.context.payload.head_commit.url }}", + "timestamp": "{{ run.completed_at }}" + } diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 3681ecb2..0b7ef361 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -42,10 +42,33 @@ jobs: pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log plog-converter -a 'GA:1,2;OP:1' -t errorfile -w pvs-studio.log - - uses: sarisia/actions-status-discord@v1 - if: failure() - with: - webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} - username: GitHub Actions - color: 0xFF0000 - title: ${{ github.job }} + Discord-CI: + runs-on: ubuntu-18.04 + needs: [PVS-Studio] + if: always() + steps: + - uses: dearimgui/github_discord_notifier@latest + with: + discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} + github-token: ${{ github.token }} + action-task: discord-jobs + discord-filter: "'{{ github.branch }}'.match(/master|docking|tables/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" + discord-username: GitHub Actions + discord-job-new-failure-message: '' + discord-job-fixed-failure-message: '' + discord-job-new-failure-embed: | + { + "title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!", + "description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke static analysis [{{ job.name }}]({{ job.url }}) job.\nFailing steps: {{ failing_steps }}", + "url": "{{ job.url }}", + "color": "0xFF0000", + "timestamp": "{{ run.updated_at }}" + } + discord-job-fixed-failure-embed: | + { + "title": "`{{ github.branch }}` branch is no longer failing!", + "description": "Static analysis failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.", + "color": "0x00FF00", + "url": "{{ github.context.payload.head_commit.url }}", + "timestamp": "{{ run.completed_at }}" + } diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 207fd11c..6e4b8a25 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -101,20 +101,25 @@ Other changes: ----------------------------------------------------------------------- - VERSION 1.79 WIP (In Progress) + VERSION 1.79 (Released 2020-10-08) ----------------------------------------------------------------------- Breaking Changes: - Fonts: Removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied after scaling and not very meaningful/useful outside of being needed by the default ProggyClean font. - It was also getting in the way of better font scaling, so let's get rid of it now! + It was also getting in the way of better font scaling, so let's get rid of it now! If you used DisplayOffset it was probably in association to rasterizing a font at a specific size, in which case the corresponding offset may be reported into GlyphOffset. (#1619) + If you scaled this value after calling AddFontDefault(), this is now done automatically. +- ImGuiListClipper: Renamed constructor parameters which created an ambiguous alternative to using + the ImGuiListClipper::Begin() function, with misleading edge cases. Always use ImGuiListClipper::Begin()! + Kept inline redirection function (will obsolete). + (note: imgui_memory_editor <0.40 from imgui_club/ used this old clipper API. Update your copy if needed). - Style: Renamed style.TabMinWidthForUnselectedCloseButton to style.TabMinWidthForCloseButton. - Renamed ImGuiSliderFlags_ClampOnInput to ImGuiSliderFlags_AlwaysClamp. Kept redirection enum (will obsolete). - Renamed OpenPopupContextItem() back to OpenPopupOnItemClick(), REVERTED CHANGE FROM 1.77. - For variety of reason this is more self-explanatory. + For variety of reason this is more self-explanatory and less error-prone. Kept inline redirection function. - Removed return value from OpenPopupOnItemClick() - returned true on mouse release on item - because it is inconsistent with other popups API and makes others misleading. It's also and unnecessary: you can use IsWindowAppearing() after BeginPopup() for a similar result. @@ -124,8 +129,8 @@ Other Changes: - Window: Fixed using non-zero pivot in SetNextWindowPos() when the window is collapsed. (#3433) - Nav: Fixed navigation resuming on first visible item when using gamepad. [@rokups] - Nav: Fixed using Alt to toggle the Menu layer when inside a Modal window. (#787) -- Scrolling: Fixed SetScrollHere functions edge snapping when called during a frame where ContentSize - is changing (issue introduced in 1.78). (#3452). +- Scrolling: Fixed SetScrollHere(0) functions edge snapping when called during a frame where + ContentSize is changing (issue introduced in 1.78). (#3452). - InputText: Added support for Page Up/Down in InputTextMultiline(). (#3430) [@Xipiryon] - InputText: Added selection helpers in ImGuiInputTextCallbackData(). - InputText: Added ImGuiInputTextFlags_CallbackEdit to modify internally owned buffer after an edit. @@ -137,7 +142,7 @@ Other Changes: - InputText: Fixed cursor being partially covered after using Ctrl+End key. - InputText: Fixed callback's helper DeleteChars() function when cursor is inside the deleted block. (#3454) - InputText: Made pressing Down arrow on the last line when it doesn't have a carriage return not move to - the end of the line (so it is consistent with Up arrow, and behave same as Notepad and Visual Studio. + the end of the line (so it is consistent with Up arrow, and behave same as Notepad and Visual Studio. Note that some other text editors instead would move the crusor to the end of the line). [@Xipiryon] - DragFloat, DragScalar: Fixed ImGuiSliderFlags_ClampOnInput not being honored in the special case where v_min == v_max. (#3361) @@ -145,6 +150,8 @@ Other Changes: with signed and unsigned types. Added reverse Sliders to Demo. (#3432, #3449) [@rokups] - Text: Bypass unnecessary formatting when using the TextColored()/TextWrapped()/TextDisabled() helpers with a "%s" format string. (#3466) +- CheckboxFlags: Display mixed-value/tristate marker when passed flags that have multiple bits set and + stored value matches neither zero neither the full set. - BeginMenuBar: Fixed minor bug where CursorPosMax gets pushed to CursorPos prior to calling BeginMenuBar(), so e.g. calling the function at the end of a window would often add +ItemSpacing.y to scrolling range. - TreeNode, CollapsingHeader: Made clicking on arrow toggle toggle the open state on the Mouse Down event @@ -152,7 +159,7 @@ Other Changes: and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set. (This is also necessary to support full multi/range-select/drag and drop operations.) - Tab Bar: Added TabItemButton() to submit tab that behave like a button. (#3291) [@Xipiryon] -- Tab Bar: Added ImGuiTabItemFlags_Leading and ImGuiTabItemFlags_Trailing flags to position tabs or button +- Tab Bar: Added ImGuiTabItemFlags_Leading and ImGuiTabItemFlags_Trailing flags to position tabs or button at either end of the tab bar. Those tabs won't be part of the scrolling region, and when reordering cannot be moving outside of their section. Most often used with TabItemButton(). (#3291) [@Xipiryon] - Tab Bar: Added ImGuiTabItemFlags_NoReorder flag to disable reordering a given tab. @@ -167,9 +174,10 @@ Other Changes: - Popups, Tooltips: Fix edge cases issues with positionning popups and tooltips when they are larger than viewport on either or both axises. [@Rokups] - Fonts: AddFontDefault() adjust its vertical offset based on floor(size/13) instead of always +1. + Was previously done by altering DisplayOffset.y but wouldn't work for DPI scaled font. - Metrics: Various tweaks, listing windows front-to-back, greying inactive items when possible. - Demo: Add simple InputText() callbacks demo (aside from the more elaborate ones in 'Examples->Console'). -- Backends: OpenGL3: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 contexts which have +- Backends: OpenGL3: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 contexts which have the defines set by a loader. (#3467, #1985) [@jjwebb] - Backends: Vulkan: Some internal refactor aimed at allowing multi-viewport feature to create their own render pass. (#3455, #3459) [@FunMiles] diff --git a/docs/FAQ.md b/docs/FAQ.md index 2745b122..acc99ede 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -600,7 +600,7 @@ You may take a look at: - [Quotes](https://github.com/ocornut/imgui/wiki/Quotes) - [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) -- [Gallery](https://github.com/ocornut/imgui/issues/3075) +- [Gallery](https://github.com/ocornut/imgui/issues/3488) ##### [Return to Index](#index) @@ -646,7 +646,7 @@ There is an auto-generated [c-api for Dear ImGui (cimgui)](https://github.com/ci - Individuals: you can support continued maintenance and development via PayPal donations. See [README](https://github.com/ocornut/imgui/blob/master/docs/README.md). - If you are experienced with Dear ImGui and C++, look at the [GitHub Issues](https://github.com/ocornut/imgui/issues), look at the [Wiki](https://github.com/ocornut/imgui/wiki), read [docs/TODO.txt](https://github.com/ocornut/imgui/blob/master/docs/TODO.txt) and see how you want to help and can help! - Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc. -You may post screenshot or links in the [gallery threads](https://github.com/ocornut/imgui/issues/3075). Visuals are ideal as they inspire other programmers. Disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions. +You may post screenshot or links in the [gallery threads](https://github.com/ocornut/imgui/issues/3488). Visuals are ideal as they inspire other programmers. Disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions. - If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues or sometimes incomplete PR. ##### [Return to Index](#index) diff --git a/docs/README.md b/docs/README.md index f696b274..476540de 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,10 +5,12 @@ Dear ImGui (This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.) -Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts: +Businesses: support continued development and maintenance via invoiced technical support, maintenance, sponsoring contracts:
  _E-mail: contact @ dearimgui dot com_ -Individuals: support continued maintenance and development with [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S). +Individuals: support continued development and maintenance [here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S). + +Also see [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors) page. ---- @@ -18,7 +20,7 @@ Dear ImGui is designed to **enable fast iterations** and to **empower programmer Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard. -| [Usage](#usage) - [How it works](#how-it-works) - [Demo](#demo) - [Integration](#integration) | +| [Usage](#usage) - [How it works](#how-it-works) - [Releases](#releases) - [Demo](#demo) - [Integration](#integration) | :----------------------------------------------------------: | | [Upcoming changes](#upcoming-changes) - [Gallery](#gallery) - [Support, FAQ](#support-frequently-asked-questions-faq) - [How to help](#how-to-help) - [Sponsors](#sponsors) - [Credits](#credits) - [License](#license) | | [Wiki](https://github.com/ocornut/imgui/wiki) - [Language & frameworks bindings](https://github.com/ocornut/imgui/wiki/Bindings) - [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) - [User quotes](https://github.com/ocornut/imgui/wiki/Quotes) | @@ -36,7 +38,7 @@ You will need a backend to integrate Dear ImGui in your app. The backend passes After Dear ImGui is setup in your application, you can use it from \_anywhere\_ in your program loop: Code: -```cp +```cpp ImGui::Text("Hello, world %d", 123); if (ImGui::Button("Save")) MySaveFunction(); @@ -45,7 +47,7 @@ ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ``` Result:
![sample code output (dark)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v175/capture_readme_styles_0001.png) ![sample code output (light)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v175/capture_readme_styles_0002.png) -
_(settings: Dark style (left), Light style (right) / Font: Roboto-Medium, 16px / Rounding: 5)_ +
_(settings: Dark style (left), Light style (right) / Font: Roboto-Medium, 16px)_ Code: ```cpp @@ -91,6 +93,10 @@ Dear ImGui outputs vertex buffers and command lists that you can easily render i _A common misunderstanding is to mistake immediate mode gui for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the gui functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely._ +### Releases + +See [Releases](https://github.com/ocornut/imgui/releases) page. + ### Demo Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcasing variety of features and examples. The code is always available for reference in `imgui_demo.cpp`. @@ -132,7 +138,7 @@ Some of the goals for 2020 are: ### Gallery -For more user-submitted screenshots of projects using Dear ImGui, check out the [Gallery Threads](https://github.com/ocornut/imgui/issues/3075)! +For more user-submitted screenshots of projects using Dear ImGui, check out the [Gallery Threads](https://github.com/ocornut/imgui/issues/3488)! Custom engine [![screenshot game](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v149/gallery_TheDragonsTrap-01-thumb.jpg)](https://cloud.githubusercontent.com/assets/8225057/20628927/33e14cac-b329-11e6-80f6-9524e93b048a.png) @@ -165,7 +171,7 @@ Advanced users may want to use the `docking` branch with [Multi-Viewport](https: **Who uses Dear ImGui?** -See the [Quotes](https://github.com/ocornut/imgui/wiki/Quotes), [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors), [Software using dear imgui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) Wiki pages for an idea of who is using Dear ImGui. Please add your game/software if you can! Also see the [Gallery Threads](https://github.com/ocornut/imgui/issues/3075)! +See the [Quotes](https://github.com/ocornut/imgui/wiki/Quotes), [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors), [Software using dear imgui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) Wiki pages for an idea of who is using Dear ImGui. Please add your game/software if you can! Also see the [Gallery Threads](https://github.com/ocornut/imgui/issues/3488)! How to help ----------- @@ -179,12 +185,7 @@ How to help **How can I help financing further development of Dear ImGui?** -Your contributions are keeping this project alive. The library is available under a free and permissive license, but continued maintenance and development are a full-time endeavor and I would like to grow the team. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out for invoiced technical support and maintenance contracts. Thank you! - -Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts: -
  _E-mail: contact @ dearimgui.com_ - -Individuals: support continued maintenance and development with [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S). +See [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors) page. Sponsors -------- @@ -214,7 +215,7 @@ Developed by [Omar Cornut](http://www.miracleworld.net) and every direct or indi Recurring contributors (2020): Omar Cornut [@ocornut](https://github.com/ocornut), Rokas Kupstys [@rokups](https://github.com/rokups), Ben Carter [@ShironekoBen](https://github.com/ShironekoBen). A large portion of work on automation systems, regression tests and other features are currently unpublished. -"I first discovered the IMGUI paradigm at [Q-Games](http://www.q-games.com) where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it." +Omar: "I first discovered the IMGUI paradigm at [Q-Games](http://www.q-games.com) where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it." Embeds [ProggyClean.ttf](http://upperbounds.net) font by Tristan Grimmer (MIT license). diff --git a/examples/README.txt b/examples/README.txt index a1376fa3..d899fd89 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1,5 +1,5 @@ ----------------------------------------------------------------------- - dear imgui, v1.79 WIP + dear imgui, v1.79 ----------------------------------------------------------------------- examples/README.txt (This is the README file for the examples/ folder. See docs/ for more documentation) diff --git a/examples/example_glfw_opengl3/main.cpp b/examples/example_glfw_opengl3/main.cpp index c9e94c7e..b3d19f49 100644 --- a/examples/example_glfw_opengl3/main.cpp +++ b/examples/example_glfw_opengl3/main.cpp @@ -56,7 +56,7 @@ int main(int, char**) return 1; // Decide GL+GLSL versions -#if __APPLE__ +#ifdef __APPLE__ // GL 3.2 + GLSL 150 const char* glsl_version = "#version 150"; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); diff --git a/examples/example_sdl_opengl3/main.cpp b/examples/example_sdl_opengl3/main.cpp index 44068a79..0779157d 100644 --- a/examples/example_sdl_opengl3/main.cpp +++ b/examples/example_sdl_opengl3/main.cpp @@ -48,7 +48,7 @@ int main(int, char**) } // Decide GL+GLSL versions -#if __APPLE__ +#ifdef __APPLE__ // GL 3.2 Core + GLSL 150 const char* glsl_version = "#version 150"; SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac diff --git a/imgui.cpp b/imgui.cpp index 28a69ac1..6c7ca4b8 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.79 WIP +// dear imgui, v1.79 // (main code and documentation) // Help: @@ -11,7 +11,7 @@ // - FAQ http://dearimgui.org/faq // - Homepage & latest https://github.com/ocornut/imgui // - Releases & changelog https://github.com/ocornut/imgui/releases -// - Gallery https://github.com/ocornut/imgui/issues/3075 (please post your screenshots/video there!) +// - Gallery https://github.com/ocornut/imgui/issues/3488 (please post your screenshots/video there!) // - Glossary https://github.com/ocornut/imgui/wiki/Glossary // - Wiki https://github.com/ocornut/imgui/wiki // - Issues & support https://github.com/ocornut/imgui/issues @@ -94,14 +94,13 @@ CODE - Easy to use to create code-driven and data-driven tools. - Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools. - Easy to hack and improve. - - Minimize screen real-estate usage. - Minimize setup and maintenance. - Minimize state storage on user side. - Portable, minimize dependencies, run on target (consoles, phones, etc.). - - Efficient runtime and memory consumption (NB- we do allocate when "growing" content e.g. creating a window,. - opening a tree node for the first time, etc. but a typical frame should not allocate anything). + - Efficient runtime and memory consumption. + + Designed for developers and content-creators, not the typical end-user! Some of the current weaknesses includes: - Designed for developers and content-creators, not the typical end-user! Some of the weaknesses includes: - Doesn't look fancy, doesn't animate. - Limited layout features, intricate layouts are typically crafted in code. @@ -382,11 +381,13 @@ CODE If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos. - 2020/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api. + + - 2020/10/05 (1.79) - removed ImGuiListClipper: Renamed constructor parameters which created an ambiguous alternative to using the ImGuiListClipper::Begin() function, with misleading edge cases (note: imgui_memory_editor <0.40 from imgui_club/ used this old clipper API. Update your copy if needed). - 2020/09/25 (1.79) - renamed ImGuiSliderFlags_ClampOnInput to ImGuiSliderFlags_AlwaysClamp. Kept redirection enum (will obsolete sooner because previous name was added recently). - 2020/09/25 (1.79) - renamed style.TabMinWidthForUnselectedCloseButton to style.TabMinWidthForCloseButton. - 2020/09/21 (1.79) - renamed OpenPopupContextItem() back to OpenPopupOnItemClick(), reverting the change from 1.77. For varieties of reason this is more self-explanatory. - 2020/09/21 (1.79) - removed return value from OpenPopupOnItemClick() - returned true on mouse release on item - because it is inconsistent with other popup APIs and makes others misleading. It's also and unnecessary: you can use IsWindowAppearing() after BeginPopup() for a similar result. - - 2020/09/17 (1.79) - removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied after scaling and not very meaningful/useful outside of being needed by the default ProggyClean font. It was also getting in the way of better font scaling, so let's get rid of it now! + - 2020/09/17 (1.79) - removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied after scaling and not very meaningful/useful outside of being needed by the default ProggyClean font. If you scaled this value after calling AddFontDefault(), this is now done automatically. It was also getting in the way of better font scaling, so let's get rid of it now! - 2020/08/17 (1.78) - obsoleted use of the trailing 'float power=1.0f' parameter for DragFloat(), DragFloat2(), DragFloat3(), DragFloat4(), DragFloatRange2(), DragScalar(), DragScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4(), SliderScalar(), SliderScalarN(), VSliderFloat() and VSliderScalar(). replaced the 'float power=1.0f' argument with integer-based flags defaulting to 0 (as with all our flags). worked out a backward-compatibility scheme so hopefully most C++ codebase should not be affected. in short, when calling those functions: @@ -712,7 +713,7 @@ CODE - If you are experienced with Dear ImGui and C++, look at the github issues, look at the Wiki, read docs/TODO.txt and see how you want to help and can help! - Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc. - You may post screenshot or links in the gallery threads (github.com/ocornut/imgui/issues/3075). Visuals are ideal as they inspire other programmers. + You may post screenshot or links in the gallery threads (github.com/ocornut/imgui/issues/3488). Visuals are ideal as they inspire other programmers. But even without visuals, disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions. - If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues (on github or privately). @@ -2228,13 +2229,10 @@ static void SetCursorPosYAndSetupForPrevLine(float pos_y, float line_height) columns->LineMinY = window->DC.CursorPos.y; // Setting this so that cell Y position are set properly } -ImGuiListClipper::ImGuiListClipper(int items_count, float items_height) +ImGuiListClipper::ImGuiListClipper() { - DisplayStart = DisplayEnd = 0; + memset(this, 0, sizeof(*this)); ItemsCount = -1; - StepNo = 0; - ItemsHeight = StartPosY = 0.0f; - Begin(items_count, items_height); } ImGuiListClipper::~ImGuiListClipper() @@ -5497,7 +5495,6 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s // Resize grips and borders are on layer 1 window->DC.NavLayerCurrent = ImGuiNavLayer_Menu; - window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu); // Manual resize grips PushID("#RESIZE"); @@ -5566,7 +5563,6 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s // Restore nav layer window->DC.NavLayerCurrent = ImGuiNavLayer_Main; - window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); // Navigation resize (keyboard/gamepad) if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window) @@ -5781,7 +5777,6 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags; window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus; window->DC.NavLayerCurrent = ImGuiNavLayer_Menu; - window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu); // Layout buttons // FIXME: Would be nice to generalize the subtleties expressed here into reusable code. @@ -5817,7 +5812,6 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl *p_open = false; window->DC.NavLayerCurrent = ImGuiNavLayer_Main; - window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); window->DC.ItemFlags = item_flags_backup; // Title bar text (with: horizontal alignment, avoiding collapse/close button, optional "unsaved document" marker) @@ -6560,7 +6554,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f; window->DC.NavLayerCurrent = ImGuiNavLayer_Main; - window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext; window->DC.NavLayerActiveMaskNext = 0x00; window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; // -V595 @@ -7756,7 +7749,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg) // to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick). // We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null. // If we crash on a NULL g.NavWindow we need to fix the bug elsewhere. - window->DC.NavLayerActiveMaskNext |= window->DC.NavLayerCurrentMask; + window->DC.NavLayerActiveMaskNext |= (1 << window->DC.NavLayerCurrent); if (g.NavId == id || g.NavAnyRequest) if (g.NavWindow->RootWindowForNav == window->RootWindowForNav) if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened)) @@ -13277,7 +13270,6 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w { host_window->SkipItems = false; host_window->DC.NavLayerCurrent = ImGuiNavLayer_Menu; - host_window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu); } // Use PushOverrideID() instead of PushID() to use the node id _without_ the host window ID. @@ -13474,7 +13466,6 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w if (!node->IsDockSpace()) { host_window->DC.NavLayerCurrent = ImGuiNavLayer_Main; - host_window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); host_window->SkipItems = backup_skip_item; } } diff --git a/imgui.h b/imgui.h index 6d2faa0d..fd6a219e 100644 --- a/imgui.h +++ b/imgui.h @@ -1,4 +1,4 @@ -// dear imgui, v1.79 WIP +// dear imgui, v1.79 // (headers) // Help: @@ -11,7 +11,7 @@ // - FAQ http://dearimgui.org/faq // - Homepage & latest https://github.com/ocornut/imgui // - Releases & changelog https://github.com/ocornut/imgui/releases -// - Gallery https://github.com/ocornut/imgui/issues/3075 (please post your screenshots/video there!) +// - Gallery https://github.com/ocornut/imgui/issues/3488 (please post your screenshots/video there!) // - Glossary https://github.com/ocornut/imgui/wiki/Glossary // - Wiki https://github.com/ocornut/imgui/wiki // - Issues & support https://github.com/ocornut/imgui/issues @@ -60,8 +60,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.79 WIP" -#define IMGUI_VERSION_NUM 17803 +#define IMGUI_VERSION "1.79" +#define IMGUI_VERSION_NUM 17900 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch #define IMGUI_HAS_DOCK 1 // Docking WIP branch @@ -1385,7 +1385,7 @@ enum ImGuiSliderFlags_ // Obsolete names (will be removed) #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - , ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79] + , ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp // [renamed in 1.79] #endif }; @@ -1483,8 +1483,8 @@ struct ImVector inline int size_in_bytes() const { return Size * (int)sizeof(T); } inline int max_size() const { return 0x7FFFFFFF / (int)sizeof(T); } inline int capacity() const { return Capacity; } - inline T& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; } - inline const T& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; } + inline T& operator[](int i) { IM_ASSERT(i >= 0 && i < Size); return Data[i]; } + inline const T& operator[](int i) const { IM_ASSERT(i >= 0 && i < Size); return Data[i]; } inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } inline T* begin() { return Data; } @@ -1990,38 +1990,45 @@ struct ImGuiStorage }; // Helper: Manually clip large list of items. -// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all. +// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse +// clipping based on visibility to save yourself from processing those items at all. // The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. -// ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null. +// (Dear ImGui already clip items based on their bounds but it needs to measure text size to do so, whereas manual coarse clipping before submission makes this cost and your own data fetching/submission cost almost null) // Usage: -// ImGuiListClipper clipper(1000); // we have 1000 elements, evenly spaced. -// while (clipper.Step()) -// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) -// ImGui::Text("line number %d", i); -// - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor). -// - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element. -// - (Step 2: empty step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.) -// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop. +// ImGuiListClipper clipper; +// clipper.Begin(1000); // We have 1000 elements, evenly spaced. +// while (clipper.Step()) +// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) +// ImGui::Text("line number %d", i); +// Generally what happens is: +// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not. +// - User code submit one element. +// - Clipper can measure the height of the first element +// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element. +// - User code submit visible elements. struct ImGuiListClipper { int DisplayStart; int DisplayEnd; - int ItemsCount; // [Internal] + int ItemsCount; int StepNo; float ItemsHeight; float StartPosY; - // items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step). - // items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing(). - // If you don't specify an items_height, you NEED to call Step(). If you specify items_height you may call the old Begin()/End() api directly, but prefer calling Step(). - ImGuiListClipper(int items_count = -1, float items_height = -1.0f); - ~ImGuiListClipper(); + IMGUI_API ImGuiListClipper(); + IMGUI_API ~ImGuiListClipper(); + // items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step) + // items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing(). IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1. IMGUI_API void End(); // Automatically called on the last call of Step() that returns false. IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79] +#endif }; // Helpers macros to generate 32-bit encoded colors diff --git a/imgui_demo.cpp b/imgui_demo.cpp index afbc5d7f..5384ccd5 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.79 WIP +// dear imgui, v1.79 // (demo code) // Help: @@ -1143,27 +1143,34 @@ static void ShowDemoWindowWidgets() } if (ImGui::TreeNode("Grid")) { - static int selected[4 * 4] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; - for (int i = 0; i < 4 * 4; i++) - { - ImGui::PushID(i); - if (ImGui::Selectable("Sailor", selected[i] != 0, 0, ImVec2(50, 50))) + static char selected[4][4] = { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } }; + + // Add in a bit of silly fun... + const float time = (float)ImGui::GetTime(); + const bool winning_state = memchr(selected, 0, sizeof(selected)) == NULL; // If all cells are selected... + if (winning_state) + ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f + 0.5f * cosf(time * 2.0f), 0.5f + 0.5f * sinf(time * 3.0f))); + + for (int y = 0; y < 4; y++) + for (int x = 0; x < 4; x++) { - // Toggle - selected[i] = !selected[i]; - - // Note: We _unnecessarily_ test for both x/y and i here only to silence some static analyzer. - // The second part of each test is unnecessary. - int x = i % 4; - int y = i / 4; - if (x > 0) { selected[i - 1] ^= 1; } - if (x < 3 && i < 15) { selected[i + 1] ^= 1; } - if (y > 0 && i > 3) { selected[i - 4] ^= 1; } - if (y < 3 && i < 12) { selected[i + 4] ^= 1; } + if (x > 0) + ImGui::SameLine(); + ImGui::PushID(y * 4 + x); + if (ImGui::Selectable("Sailor", selected[y][x] != 0, 0, ImVec2(50, 50))) + { + // Toggle clicked cell + toggle neighbors + selected[y][x] ^= 1; + if (x > 0) { selected[y][x - 1] ^= 1; } + if (x < 3) { selected[y][x + 1] ^= 1; } + if (y > 0) { selected[y - 1][x] ^= 1; } + if (y < 3) { selected[y + 1][x] ^= 1; } + } + ImGui::PopID(); } - if ((i % 4) < 3) ImGui::SameLine(); - ImGui::PopID(); - } + + if (winning_state) + ImGui::PopStyleVar(); ImGui::TreePop(); } if (ImGui::TreeNode("Alignment")) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 35811054..d98af051 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.79 WIP +// dear imgui, v1.79 // (drawing and font code) /* diff --git a/imgui_internal.h b/imgui_internal.h index e1b4e47d..c975092b 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1,4 +1,4 @@ -// dear imgui, v1.79 WIP +// dear imgui, v1.79 // (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! @@ -1679,9 +1679,8 @@ struct IMGUI_API ImGuiWindowTempData // Keyboard/Gamepad navigation ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1) - int NavLayerCurrentMask; // = (1 << NavLayerCurrent) used by ItemAdd prior to clipping. - int NavLayerActiveMask; // Which layer have been written to (result from previous frame) - int NavLayerActiveMaskNext; // Which layer have been written to (buffer for current frame) + int NavLayerActiveMask; // Which layers have been written to (result from previous frame) + int NavLayerActiveMaskNext; // Which layers have been written to (accumulator for current frame) ImGuiID NavFocusScopeIdCurrent; // Current focus scope ID while appending bool NavHideHighlightOneFrame; bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f) @@ -1726,7 +1725,6 @@ struct IMGUI_API ImGuiWindowTempData NavLayerActiveMask = NavLayerActiveMaskNext = 0x00; NavLayerCurrent = ImGuiNavLayer_Main; - NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); NavFocusScopeIdCurrent = 0; NavHideHighlightOneFrame = false; NavHasScroll = false; diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 618d9c2d..3aed17c1 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.79 WIP +// dear imgui, v1.79 // (widgets code) /* @@ -1078,7 +1078,8 @@ bool ImGui::Checkbox(const char* label, bool* v) RenderNavHighlight(total_bb, id); RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding); ImU32 check_col = GetColorU32(ImGuiCol_CheckMark); - if (window->DC.ItemFlags & ImGuiItemFlags_MixedValue) + bool mixed_value = (window->DC.ItemFlags & ImGuiItemFlags_MixedValue) != 0; + if (mixed_value) { // Undocumented tristate/mixed/indeterminate checkbox (#2644) ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f))); @@ -1091,7 +1092,7 @@ bool ImGui::Checkbox(const char* label, bool* v) } if (g.LogEnabled) - LogRenderedText(&total_bb.Min, *v ? "[x]" : "[ ]"); + LogRenderedText(&total_bb.Min, mixed_value ? "[~]" : *v ? "[x]" : "[ ]"); if (label_size.x > 0.0f) RenderText(ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y), label); @@ -1102,7 +1103,21 @@ bool ImGui::Checkbox(const char* label, bool* v) bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value) { bool v = ((*flags & flags_value) == flags_value); - bool pressed = Checkbox(label, &v); + bool pressed; + if (v == false && (*flags & flags_value) != 0) + { + // Mixed value (FIXME: find a way to expose neatly to Checkbox?) + ImGuiWindow* window = GetCurrentWindow(); + const ImGuiItemFlags backup_item_flags = window->DC.ItemFlags; + window->DC.ItemFlags |= ImGuiItemFlags_MixedValue; + pressed = Checkbox(label, &v); + window->DC.ItemFlags = backup_item_flags; + } + else + { + // Regular checkbox + pressed = Checkbox(label, &v); + } if (pressed) { if (v) @@ -3840,7 +3855,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ return false; } draw_window = g.CurrentWindow; // Child window - draw_window->DC.NavLayerActiveMaskNext |= draw_window->DC.NavLayerCurrentMask; // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it. + draw_window->DC.NavLayerActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it. inner_size.x -= draw_window->ScrollbarSizes.x; } else @@ -6472,7 +6487,6 @@ bool ImGui::BeginMenuBar() window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y); window->DC.LayoutType = ImGuiLayoutType_Horizontal; window->DC.NavLayerCurrent = ImGuiNavLayer_Menu; - window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu); window->DC.MenuBarAppending = true; AlignTextToFramePadding(); return true; @@ -6515,7 +6529,6 @@ void ImGui::EndMenuBar() EndGroup(); // Restore position on layer 0 window->DC.LayoutType = ImGuiLayoutType_Vertical; window->DC.NavLayerCurrent = ImGuiNavLayer_Main; - window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main); window->DC.MenuBarAppending = false; } @@ -7972,6 +7985,7 @@ bool ImGui::TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, text_pixel_clip_bb.Max.x -= close_button_sz; } + // FIXME: if FramePadding is noticeably large, ellipsis_max_x will be wrong here (e.g. #3497), maybe for consistency that parameter of RenderTextEllipsis() shouldn't exist.. float ellipsis_max_x = close_button_visible ? text_pixel_clip_bb.Max.x : bb.Max.x - 1.0f; RenderTextEllipsis(draw_list, text_ellipsis_clip_bb.Min, text_ellipsis_clip_bb.Max, text_pixel_clip_bb.Max.x, ellipsis_max_x, label, NULL, &label_size); diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index 3d62dc4b..412411a9 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -338,8 +338,8 @@ bool ImFontAtlasBuildWithFreeType(FT_Library ft_library, ImFontAtlas* atlas, uns ImVector dst_tmp_array; src_tmp_array.resize(atlas->ConfigData.Size); dst_tmp_array.resize(atlas->Fonts.Size); - memset(src_tmp_array.Data, 0, (size_t)src_tmp_array.size_in_bytes()); - memset(dst_tmp_array.Data, 0, (size_t)dst_tmp_array.size_in_bytes()); + memset((void*)src_tmp_array.Data, 0, (size_t)src_tmp_array.size_in_bytes()); + memset((void*)dst_tmp_array.Data, 0, (size_t)dst_tmp_array.size_in_bytes()); // 1. Initialize font loading structure, check font data validity for (int src_i = 0; src_i < atlas->ConfigData.Size; src_i++)