mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
deprecated InputInt and InputFloat, switched to using InputScalar
This commit is contained in:
parent
1d78d18d82
commit
de69a0c103
@ -16,6 +16,12 @@
|
||||
|
||||
- BREAKING: We now only support `glium 0.30`. We're in a difficult position supporting arbitrary `glium` versions in our renderer, since `glium` is only in a semi-maintained state. `glium` users, please get in contact in issues to let us know what will work best for your needs!
|
||||
|
||||
- Added `InputScalar` and `InputScalarN`. These are the core Input modules that Dear ImGui uses, and ultimately what `InputFloat` and `InputInt` turn into. See deprecation of `InputFloat` and `InputInt` as a result. Thank you to @EmbersArc for [implementing this here](https://github.com/imgui-rs/imgui-rs/pull/544).
|
||||
|
||||
- BREAKING: `ui.input_int` and `ui.input_float` now return `InputScalar<'ui, 'l, f32/i32>`, instead of `InputFloat`/`InputInt`. This struct has all of the same flags as `InputFloat` and `InputInt` did.
|
||||
|
||||
- DEPRECATED: `InputFloat` and `InputInt` have been deprecated. `ui.input_float` and `ui.input_int` are _not_, however, and instead will just call `input_scalar` as appropriate. Therefore, please switch your code to `ui.input_float` or `ui.input_int`.
|
||||
|
||||
## [0.8.0] - 2021-09-17
|
||||
|
||||
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!
|
||||
|
||||
@ -551,10 +551,10 @@ fn show_test_window(ui: &Ui, state: &mut State, opened: &mut bool) {
|
||||
ColorEdit3::new("color 1", &mut state.col1).build(ui);
|
||||
ColorEdit4::new("color 2", &mut state.col2).build(ui);
|
||||
|
||||
ui.input_scalar("input scalar i64", &mut state.u0).build(ui);
|
||||
ui.input_scalar("input scalar f64", &mut state.d0).build(ui);
|
||||
ui.input_scalar_n("input scalar int array", &mut state.vec3i).build(ui);
|
||||
ui.input_scalar_n("input scalar float array", &mut state.vec3f).build(ui);
|
||||
ui.input_scalar("input scalar i64", &mut state.u0).build();
|
||||
ui.input_scalar("input scalar f64", &mut state.d0).build();
|
||||
ui.input_scalar_n("input scalar int array", &mut state.vec3i).build();
|
||||
ui.input_scalar_n("input scalar float array", &mut state.vec3f).build();
|
||||
|
||||
TreeNode::new("Multi-component Widgets").build(ui, || {
|
||||
ui.input_float2("input float2", &mut state.vec2f)
|
||||
|
||||
@ -488,6 +488,10 @@ pub struct InputInt<'ui, 'p, L> {
|
||||
}
|
||||
|
||||
impl<'ui, 'p, L: AsRef<str>> InputInt<'ui, 'p, L> {
|
||||
#[deprecated(
|
||||
since = "0.9.0",
|
||||
note = "use `ui.input_int` or `ui.input_scalar` instead"
|
||||
)]
|
||||
pub fn new(ui: &'ui Ui, label: L, value: &'p mut i32) -> Self {
|
||||
InputInt {
|
||||
label,
|
||||
@ -527,6 +531,10 @@ pub struct InputFloat<'ui, 'p, L, F = &'static str> {
|
||||
}
|
||||
|
||||
impl<'ui, 'p, L: AsRef<str>> InputFloat<'ui, 'p, L> {
|
||||
#[deprecated(
|
||||
since = "0.9.0",
|
||||
note = "use `ui.input_float` or `ui.input_scalar` instead"
|
||||
)]
|
||||
pub fn new(ui: &'ui Ui, label: L, value: &'p mut f32) -> Self {
|
||||
InputFloat {
|
||||
label,
|
||||
@ -742,9 +750,11 @@ impl<'ui, 'p, L: AsRef<str>, T: DataTypeKind, F: AsRef<str>> InputScalar<'ui, 'p
|
||||
/// Builds an input scalar that is bound to the given value.
|
||||
///
|
||||
/// Returns true if the value was changed.
|
||||
pub fn build(self, ui: &Ui) -> bool {
|
||||
pub fn build(self) -> bool {
|
||||
unsafe {
|
||||
let (one, two) = ui.scratch_txt_with_opt(self.label, self.display_format);
|
||||
let (one, two) = self
|
||||
.ui
|
||||
.scratch_txt_with_opt(self.label, self.display_format);
|
||||
|
||||
sys::igInputScalar(
|
||||
one,
|
||||
@ -826,9 +836,11 @@ impl<'ui, 'p, L: AsRef<str>, T: DataTypeKind, F: AsRef<str>> InputScalarN<'ui, '
|
||||
/// Builds a horizontal array of multiple input scalars attached to the given slice.
|
||||
///
|
||||
/// Returns true if any value was changed.
|
||||
pub fn build(self, ui: &Ui) -> bool {
|
||||
pub fn build(self) -> bool {
|
||||
unsafe {
|
||||
let (one, two) = ui.scratch_txt_with_opt(self.label, self.display_format);
|
||||
let (one, two) = self
|
||||
.ui
|
||||
.scratch_txt_with_opt(self.label, self.display_format);
|
||||
|
||||
sys::igInputScalarN(
|
||||
one,
|
||||
|
||||
@ -474,8 +474,8 @@ impl<'ui> Ui {
|
||||
&'ui self,
|
||||
label: L,
|
||||
value: &'p mut f32,
|
||||
) -> InputFloat<'ui, 'p, L> {
|
||||
InputFloat::new(self, label, value)
|
||||
) -> InputScalar<'ui, 'p, f32, L> {
|
||||
self.input_scalar(label, value)
|
||||
}
|
||||
#[doc(alias = "InputFloat2")]
|
||||
pub fn input_float2<'p, L, T>(
|
||||
@ -521,8 +521,8 @@ impl<'ui> Ui {
|
||||
&'ui self,
|
||||
label: L,
|
||||
value: &'p mut i32,
|
||||
) -> InputInt<'ui, 'p, L> {
|
||||
InputInt::new(self, label, value)
|
||||
) -> InputScalar<'ui, 'p, i32, L> {
|
||||
self.input_scalar(label, value).step(1)
|
||||
}
|
||||
#[doc(alias = "InputInt2")]
|
||||
pub fn input_int2<'p, L, T>(&'ui self, label: L, value: &'p mut T) -> InputInt2<'ui, 'p, L, T>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user