Releases: imgui-rs/imgui-rs
v0.12.0
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
- unsafety in text fix by @sanbox-irl in #746
- Require correct version of
cc
by @SkiFire13 in #744 - Update license field following SPDX 2.1 license expression standard by @frisoft in #737
- add support for adding analog key events by @adryzz in #728
- update memoffset version by @trickster in #726
- updating msrv by @sanbox-irl in #747
- Add functions
begin_popup_context_*
. by @rodrigorc in #738 - Updated winit, glutin and glium dependencies by @Rob2309 in #754
- fix: use correct alpha blending function by @Syndelis in #756
- Finally fixed dependency hell by @Rob2309 in #774
New Contributors
- @SkiFire13 made their first contribution in #744
- @frisoft made their first contribution in #737
- @adryzz made their first contribution in #728
- @trickster made their first contribution in #726
- @Syndelis made their first contribution in #756
Full Changelog: v0.11.0...v0.12.0
v0.11.0
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
- upgrading-imgui: Fix some typos by @MarijnS95 in #707
- Expose Viewport functionality by @Rob2309 in #619
- Update to glow 0.12 by @Rob2309 in #711
- Fix handling of modifier keys in winit-support by @dbr in #710
- Replaced crate "clipboard" by "copypasta" by @reduf in #715
- Bump MSRV to 1.64 by @dbr in #718
- Issue #687: Add OwnedDrawData for deep cloning DrawData by @jbrd in #721
- Add callbacks to the draw_list. by @rodrigorc in #702
New Contributors
Full Changelog: v0.10.0...v0.11.0
v0.10.0
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
andisize
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
- @Ararem made their first contribution in #693
- @Rob2309 made their first contribution in #688
- @ruifengx made their first contribution in #582
- @rodrigorc made their first contribution in #701
Full Changelog: v0.9.0...v0.10.0
v0.9.0
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
- Fix glow renderer doc links by @toyboot4e in #532
- disabled debug_message_insert_support on apple by @sanbox-irl in #534
- Add Style accessor functions to Ui by @lwiklendt in #526
- fix typo in Ui::button documentation by @malikolivier in #535
- Window::new -> Ui::window attempt 2 by @dbr in #537
- Switch [f32; _] types in the public api to
mint
equivalents by @sanbox-irl in #536 - Fix update_delta_time() assertion fail from zero Duration by @dzil123 in #479
- Remove the lifetime from Ui by @sanbox-irl in #539
- Use ControlFlow:Poll in glow renderer examples by @dbr in #545
- Implement
imgui-sdl2-support
crate. by @NightShade256 in #541 - Add
input_scalar
and allow setting float input precision by @EmbersArc in #544 - Add basic polyline methods to draw list by @dbr in #550
- Fix a bug in SDL 2 support crate (#549) by @NightShade256 in #552
- menu rewrite by @sanbox-irl in #551
- Docking as a Feature Mk2 by @dbr in #557
- Test docking feature in CI by @dbr in #567
- Fix incorrectly copy-pasted documentation for InputTextFlags.CALLBACK_EDIT by @Sejsel in #572
- Add a StyleVar for CellPadding by @Sejsel in #571
- Add missing fields to memory layout tests by @Sejsel in #574
- Update xflags to 0.2.x by @thomcc in #577
- Update slider example #565 by @dbr in #568
- Remove NO_ALPHA flag insertion in ColorPicker4::build by @kazatsuyu in #579
- Make sure docs get generated for optional features as well by @Jasper-Bekkers in #573
- Fix DPI scaling in examples by @dbr in #570
- Support winit-0.26 by @cwfitzgerald in #583
- Minor fixes to README by @LoipesMas in #591
- Fix glow renderer not working for minor version = 0 by @PieKing1215 in #599
- Fix up glob patterns in imgui-sys by @dbr in #597
- Upgrade Dear ImGui 1.84.2 -> 1.86 by @dbr in #600
- Make ui.popup* methods consistent by @dbr in #603
- Refactor Slider to work under new Ui-based architecture by @imlazyeye in #607
- winit-support: fix dpi handling in attach_window() when not in defaul… by @filnet in #608
- Color upgrade by @sanbox-irl in #614
- Winit 0.26 by @sanbox-irl in #615
- Return Bool in SDL2 if handled event by @sanbox-irl in #616
- Remove im_str! usage from examples in docs by @Sejsel in #618
- imgui: Upgrade parking_lot to 0.12 with windows-rs bindings by @MarijnS95 in #624
- imgui-winit-support: Build-test documentation example and fix compiler errors by @MarijnS95 in #625
- Clipper bugfix and iterator interface by @dbr in #626
- Handle window focus lost event by @dbr in #628
- TextCallbackData::selection causes problems when selecting from right to left by @wcassels in #635
- Removing support for old winit versions by @dbr in #638
- glow: move vertex creation to same method as deletion by @dbr in #644
- Removing note in README about being under new management. by @robertkeizer in #647
- Update MSRV to 1.56 by @dbr in #660
- fix doc by @linw789 in #666
- leave tree_node label None if not set by @linw789 in #662
- Support winit v0.27.2 by @dbarkar in #659
- add TextFilter by @tetenpapier in #658
- Proposed branching/release process by @dbr in #672
- Restoring "Include imgui/misc/freetype/ in crate package" from 0.8.x release by @dbr in #673
- Re-export
winit
andglow
crates by @lovelymono in #676
New Contributors
- @NightShade256 made their first contribution in #541
- @EmbersArc made their first contribution in #544
- @Sejsel made their first contribution in #572
- @kazatsuyu made their first contribution in #579
- @cwfitzgerald made their first contribution in #583
- @LoipesMas made their first contribution in #591
- @PieKing1215 made their first contribution in #599
- @imlazyeye made their first contribution in #607
- @MarijnS95 made their first contribution in #624
- @wcassels made their first contribution in #635
- @robertkeizer made their first contribution in #647
- @linw789 made their first contribution in #666
- @dbarkar made their first contribution in #659
- @tetenpapier made their first contribution in #658
- @lovelymono made their first contribution in #676
Full Changelog: v0.8.0...v0.9.0
v0.8.2
Merry uh Boxing Day, here's another imgui-rs
patch.
- FIXES: We incorrectly listed
docking
as a feature inimgui-rs
's features list todoc.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
Merry Christmas Eve, here's an imgui-rs
patch.
- FIXES: various memory safety issues around
input_text
andinput_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
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 usingAsRef<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 thisstr
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'sstring_view
branch, which will allow us to avoid the internal buffer copy. -
We have three new features in
imgui
:min-const-generics
is adefault-feature
. Effectively, you can choose to ignore this feature to keep this crate valid on rustc1.48
, but with the feature enabled, our MSRV is1.54
. In0.9.0
, this feature gate will be removed and we will commit to1.54
and more common, minor, version bumps.freetype
enabled the Dear ImGuifreetype
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(_)
orui.begin_popup("example").is_some()
, you'll immediately drop the token, which of course, calls the correspondingend
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
andsame_line
now take one fewer parameter -- if you were callingbutton
with[0.0, 0.0]
, simply delete that -- otherwise, callbutton_with_size
. Similarly, forsame_line
, if you were passing in0.0.
simply delete that argument. Otherwise, callsame_line_with_pos
.
- The most likely breaking changes users will see is
-
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 targetsglow 0.10
. We haven't quite worked out some necessary kinks to get to0.11
. (In fact, we will skip0.11
entirely and be onglow 0.12
when that releases. Follow this branch here for more.) -
Changed default version of Winit in
imgui-winit-support
towinit 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, setdefault-features = false
and addwinit-25
as a normal feature.
- Removed automatically adding default features for
-
Changed the version of
glium
to0.30
inimgui-glium-renderer
, as it now useswinit 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 theinput 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 regexim_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 likeformat!("My age is {}, 100)
. Notice that due to the trait bounds, you can pass the string in directly too.
- If you were just wrapping a string literal, like
-
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 takesUi
. 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
andsame_line
now take one fewer parameter -- if you were callingbutton
with[0.0, 0.0]
, simply delete that -- otherwise, callbutton_with_size
. Similarly, forsame_line
, if you were passing in0.0.
simply delete that argument. Otherwise, callsame_line_with_pos
.
- The most likely breaking changes users will see is
-
ADDED: support for the
tables
API which was added in dear imgui1.80
. We currently have this feature gated behindtables-api
. You should feel safe to use this in stable production, but be aware of two things:- The tables API is marked as "beta" meaning that it may change with fewer stability promises. This is unlikely and it seems fairly settled.
- There are a few cases where the tables API will segfault by dereferencing a
NULL
where it should insteadASSERT
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 targetsglow 0.10
. Before release, this will be updated to target current0.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
andInputTextMultiline
work.- REMOVED
.callback_name()
methods in favor of one method:.callback(FLAGS, CallbackStruct)
. - Wrapped callback kinds into their own enums,
InputTextCallback
andInputTextCallbackMultiline
. - 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.
- REMOVED
-
ADDED:
begin_disable
andbegin_enable
methods. These add (finally) support for disabling any widge...
v0.7.0
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 variousis_key_foo
now take aKey
directly: #416is_key_down
,is_key_pressed
,is_key_released
andkey_pressed_amount
now take aKey
instead ofu32
(breaking).key_index
is no longer public (breaking). If you need access to the key map, it can be accessed asui.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
'swinit-23
feature no longer supportswinit
version0.24
(this caused an unintentional semver breakage in theimgui-winit-support
crate before, unfortunately).imgui-winit-support
has a newwinit-24
feature for 0.24 support.- By default
imgui-winit-support
feature now enableswinit-24
, and notwinit-23
(by default it will always enable the latest).
-
The
imgui
crate no longer depends ongfx
orglium
directly: #420 (breaking, related to the previous change).- That is, the
gfx
andglium
features are removed to reduce version compatibility issues going forward.- This only matters if you manually implement
gfx
orglium
renderers without using theimgui-glium-renderer
orimgui-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 toimgui::DrawList::vtx_buffer()
withimgui::DrawList::transmute_vtx_buffer::<MyDrawVert>()
. You can seeimgui_glium_renderer::GliumDrawVert
andimgui_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 only matters if you manually implement
- This is admittedly less convenient, but avoids depending on any specific version of
gfx
orglium
in the coreimgui
crate, which will ease maintenance and reduce unintentional breakage in the future.
- That is, the
-
Non-window DrawList support has been fixed/improved: #414
WindowDrawList
has been renamed toDrawListMut
, to reflect that it may refer to other kinds of draw lists, and is mutable, unlikeimgui::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 toUi::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,
orunsafe
, 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 aroundu32
) has been renamed toImColor32
in order to avoid confusion with theImColor
type from the Dear ImGui C++ code (which is a wrapper aroundImVec4
). In the future anImColor
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 areconst fn
where possible.
- Additionally, a number of constructor and accessor methods have been added to it
-
The
im_str!
macro can now be used inconst
contexts (when theformat!
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 theformat!
-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 useimgui
heavily. -
The
io.config_windows_memory_compact_timer
flag has been renamed toio.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
andColorEditDisplayMode
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
v0.5.0
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