From 62d1bc5d5c325d06794a93c963b49aa4d3f5d170 Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 17 Sep 2021 11:24:15 -0400 Subject: [PATCH 1/6] updating copyrights and readme --- LICENSE-APACHE | 13 +------ LICENSE-MIT | 2 +- README.markdown | 24 +++++++----- docs/upgrading-imgui.md | 70 +++++++++++++++++++--------------- imgui-glow-renderer/Cargo.toml | 2 +- 5 files changed, 57 insertions(+), 54 deletions(-) diff --git a/LICENSE-APACHE b/LICENSE-APACHE index 8f71f43..d3d7a05 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -175,18 +175,7 @@ END OF TERMS AND CONDITIONS - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} + Copyright {2021} the imgui-rs developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/LICENSE-MIT b/LICENSE-MIT index ea896c1..4594ae3 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2015-2020 The imgui-rs Developers +Copyright (c) 2015-2021 The imgui-rs Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.markdown b/README.markdown index 52de4e3..ad774f3 100644 --- a/README.markdown +++ b/README.markdown @@ -3,7 +3,7 @@ [![Build Status](https://github.com/imgui-rs/imgui-rs/workflows/ci/badge.svg)](https://github.com/imgui-rs/imgui-rs/actions) [![Latest release on crates.io](https://img.shields.io/crates/v/imgui.svg)](https://crates.io/crates/imgui) [![Documentation on docs.rs](https://docs.rs/imgui/badge.svg)](https://docs.rs/imgui) -[![Wrapped Dear ImGui Version](https://img.shields.io/badge/Dear%20ImGui%20Version-1.80-blue.svg)](https://github.com/ocornut/imgui) +[![Wrapped Dear ImGui Version](https://img.shields.io/badge/Dear%20ImGui%20Version-1.84.2-blue.svg)](https://github.com/ocornut/imgui) (Recently under new maintenance, things subject to change) @@ -28,20 +28,24 @@ Window::new("Hello world") ## Main library crates - imgui: High-level safe API -- imgui-glium-renderer: Renderer implementation that uses the `glium` crate -- imgui-gfx-renderer: Renderer implementation that uses the `gfx` crate (_not - the new gfx-hal crate_) - imgui-winit-support: Backend platform implementation that uses the `winit` crate (latest by default, but earlier versions are supported via feature flags) +- imgui-glow-renderer: Renderer implementation that uses the `imgui` crate +- imgui-glium-renderer: Renderer implementation that uses the `glium` crate - imgui-sys: Low-level unsafe API (automatically generated) +Additionally, the following are no longer maintained, but might work still: + +- imgui-gfx-renderer: Renderer implementation that uses the `gfx` crate (_not + the new gfx-hal crate_) + ## Features - Bindings for Dear ImGui that can be used with safe Rust. Note: API coverage is not 100%, but will keep improving over time. - Builder structs for use cases where the original C++ library uses optional function parameters -- Easy integration with Glium / pre-ll gfx (renderer) +- Easy integration with `glow`/ `glium` - Easy integration with winit (backend platform) - Optional support for the freetype font rasterizer @@ -72,10 +76,10 @@ responsibilities include the following: The most tested platform/renderer combination is `imgui-glium-renderer` + `glium` + `imgui-winit-support` + `winit`, but this is not the only possible -combination. There's also `imgui-gfx-renderer`, and you can find additional 3rd -party crates that provide a wider support for more libraries (e.g. raw OpenGL, -SDL2). You can also write your own support code if you have a more advanced use -case, because **imgui-rs is not tied to any specific graphics / OS API**. +combination. There's also `imgui-glow-renderer`, which will increasingly replace +`glium`, and you can find additional 3rd party crates that provide a wider +support for more libraries (e.g. raw OpenGL, SDL2). You can also write your own +support code if you have a more advanced use case, because **imgui-rs is not tied to any specific graphics / OS API**. ## Compiling and running the demos @@ -85,7 +89,7 @@ cd imgui-rs git submodule update --init --recursive ``` -Main examples are located in the imgui-examples directory. +Main examples are located in the `imgui-examples` directory. ```bash # At the reposity root diff --git a/docs/upgrading-imgui.md b/docs/upgrading-imgui.md index a5ea896..5884283 100644 --- a/docs/upgrading-imgui.md +++ b/docs/upgrading-imgui.md @@ -4,60 +4,69 @@ This document covers how to upgrade imgui-rs to a new version of the upstream C+ The process is much the same to build imgui-rs for a tagged release (as shown) as it is for any arbitrary revision (such as one on a different branch) - ## Step by step 1. Ensure the submodules are populated (`git submodule init` and `git submodule update --recursive`) 2. Check out the desired version of the `imgui-sys/third-party/imgui/` submodule - $ pwd - .../imgui-sys/third-party/imgui - $ git checkout v1.81 - Previous HEAD position was 58075c44 Version 1.80 - HEAD is now at 4df57136 Version 1.81 + ```sh + $ pwd + .../imgui-sys/third-party/imgui + $ git checkout v1.81 + Previous HEAD position was 58075c44 Version 1.80 + HEAD is now at 4df57136 Version 1.81 + ``` 3. Ensure `luajit` is installed, as this is required by cimgui's generator. - $ luajit --help + $ luajit --help 4. Check out the `cimgui` project somewhere, as we use use the generator within this - $ git clone --recursive https://github.com/cimgui/cimgui.git /tmp/cimgui + ```sh + git clone --recursive https://github.com/cimgui/cimgui.git /tmp/cimgui + ``` 5. Ensure the `imgui` submodule within `cimgui` is pointing to the same revision as in `imgui-rs` - $ cd /tmp/cimgui/imgui - $ git checkout v1.81 - HEAD is now at 4df57136 Version 1.81 + ```sh + $ cd /tmp/cimgui/imgui + $ git checkout v1.81 + HEAD is now at 4df57136 Version 1.81 + ``` 6. Back in `imgui-rs/imgui-sys/third-party/` - run the `update-cimgui-output.sh` helper script to execute cimgui's generator - $ pwd - .../imgui-sys/third-party - $ ./update-cimgui-output.sh /tmp/cimgui/ - [...] - copyfile ./output/cimgui.h ../cimgui.h - copyfile ./output/cimgui.cpp ../cimgui.cpp - all done!! + ```sh + $ pwd + .../imgui-sys/third-party + $ ./update-cimgui-output.sh /tmp/cimgui/ + [...] + copyfile ./output/cimgui.h ../cimgui.h + copyfile ./output/cimgui.cpp ../cimgui.cpp + all done!! + ``` - This updates various files in the imgui-sys folder like `cimgui.cpp`, `definitions.json` and so on + This updates various files in the imgui-sys folder like `cimgui.cpp`, `definitions.json` and so on - With this step, we now have new C bindings to the desired verison of Dear ImGui. + With this step, we now have new C bindings to the desired verison of Dear ImGui. 7. Back in the root of the imgui-rs repo, run `cargo xtask bindgen` - $ cargo xtask bindgen + ```sh + $ cargo xtask bindgen Finished dev [unoptimized + debuginfo] target(s) in 0.04s - Running `target/debug/xtask bindgen` - Executing bindgen [output = .../imgui-rs/imgui-sys/src/bindings.rs] - Success [output = .../imgui-rs/imgui-sys/src/bindings.rs] - Executing bindgen [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs] - Success [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs] + Running `target/debug/xtask bindgen` + Executing bindgen [output = .../imgui-rs/imgui-sys/src/bindings.rs] + Success [output = .../imgui-rs/imgui-sys/src/bindings.rs] + Executing bindgen [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs] + Success [output = .../imgui-rs/imgui-sys/src/wasm_bindings.rs] + ``` - This requires bindgen to be installed (`cargo install bindgen` should do it) + This requires bindgen to be installed (`cargo install bindgen` should do it) - This step generates `imgui-sys/src/bindings.rs` which is used by `imgui/src/*` + This step generates `imgui-sys/src/bindings.rs` which is used by `imgui/src/*` 8. Run `cargo build` and fix any errors caused by changes upstream (see next section) @@ -65,8 +74,9 @@ The process is much the same to build imgui-rs for a tagged release (as shown) a 10. Try running one of the examples - cargo run --example test_window_impl - + ```sh + cargo run --example test_window_impl + ``` ## Common sources of problems diff --git a/imgui-glow-renderer/Cargo.toml b/imgui-glow-renderer/Cargo.toml index d3f8115..3f2df8a 100644 --- a/imgui-glow-renderer/Cargo.toml +++ b/imgui-glow-renderer/Cargo.toml @@ -2,7 +2,7 @@ name = "imgui-glow-renderer" version = "0.7.0" edition = "2018" -authors = ["The imgui-rs Developers"] +authors = ["jmaargh and the imgui-rs Developers"] description = "glow renderer for the imgui crate" homepage = "https://github.com/imgui-rs/imgui-rs" repository = "https://github.com/imgui-rs/imgui-rs" From 5702b33e3f32692d6145be01f6008aabdb3816d3 Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 17 Sep 2021 12:22:53 -0400 Subject: [PATCH 2/6] updating the changelog holy god that's so much changelog --- CHANGELOG.markdown | 98 +++++++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index bb3564a..0648514 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,29 +1,81 @@ # Change Log -## [Unreleased] +## [0.8.0] - 2021-09-17 -- BREAKING: MSRV is now **1.54**. This is gives us access to min-const-generics, which we use in a few places, but will gradually use more. Because this is the first time we've bumped MSRV intentionally, we have added a new feature `min-const-generics`, which is _enabled by default_. If you are pre-1.54, you can hang onto this update by disabling that feature. In our next update, this feature will be removed and we will commit to our MSRVs going forward. +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. See our [release page](https://github.com/imgui-rs/imgui-rs/releases/tag/v0.8.0) for more information and a list of contributors to this cycle. Thank you to everyone who uses `imgui-rs`, files issues, and spend 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! - **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"`. + - If you were just wrapping a string literal, like `im_str!("button")`, just use `"button"`. (hint: 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. -- Removed automatically adding default features for `imgui-winit-support` - with the exception of the current default winit feature/dep version. Additionally, that version was updated to 0.25. 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. Thank you to @dzil123 for the work [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/477)! +- 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: + +```rs +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 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](https://github.com/imgui-rs/imgui-rs/pull/495)! +- Upgrade from v1.80 to [Dear ImGui v1.84.2](https://github.com/ocornut/imgui/releases/tag/v1.84.2) See the [Dear ImGui v1.84](https://github.com/ocornut/imgui/releases/tag/v1.84) release notes for more information. Thank you to @dbr for doing the work (twice actually) of [upgrading the repository](https://github.com/imgui-rs/imgui-rs/pull/519). + +- 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_ widget. Thank you to @dbr for [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/519). + +- BREAKING: MSRV is now **1.54**. This is gives us access to min-const-generics, which we use in a few places, but will gradually use more. Because this is the first time we've bumped MSRV intentionally, we have added a new feature `min-const-generics`, which is _enabled by default_. If you are pre-1.54, you can hang onto this update by disabling that feature. In our next update, this feature will be removed and we will commit to our MSRVs going forward. Thank you to @dbr for changing our CI infrastructure to support better MSRVs [here](https://github.com/imgui-rs/imgui-rs/pull/512). + +- BREAKING: Changed default version of Winit in `imgui-winit-support` to `winit 0.25`. Thank you to @repi [for implementing this here](https://github.com/imgui-rs/imgui-rs/pull/485). + + - 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. Thank you to @dzil123 for the work [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/477)! + +- Support for the freetype font rasterizer. Enabled by the non-default `freetype` feature, e.g `imgui = {version = "...", features=["freetype"]})` + Thank you to @dbr for this work [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/496). + +- Added `doc alias` support throughout the repository. You can now, [inside the docs](https://docs.rs/imgui), search for `imgui-rs` functions by their `Dear ImGui` C++ names. For example, searching for `InputText` will pull up `Ui::input_text`. This was quite a lot of documentation and effort, so thank you to @toyboot4e [for implementing this here](https://github.com/imgui-rs/imgui-rs/pull/458). + +- Added text hinting into `InputText`. Thank you to @lwiklendt [for implementing this here](https://github.com/imgui-rs/imgui-rs/pull/449). + - BREAKING: Reworked `.range` calls on `Slider`, `VerticalSlider`, and `Drag` to simply take two min and max values, and requires that they are provided in the constructor. - To update without changing behavior, use the range `T::MIN` and `T::MAX` for the given numerical type (such as `i8::MIN` and `i8::MAX`). - Using `.range` is still maintained for simplicity, but will likely be deprecated in 0.9 and removed in 0.10! -- BREAKING: Modifies `build` style methods to allow the provide closure to return a value. The build call will then return Some(value) if the closure is called, and None if it isn't. -- The most likely breaking changes users will see is that they will need to add semicolons after calling `build`, because these function no longer return `()`. +- `DrawListMut` has new methods to draw images -- 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 parameter. Otherwise, call `same_line_with_pos`. + - The methods are `add_image`, `add_image_quad`, and `add_image_rounded`. The `imgui-examples/examples/custom_textures.rs` has been updated to show their usage. + - Additionally the `imgui::draw_list` module is now public, which contains the various draw list objects. While the `add_*` methods are preferred, `imgui::draw_list::Circle::new(&draw_list_mut, ...).build()` is equivalent + - Finally, we have relaxed the limits around having multiple draw lists such that you can have multiple mutable draw lists of different kinds (ie, a `foreground` and a `background` at the same time.). + - Thank you to @dbr for [implementing these changes](https://github.com/imgui-rs/imgui-rs/pull/445). + +- Exposed the `ButtonFlags` which previously prevented `invisible_button` from being usable. Thank you to @dbr for [implementing this change here](https://github.com/imgui-rs/imgui-rs/pull/509). + +- BREAKING: `PopupModal`'s `new` was reworked so that it didn't take `Ui` until `build` was called. This is a breaking change if you were invoking it directly. Simply move your `ui` call to `build` or `begin`. + +- Restored methods to access keyboard based on backend-defined keyboard map indexes. These allow access to most keys, not just those defined in the small subset of `imgui::Keys` (note the available keys may be expanded in future by [imgui PR #2625](https://github.com/ocornut/imgui/pull/2625)) + + - The new methods on `imgui::Ui` are `is_key_index_down`, `is_key_index_pressed`, `is_key_index_pressed_no_repeat`, `is_key_index_released`, `is_key_index_released` + - For example `ui.is_key_released(imgui::Key::A)` is same as `ui.is_key_index_released(winit::events::VirtualKeyCode::A as i32)` when using the winit backend + +- BREAKING: Modifies `build` style methods to allow the provide closure to return a value. The build call will then return Some(value) if the closure is called, and None if it isn't. + + - The most likely breaking changes users will see is that they will need to add semicolons after calling `build`, because these function no longer return `()`. + - Thank you to @AngelOfSol for [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/468). - BREAKING: Removed `imgui::legacy` which contained the old style of flags. The remaining flags in `imgui::legacy` have been updated to be consistent with other flags in the project. @@ -32,32 +84,6 @@ - `imgui::legacy::ImGuiTreeNodeFlags` is now `imgui::widget::tree::TreeNodeFlags` - `imgui::legacy::ImDrawListFlags` is now `imgui::draw_list::DrawListFlags` -- `DrawListMut` has new methods to draw images - - - The methods are `add_image`, `add_image_quad`, and `add_image_rounded`. The `imgui-examples/examples/custom_textures.rs` has been updated to show their usage. - - Additionally the `imgui::draw_list` module is now public, which contains the various draw list objects. While the `add_*` methods are preferred, `imgui::draw_list::Circle::new(&draw_list_mut, ...).build()` is equivalent - -- 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. - -- BREAKING: `PopupModal`'s `new` was reworked so that it didn't take `Ui` until `build` was called. This is a breaking change if you were invoking it directly. Simply move your `ui` call to `build` or `begin`. - -- Upgrade to from v1.80 to [Dear ImGui v1.82](https://github.com/ocornut/imgui/releases/tag/v1.82) (see also the [Dear ImGui v1.81](https://github.com/ocornut/imgui/releases/tag/v1.81) release notes) - - - BREAKING: `imgui::ListBox::calculate_size(items_count: ..., height_in_items: ...)` has been removed as the function backing it has been marked as obsolete. The recommended approach is to calculate the size yourself and use `.size(...)` (or use the default auto-calculated size) - - BREAKING: `draw_list::CornerFlags` has been renamed to `draw_list::DrawFlags` to match the upstream change, and refle. However, the only draw flags that are useful to Rust currently are still the ones reflecting corner rounding. - - Similarly, the flag names have been updated so that `CornerFlags::$WHERE` has become `DrawFlags::ROUND_CORNERS_$WHERE`, for ecample `CornerFlags::TOP_LEFT` => `DrawFlags::ROUND_CORNERS_TOP_LEFT`. - - Importantly, `CornerFlags::NONE` became `DrawFlags::ROUND_CORNERS_NONE` (following the patter) and **not** `DrawFlags::NONE` which does exist now, and is a separate value. - - BREAKING: `InputTextFlags::ALWAYS_INSERT_MODE` is renamed to `InputTextFlags:: - - However, the `always_insert_mode` funcitons on the various input builders remain as a (non-deprecated) alias, as the C++ code has kept an equivalent inline stub. - - BREAKING: `Style::circle_segment_max_error` is no more. `Style::circle_tesselation_max_error` behaves very similarly, but `circle_segment_max_error` values are not equivalent to `circle_tesselation_max_error` values. - - For example, the default `circle_segment_max_error` was 1.6, but the default `circle_tesselation_max_error` is 0.3. In practice, it's unlikely to matter much either way, though. - -- Restored methods to access keyboard based on backend-defined keyboard map indexes. These allow access to most keys, not just those defined in the small subset of `imgui::Keys` (note the available keys may be expanded in future by [imgui PR #2625](https://github.com/ocornut/imgui/pull/2625)) - - - The new methods on `imgui::Ui` are `is_key_index_down`, `is_key_index_pressed`, `is_key_index_pressed_no_repeat`, `is_key_index_released`, `is_key_index_released` - - For example `ui.is_key_released(imgui::Key::A)` is same as `ui.is_key_index_released(winit::events::VirtualKeyCode::A as i32)` when using the winit backend - - Full (32-bit) unicode support is enabled in Dear Imgui (e.g. `-DIMGUI_USE_WCHAR32` is enabled now). Previously UTF-16 was used internally. - BREAKING: Some parts of the font atlas code now use `char` (or `u32`) instead of `u16` to reflect this. @@ -69,8 +95,6 @@ - If you're using `DEP_IMGUI_DEFINE_`s for this already, then no change is needed. - If you're using `.cargo/config` to apply a build script override and link against a prebuilt `Dear Imgui` (or something else along these lines), you need to ensure you link with a version that was built using `-DIMGUI_USE_WCHAR32`. -- Support for the freetype font rasterizer. Enabled by the non-default `freetype` feature, e.g `imgui = {version = "...", features=["freetype"]})` - ## [0.7.0] - 2021-02-04 - Upgrade to [Dear ImGui v1.80](https://github.com/ocornut/imgui/releases/tag/v1.80). (Note that the new table functionality is not yet supported, however) From 5a27f7ad781451ec3e292d8bf7ebb04cd12a6b4b Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 17 Sep 2021 12:24:37 -0400 Subject: [PATCH 3/6] made the regex help simpler --- CHANGELOG.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 0648514..5f4102d 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -6,7 +6,7 @@ Welcome to the `0.8.0` update. This is one of the largest updates imgui-rs has e - **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"`. (hint: the regex `im_str!\("((?:(?=(\\?))\2.)*?)"\)`, replacing matches with `$1` can get the majority of these quickly.); + - 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. From dacc2c735e678e05541891ba8b1468759136bc9a Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 17 Sep 2021 12:31:41 -0400 Subject: [PATCH 4/6] added info about the tables-api --- CHANGELOG.markdown | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 5f4102d..46c762f 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -23,9 +23,14 @@ if let Some(_t) = ui.begin_popup("example") { - 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 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](https://github.com/imgui-rs/imgui-rs/pull/495)! +- 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: -- Upgrade from v1.80 to [Dear ImGui v1.84.2](https://github.com/ocornut/imgui/releases/tag/v1.84.2) See the [Dear ImGui v1.84](https://github.com/ocornut/imgui/releases/tag/v1.84) release notes for more information. Thank you to @dbr for doing the work (twice actually) of [upgrading the repository](https://github.com/imgui-rs/imgui-rs/pull/519). + 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.](https://github.com/imgui-rs/imgui-rs/issues/524). 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](https://github.com/imgui-rs/imgui-rs/pull/495)! + +- UPGRADED: from v1.80 to [Dear ImGui v1.84.2](https://github.com/ocornut/imgui/releases/tag/v1.84.2) See the [Dear ImGui v1.84](https://github.com/ocornut/imgui/releases/tag/v1.84) release notes for more information. Thank you to @dbr for doing the work (twice actually) of [upgrading the repository](https://github.com/imgui-rs/imgui-rs/pull/519). - BREAKING: Reworked how callbacks on `InputText` and `InputTextMultiline` work. @@ -35,7 +40,7 @@ if let Some(_t) = ui.begin_popup("example") { - 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_ widget. Thank you to @dbr for [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/519). +- ADDED: `begin_disable` and `begin_enable` methods. These add (finally) support for disabling _any_ widget. Thank you to @dbr for [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/519). - BREAKING: MSRV is now **1.54**. This is gives us access to min-const-generics, which we use in a few places, but will gradually use more. Because this is the first time we've bumped MSRV intentionally, we have added a new feature `min-const-generics`, which is _enabled by default_. If you are pre-1.54, you can hang onto this update by disabling that feature. In our next update, this feature will be removed and we will commit to our MSRVs going forward. Thank you to @dbr for changing our CI infrastructure to support better MSRVs [here](https://github.com/imgui-rs/imgui-rs/pull/512). @@ -44,12 +49,12 @@ if let Some(_t) = ui.begin_popup("example") { - 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. Thank you to @dzil123 for the work [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/477)! -- Support for the freetype font rasterizer. Enabled by the non-default `freetype` feature, e.g `imgui = {version = "...", features=["freetype"]})` +- ADDED: Support for the freetype font rasterizer. Enabled by the non-default `freetype` feature, e.g `imgui = {version = "...", features=["freetype"]})` Thank you to @dbr for this work [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/496). -- Added `doc alias` support throughout the repository. You can now, [inside the docs](https://docs.rs/imgui), search for `imgui-rs` functions by their `Dear ImGui` C++ names. For example, searching for `InputText` will pull up `Ui::input_text`. This was quite a lot of documentation and effort, so thank you to @toyboot4e [for implementing this here](https://github.com/imgui-rs/imgui-rs/pull/458). +- ADDED: `doc alias` support throughout the repository. You can now, [inside the docs](https://docs.rs/imgui), search for `imgui-rs` functions by their `Dear ImGui` C++ names. For example, searching for `InputText` will pull up `Ui::input_text`. This was quite a lot of documentation and effort, so thank you to @toyboot4e [for implementing this here](https://github.com/imgui-rs/imgui-rs/pull/458). -- Added text hinting into `InputText`. Thank you to @lwiklendt [for implementing this here](https://github.com/imgui-rs/imgui-rs/pull/449). +- ADDED: text hinting into `InputText`. Thank you to @lwiklendt [for implementing this here](https://github.com/imgui-rs/imgui-rs/pull/449). - BREAKING: Reworked `.range` calls on `Slider`, `VerticalSlider`, and `Drag` to simply take two min and max values, and requires that they are provided in the constructor. @@ -63,11 +68,11 @@ if let Some(_t) = ui.begin_popup("example") { - Finally, we have relaxed the limits around having multiple draw lists such that you can have multiple mutable draw lists of different kinds (ie, a `foreground` and a `background` at the same time.). - Thank you to @dbr for [implementing these changes](https://github.com/imgui-rs/imgui-rs/pull/445). -- Exposed the `ButtonFlags` which previously prevented `invisible_button` from being usable. Thank you to @dbr for [implementing this change here](https://github.com/imgui-rs/imgui-rs/pull/509). +- ADDED: the `ButtonFlags` which previously prevented `invisible_button` from being usable. Thank you to @dbr for [implementing this change here](https://github.com/imgui-rs/imgui-rs/pull/509). - BREAKING: `PopupModal`'s `new` was reworked so that it didn't take `Ui` until `build` was called. This is a breaking change if you were invoking it directly. Simply move your `ui` call to `build` or `begin`. -- Restored methods to access keyboard based on backend-defined keyboard map indexes. These allow access to most keys, not just those defined in the small subset of `imgui::Keys` (note the available keys may be expanded in future by [imgui PR #2625](https://github.com/ocornut/imgui/pull/2625)) +- BREAKING: Restored methods to access keyboard based on backend-defined keyboard map indexes. These allow access to most keys, not just those defined in the small subset of `imgui::Keys` (note the available keys may be expanded in future by [imgui PR #2625](https://github.com/ocornut/imgui/pull/2625)) - The new methods on `imgui::Ui` are `is_key_index_down`, `is_key_index_pressed`, `is_key_index_pressed_no_repeat`, `is_key_index_released`, `is_key_index_released` - For example `ui.is_key_released(imgui::Key::A)` is same as `ui.is_key_index_released(winit::events::VirtualKeyCode::A as i32)` when using the winit backend From 4809d031b7462c45fef56e3bc15349e9faebaf09 Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 17 Sep 2021 12:36:47 -0400 Subject: [PATCH 5/6] issuing version update! --- CHANGELOG.markdown | 3 ++- imgui-gfx-renderer/Cargo.toml | 4 ++-- imgui-glium-renderer/Cargo.toml | 4 ++-- imgui-glow-renderer/Cargo.toml | 6 +++--- imgui-sys/Cargo.toml | 2 +- imgui-winit-support/Cargo.toml | 4 ++-- imgui/Cargo.toml | 4 ++-- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 46c762f..4849440 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -735,7 +735,8 @@ As mentioned, the 0.6.1 release of `imgui-winit-support` has been yanked. - Initial release with cimgui/imgui 1.44, glium 0.9 -[unreleased]: https://github.com/Gekkio/imgui-rs/compare/v0.7.0...HEAD +[unreleased]: https://github.com/Gekkio/imgui-rs/compare/v0.8.0...HEAD +[0.8.0]: https://github.com/Gekkio/imgui-rs/compare/v0.7.0...v0.8.0 [0.7.0]: https://github.com/Gekkio/imgui-rs/compare/v0.6.1...v0.7.0 [0.6.1]: https://github.com/Gekkio/imgui-rs/compare/v0.6.0...v0.6.1 [0.6.0]: https://github.com/Gekkio/imgui-rs/compare/v0.5.0...v0.6.0 diff --git a/imgui-gfx-renderer/Cargo.toml b/imgui-gfx-renderer/Cargo.toml index 904228d..a7c7664 100644 --- a/imgui-gfx-renderer/Cargo.toml +++ b/imgui-gfx-renderer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgui-gfx-renderer" -version = "0.7.0" +version = "0.8.0" edition = "2018" authors = ["The imgui-rs Developers"] description = "gfx renderer for the imgui crate" @@ -16,7 +16,7 @@ default = ["opengl"] [dependencies] gfx = "0.18" -imgui = { version = "0.7.0", path = "../imgui" } +imgui = { version = "0.8.0", path = "../imgui" } [target.'cfg(windows)'.build-dependencies] winapi = { version = "0.3", features = ["d3dcompiler"] } diff --git a/imgui-glium-renderer/Cargo.toml b/imgui-glium-renderer/Cargo.toml index 98b7ad2..0132bd9 100644 --- a/imgui-glium-renderer/Cargo.toml +++ b/imgui-glium-renderer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgui-glium-renderer" -version = "0.7.0" +version = "0.8.0" edition = "2018" authors = ["The imgui-rs Developers"] description = "Glium renderer for the imgui crate" @@ -11,4 +11,4 @@ categories = ["gui", "rendering"] [dependencies] glium = { version = ">=0.28, < 0.31", default-features = false } -imgui = { version = "0.7.0", path = "../imgui" } +imgui = { version = "0.8.0", path = "../imgui" } diff --git a/imgui-glow-renderer/Cargo.toml b/imgui-glow-renderer/Cargo.toml index 3f2df8a..e845d4c 100644 --- a/imgui-glow-renderer/Cargo.toml +++ b/imgui-glow-renderer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgui-glow-renderer" -version = "0.7.0" +version = "0.8.0" edition = "2018" authors = ["jmaargh and the imgui-rs Developers"] description = "glow renderer for the imgui crate" @@ -10,13 +10,13 @@ license = "MIT/Apache-2.0" categories = ["gui", "rendering"] [dependencies] -imgui = { version = "0.7.0", path = "../imgui" } +imgui = { version = "0.8.0", path = "../imgui" } glow = "0.10.0" memoffset = "0.6.4" [dev-dependencies] glutin = "0.27.0" -imgui-winit-support = { version = "0.7.1", path = "../imgui-winit-support" } +imgui-winit-support = { version = "0.8.0", path = "../imgui-winit-support" } image = "0.23" [features] diff --git a/imgui-sys/Cargo.toml b/imgui-sys/Cargo.toml index f439900..58e8a44 100644 --- a/imgui-sys/Cargo.toml +++ b/imgui-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgui-sys" -version = "0.7.0" +version = "0.8.0" edition = "2018" authors = ["The imgui-rs Developers"] description = "Raw FFI bindings to dear imgui" diff --git a/imgui-winit-support/Cargo.toml b/imgui-winit-support/Cargo.toml index 78e02d9..4934214 100644 --- a/imgui-winit-support/Cargo.toml +++ b/imgui-winit-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgui-winit-support" -version = "0.7.1" +version = "0.8.0" edition = "2018" authors = ["The imgui-rs Developers"] description = "winit support code for the imgui crate" @@ -10,7 +10,7 @@ license = "MIT/Apache-2.0" categories = ["gui"] [dependencies] -imgui = { version = "0.7.0", path = "../imgui" } +imgui = { version = "0.8.0", path = "../imgui" } winit-19 = { version = ">= 0.16, < 0.20", package = "winit", optional = true } winit-20 = { version = ">= 0.20, < 0.22", package = "winit", optional = true } winit-22 = { version = "0.22", package = "winit", optional = true } diff --git a/imgui/Cargo.toml b/imgui/Cargo.toml index b3f5603..5bd9b72 100644 --- a/imgui/Cargo.toml +++ b/imgui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgui" -version = "0.7.0" +version = "0.8.0" edition = "2018" authors = ["The imgui-rs Developers"] description = "High-level Rust bindings to dear imgui" @@ -14,7 +14,7 @@ exclude = ["/resources"] [dependencies] bitflags = "1" -imgui-sys = { version = "0.7.0", path = "../imgui-sys" } +imgui-sys = { version = "0.8.0", path = "../imgui-sys" } parking_lot = "0.11" [features] From 921a9d4ef0bd150242624ea97bb3350c086d0d5c Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 17 Sep 2021 12:42:59 -0400 Subject: [PATCH 6/6] noted that the gfx backends are deprecated. They'll be removed from this repo after publishing 0.8.0 --- imgui-gfx-examples/Cargo.toml | 3 +++ imgui-gfx-renderer/Cargo.toml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/imgui-gfx-examples/Cargo.toml b/imgui-gfx-examples/Cargo.toml index 5373cdc..97becf6 100644 --- a/imgui-gfx-examples/Cargo.toml +++ b/imgui-gfx-examples/Cargo.toml @@ -9,6 +9,9 @@ repository = "https://github.com/imgui-rs/imgui-rs" license = "MIT/Apache-2.0" publish = false +[badges] +maintenance = { status = "deprecated" } + [features] opengl = ["imgui-gfx-renderer/opengl"] # FIXME diff --git a/imgui-gfx-renderer/Cargo.toml b/imgui-gfx-renderer/Cargo.toml index a7c7664..4a486b6 100644 --- a/imgui-gfx-renderer/Cargo.toml +++ b/imgui-gfx-renderer/Cargo.toml @@ -14,6 +14,9 @@ opengl = [] directx = [] default = ["opengl"] +[badges] +maintenance = { status = "deprecated" } + [dependencies] gfx = "0.18" imgui = { version = "0.8.0", path = "../imgui" }