Skip to content

Releases: imgui-rs/imgui-rs

v0.12.0

05 May 02:59
@dbr dbr
Compare
Choose a tag to compare

Main changes

  • Updated many dependencies - in particular the new winit release is a bit change.
  • Fix some unsaftey issue in the handling of text - PR #746
  • Added Io::add_key_analog_event for supporting analog key events such as gamepad sticks - PR #728
  • Added begin_popup_context_* methods - PR #738
  • Use correct alpha blending function (problem described here) - PR #756
  • Minimum supported version of Rust (MSRV) is now 1.70 - PR #747

Automatic notes

What's Changed

New Contributors

Full Changelog: v0.11.0...v0.12.0

v0.11.0

05 Apr 12:35
@dbr dbr
Compare
Choose a tag to compare

Main Changes

  • Added API to add callbacks to draw list for advanced custom drawing - PR#702
  • Added OwnedDrawData API for usage like multithreaded renderers - PR#721
  • MSRV bumped to 1.64 (will likely still work in 1.60 with pinning of some indirect dependencies) - PR#718
  • Examples now use copypasta crate for clipboard handling, as it is more maintained - PR#715
  • Update glow to 0.12 (from v0.10)- PR#711 (and also PR#712)
  • Fixed handling of modifiers keys - PR#710
  • There is a new "viewport" renderer which uses the docking branch's multi-viewport handling! - PR#619

Automatic notes

What's Changed

New Contributors

Full Changelog: v0.10.0...v0.11.0

v0.10.0

16 Jan 09:36
@dbr dbr
Compare
Choose a tag to compare

Main changes

Most notable change is the update from Dear ImGui 1.89.2 (previously was on v1.87). As it impacts the Rust bindings, the most significant change is the event based IO system, which is now used by the winit and sd2l support crates by default. As with the upstream change, this should be backwards compatible with old platform-support code (i.e no changes should be required), but updating to the new should be quite straight forward, might result in simpler code, and acts better at low frame rates (e.g when there are multiple mouse-clicks within one frame)

See the upstream changelogs for more details: 1.88, 1.89, 1.89.1, 1.89.2

The freetype feature should be easier to use on Windows by being able source freetype via vcpkg (in addition to pkg-config more typically used on Linux)

Finally, the examples have been rearranged to be more consistent, and hopefully easier to find. Mainly just all the crates now have an examples folder (with the exception of the low-level imgui-sys crate), and there is an example of how to use imgui-glium-renderer which is consistent with imgui-glow-renderer

Thanks everyone for the PR's and the testing/feedback in the Issues section!

Automatic notes

What's Changed

  • Removing im_str! marco by @dbr in #680
  • Implement DataTypeKind for usize and isize by @Ararem in #693
  • Update ImGui and use event-based io by @Rob2309 in #688
  • Reorganization of examples by @dbr in #692
  • sdl2-support to event based API by @dbr in #698
  • add vcpkg-rs for locating freetype by @ruifengx in #582
  • Update to imgui 1.89.2 by @dbr in #700
  • Fix keyboard modifiers in Winit with the new ImGui version. by @rodrigorc in #701

New Contributors

Full Changelog: v0.9.0...v0.10.0

v0.9.0

30 Nov 00:55
@dbr dbr
Compare
Choose a tag to compare

Thanks everyone for your patience with this long overdue release!

There has been a good chunk of work done on imgui-rs since the last release. For a complete list, see the CHANGELOG.markdown in the main repository

A few key changes:

Building everything of Ui

The aim is to make the API more consistent and easier to discover functinality by having widgets be created consistently.

For example, previously a button was made by ui.button(...) but a slider made by imgui::Slider::new(...).build(ui) - meaning both appeared in different sections of the docs/auto-completion, so easy to miss. Now a slider is now made via ui.slider(...) also

This means some commonly used widgets like Window change - although a tiny bit tedious, it is hopefully a fairly stight-forward syntax change, which can be done with some search-and-replace (change imgui::Window::new(...) to ui.window(...) and remove the ui argument from build)

This is still somewhat a work-in-progress (some items may still be created via separate builder structs), but the aim is to transition everything to Ui

Docking

The upstream docking branch is now available, enabled via the docking feature. Higher-level, safe Rust bindings for this will come in a future release, for now these can be used via the imgui-sys crate

Various version updates

Dear ImGui is now 1.86 - this isn't the latest release, but it was better to release now and get imgui-rs back to a more regular release cycle

Similarly there is updates to latest glium, winit

Automatic notes

What's Changed

New Contributors

Full Changelog: v0.8.0...v0.9.0

v0.8.2

26 Dec 20:43
Compare
Choose a tag to compare

Merry uh Boxing Day, here's another imgui-rs patch.

  • FIXES: We incorrectly listed docking as a feature in imgui-rs's features list to doc.rs. This prevented our docs from building.

Additionally, glow-renderer ended up at 0.8.3 because someone messed up the intra-crate linking (i am someone)

v0.8.1

24 Dec 21:11
Compare
Choose a tag to compare

Merry Christmas Eve, here's an imgui-rs patch.

  • FIXES: various memory safety issues around input_text and input_text_multiline. We are primarily releasing this patch to fix this issue.
  • FIXES: docs are now generated for our feature branches on crates.io. Thanks @Jasper-Bekkers
  • ADD: adds winit-0.26 support. thanks @cwfitzgerald

We'll see you all soon for v0.9.0, which will include a reworked main API (no more imgui::Window::new) and the docking branch.

v0.8.0

17 Sep 19:08
f2fdfd4
Compare
Choose a tag to compare

v0.8.0

Welcome to the 0.8.0 update. This is one of the largest updates imgui-rs has ever seen; it will generate errors in a 0.7 project, but hopefully it should be both quick to fix, and enjoyable to update.

Thank you to everyone who uses imgui-rs, files issues, and spends their time and effort to PR new changes into the codebase. Because of all that effort, this is by far the best imgui-rs has looked!

For more details, please see the full changelog below, which lists all of the (many) breaking changes.

imgui-rs important changes

  • 🎉🎊 Removed ImStr and ImString from the API. 🎉🎊 Currently im_str! is deprecated and will be removed in 0.9.0.
    Internally, this has been implemented using AsRef<str> bounds across the codebase. I expect that this bound will change in such a manner to allow more expressions to be accepted. We then copy this str into a buffer, appending a null byte, and give that to ImGui. In the nearer future, we will add a feature to instead use imgui's string_view branch, which will allow us to avoid the internal buffer copy.

  • We have three new features in imgui:

    • min-const-generics is a default-feature. Effectively, you can choose to ignore this feature to keep this crate valid on rustc 1.48, but with the feature enabled, our MSRV is 1.54. In 0.9.0, this feature gate will be removed and we will commit to 1.54 and more common, minor, version bumps.
    • freetype enabled the Dear ImGui freetype feature. See here for more info on its advantages.
    • tables-api enables the...tables api...which was introduced in Dear ImGui 1.80. I decided to place this behind a feature gate so that users know to opt into it. However, I would strongly encourage users to opt into it -- see here for more information on it.
  • Most tokens through the repository (eg. WindowToken, TabBarToken, FontStackToken, etc) now allow for permissive dropping -- i.e, you don't need to actually call the .end() method on them anymore.

    The best way to use these begin_x functions is probably like so:

    if let Some(_t) = ui.begin_popup("example") {
    // your code here
    }

    As a minor note, if you just do if let Some(_) or ui.begin_popup("example").is_some(), you'll immediately drop the token, which of course, calls the corresponding end function.
    In the future, we may keep using closures, especially as we move onto Rust 2021.

  • We upgraded from v1.80 to Dear ImGui v1.84.2 See the Dear ImGui v1.84 release notes for more information on what has changed. Along with that, we have wrapped around begin_disabled!

  • Most functions with C++ default parameters now have with_x variants. This makes calling most functions simpler and more similar to the C++.

    • The most likely breaking changes users will see is button and same_line now take one fewer parameter -- if you were calling button with [0.0, 0.0], simply delete that -- otherwise, call button_with_size. Similarly, for same_line, if you were passing in 0.0. simply delete that argument. Otherwise, call same_line_with_pos.
  • In addition to all the above, many other smaller, but important, changes were made this cycle. Please see the changelog as always.

Backends

  • Added an imgui-glow-renderer which targets glow 0.10. We haven't quite worked out some necessary kinks to get to 0.11. (In fact, we will skip 0.11 entirely and be on glow 0.12 when that releases. Follow this branch here for more.)

  • Changed default version of Winit in imgui-winit-support to winit 0.25.

    • Removed automatically adding default features for imgui-winit-support with the exception of the current default winit feature/dep version. If you want to not have the default features of winit with 0.25, set default-features = false and add winit-25 as a normal feature.
  • Changed the version of glium to 0.30 in imgui-glium-renderer, as it now uses winit 0.25.

Contributors

Thank you to all of the contributors who have commented, made issues, and contributed code to imgui-rs this cycle. The support of so many is what sustains this project. In no particular order, thank you to:

  • @thomcc for handling the majority of the backend's setup and keeping this project's ffi in order
  • @dbr for not only doing the rest of the backend's setup, but also consistently PRing to fix thorny API problems
  • @jmaargh for contributing the imgui-glow-renderer and being so deeply pleasant to code review
  • @cfrantz for multiple contributions including fixing the ComboxBox and providing the basis for the tables-api
  • @repi for pushing us to change how our winit-support works
  • @dzil123 for making that winit support more comprehensible
  • @toyboot4e for a truly heroic amount of Doc Alias commenting. Now you can search on docs.rs by C++ function names for the corresponding rust code
  • @lwiklendt for adding input text hinting
  • @AngelOfSol for allowing build methods to return a value. Additionally, thank you for contributing a PR for the input text callbacks
  • @Jake-Shadle for fixing text input deletions, which let to fixing the input widgets (I hope) completely.
  • @atouchet for fixing our readme
  • @haenno for fixing up our example code
  • @hpwxf for fixing some of our GFX examples
  • and last but also latest, thank you to @davidpdrsn and @vojd, and really all of Embark Studios, for somehow both working at the same company and contributing nearly two identical PRs at the same time this morning. It made me chuckle.

If you have any issues with this release (and it's a big one), please file an issue!

  • sanbox-irl (Jonathan Spira)

Full changelog

  • Removed ImStr and ImString from the API. Currently im_str! is deprecated and will be removed in 0.9.0. To change your code:

    • If you were just wrapping a string literal, like im_str!("button"), just use "button". (Help: the regex im_str!\("((?:(?=(\\?))\2.)*?)"\), replacing matches with "$1", can get the majority of these quickly.);
    • If you were formatting, like &im_str!("My age is {}", 100), you can now just use format like format!("My age is {}, 100). Notice that due to the trait bounds, you can pass the string in directly too.
  • BREAKING: Most tokens through the repository (eg. WindowToken, TabBarToken, FontStackToken, etc) now allow for permissive dropping -- i.e, you don't need to actually call the .end() method on them anymore. In exchange, these tokens have taken on a lifetime, which allows them to be safe. This could make some patterns impossible. Please file an issue if this causes a problem.

    • end() no longer takes Ui. This is a breaking change, but hopefully should be trivial (and perhaps nice) for users to fix. Simply delete the argument, or add a _ before the token's binding name and allow it to be dropped on its own. In our code, we tend to write these now like:
if let Some(_t) = ui.begin_popup("example") {
  // your code here
}
  • BREAKING: Created with_x variants for most functions which previously took multiple parameters where some had default arguments in the C++. This makes calling most functions simpler and more similar to the C++.

    • The most likely breaking changes users will see is button and same_line now take one fewer parameter -- if you were calling button with [0.0, 0.0], simply delete that -- otherwise, call button_with_size. Similarly, for same_line, if you were passing in 0.0. simply delete that argument. Otherwise, call same_line_with_pos.
  • ADDED: support for the tables API which was added in dear imgui 1.80. We currently have this feature gated behind tables-api. You should feel safe to use this in stable production, but be aware of two things:

    1. The tables API is marked as "beta" meaning that it may change with fewer stability promises. This is unlikely and it seems fairly settled.
    2. There are a few cases where the tables API will segfault by dereferencing a NULL where it should instead ASSERT and crash. This is simply annoying because you won't get a stacktrace. See here for more info on that.. If this is fixed upstream, we will issue a patch.
  • ADDED: an imgui-glow-renderer which targets glow 0.10. Before release, this will be updated to target current 0.11 glow when further features are added. Thank you to @jmaargh for the work implementing this here!

  • UPGRADED: from v1.80 to Dear ImGui v1.84.2 See the Dear ImGui v1.84 release notes for more information. Thank you to @dbr for doing the work (twice actually) of upgrading the repository.

  • BREAKING: Reworked how callbacks on InputText and InputTextMultiline work.

    • REMOVED .callback_name() methods in favor of one method: .callback(FLAGS, CallbackStruct).
    • Wrapped callback kinds into their own enums, InputTextCallback and InputTextCallbackMultiline.
    • Created a trait, InputTextCallbackHandler.
    • To see how to create an InputText callback, see examples/text_callback.rs.
    • Finally, please note that editing an &mut String which contains \0 within it will produce surprising truncation within ImGui. If you need to edit such a string, please pre-process it.
  • ADDED: begin_disable and begin_enable methods. These add (finally) support for disabling any widge...

Read more

v0.7.0

05 Feb 05:09
Compare
Choose a tag to compare

v0.7.0

  • Upgrade to Dear ImGui v1.80. (Note that the new table functionality is not yet supported, however)

  • Ui::key_index() is now called internally when needed, and the various is_key_foo now take a Key directly: #416

    • is_key_down, is_key_pressed, is_key_released and key_pressed_amount now take a Key instead of u32 (breaking).
    • key_index is no longer public (breaking). If you need access to the key map, it can be accessed as ui.io().key_map[key] (If you need to do this, file a bug, since I'm open to exposing this if there's actually a use case).
  • winit 0.23/0.24 handling has been (hopefully) fixed: #420 (breaking, see also #412).

    • imgui-winit-support's winit-23 feature no longer supports winit version 0.24 (this caused an unintentional semver breakage in the imgui-winit-support crate before, unfortunately).
    • imgui-winit-support has a new winit-24 feature for 0.24 support.
    • By default imgui-winit-support feature now enables winit-24, and not winit-23 (by default it will always enable the latest).
  • The imgui crate no longer depends on gfx or glium directly: #420 (breaking, related to the previous change).

    • That is, the gfx and glium features are removed to reduce version compatibility issues going forward.
      • This only matters if you manually implement gfx or glium renderers without using the imgui-glium-renderer or imgui-gfx-renderer crates.
      • In the (somewhat unlikely) case you were relying on these this, you should define your own vertex type that's layout-compatible with imgui::DrawVert, and replace calls to imgui::DrawList::vtx_buffer() with imgui::DrawList::transmute_vtx_buffer::<MyDrawVert>(). You can see imgui_glium_renderer::GliumDrawVert and imgui_gfx_renderer::GfxDrawVert types respectively for examples of this, if needed, but it should be straightforward enough if you're already implementing a renderer from scratch.
    • This is admittedly less convenient, but avoids depending on any specific version of gfx or glium in the core imgui crate, which will ease maintenance and reduce unintentional breakage in the future.
  • Non-window DrawList support has been fixed/improved: #414

    • WindowDrawList has been renamed to DrawListMut, to reflect that it may refer to other kinds of draw lists, and is mutable, unlike imgui::DrawList (breaking).
    • Ui::get_background_draw_list() has been fixed when used outside of a window context, and now has an example.
    • Ui::get_foreground_draw_list() has been added, analogous to Ui::get_background_draw_list().
  • Added drag drop support, with a safe and an unsafe variant: #428

    • DragDropSource allows users to create a dragdrop payload which is either empty, of 'static + Copy data,
      or unsafe, allowing for theoretically arbitrary payloads.
    • DragDropTarget allows users to accept any of the above payloads.
    • Extensive documentation has been made on all of these features, hopefully as a target for future features.
  • ImColor (which is a wrapper around u32) has been renamed to ImColor32 in order to avoid confusion with the ImColor type from the Dear ImGui C++ code (which is a wrapper around ImVec4). In the future an ImColor type which maps more closely to the C++ one will be added.

    • Additionally, a number of constructor and accessor methods have been added to it ImColor, which are const fn where possible.
  • The im_str! macro can now be used in const contexts (when the format! version is not used).

  • im_str! now verifies that the parameter has no interior nuls at compile time. This can be avoided to get the old (truncating) behavior by forcing it to use the format!-like version, e.g. im_str!("for_some_reason_this_should_be_truncated\0 there {}", "").

    • This is not recommended, and is probably not useful.
  • Many functions are now const fn.

  • A large number of small functions are now #[inline], but many still aren't, so you probably will want to build with LTO for release builds if you use imgui heavily.

  • The io.config_windows_memory_compact_timer flag has been renamed to io.config_memory_compact_timer. This follows the similar rename in the C++ ImGui, and was done because it no longer only applies to window memory usage.

  • The variants of ColorEditInputMode and ColorEditDisplayMode have been renamed to be CamelCase instead of upper case (e.g. ColorEditFooMode::RGB => ColorEditFooMode::Rgb).

    • However, this change is probably not breaking (in practice if not in theory) because const aliases using the old names are provided.

v0.6.0

15 Nov 09:05
0d57f87
Compare
Choose a tag to compare

Added

  • Io::peek_input_characters

Changed

  • Upgrade to cimgui / imgui 1.79
  • Upgrade to winit 0.23
  • Bump minimum Rust version to 1.41

v0.5.0

05 Oct 20:17
ff6ed84
Compare
Choose a tag to compare

Added

  • Support for ConfigFlags::RENDERER_HAS_VTX_OFFSET in imgui-glium-renderer
    and imgui-gfx-renderer. This makes it possible to output large meshes (e.g.
    complex UIs) without problems when using these renderers
  • Ui::begin_tooltip to support using tooltips with stack tokens instead
    of closures
  • API for accessing the background drawlist
  • Tab bar / tab item API
  • Redesigned drag slider API

Changed

  • Upgrade to cimgui / imgui 1.78
  • Store per-texture sampler parameters in imgui-glium-renderer to support
    customizing them
  • Slider widget constructors no longer require the range parameter. Call the
    range function on the builder to set the range.

Fixed

  • Reduce unnecessary winit cursor changes which earlier caused cursor
    flickering or invalid cursors on some platforms (at least Windows)

Removed

  • Various things that were deprecated in imgui-rs 0.4.0