diff --git a/imgui-examples/examples/test_window_impl.rs b/imgui-examples/examples/test_window_impl.rs index 8d0d483..a43e95b 100644 --- a/imgui-examples/examples/test_window_impl.rs +++ b/imgui-examples/examples/test_window_impl.rs @@ -545,7 +545,7 @@ fn show_test_window(ui: &Ui, state: &mut State, opened: &mut bool) { ui.input_float3("input float3", &mut state.vec3f) .build(); ColorEdit3::new("color 1", &mut state.col1).build(ui); - ColorEdit3::new("color 2", &mut state.col2).build(ui); + ColorEdit4::new("color 2", &mut state.col2).build(ui); TreeNode::new("Multi-component Widgets").build(ui, || { ui.input_float2("input float2", &mut state.vec2f) @@ -601,19 +601,19 @@ fn show_test_window(ui: &Ui, state: &mut State, opened: &mut bool) { "Click on the colored square to open a color picker. CTRL+click on individual component to input value.\n", ); - ColorEdit3::new("MyColor##1", &mut s.color) + ColorEdit4::new("MyColor##1", &mut s.color) .flags(misc_flags) .alpha(false) .build(ui); ui.text("Color widget HSV with Alpha:"); - ColorEdit3::new("MyColor##2", &mut s.color) + ColorEdit4::new("MyColor##2", &mut s.color) .flags(misc_flags) .input_mode(ColorEditInputMode::HSV) .build(ui); ui.text("Color widget with Float Display:"); - ColorEdit3::new("MyColor##2f", &mut s.color) + ColorEdit4::new("MyColor##2f", &mut s.color) .flags(misc_flags) .format(ColorFormat::Float) .build(ui); @@ -627,7 +627,7 @@ CTRL+click on individual component to input value.\n", With the label(false) function you can pass a non-empty label which \ will only be used for the tooltip and picker popup.", ); - ColorEdit3::new("MyColor##3", &mut s.color) + ColorEdit4::new("MyColor##3", &mut s.color) .flags(misc_flags) .inputs(false) .label(false) @@ -642,13 +642,13 @@ CTRL+click on individual component to input value.\n", ui.checkbox("With Ref Color", &mut s.ref_color); if s.ref_color { ui.same_line(); - ColorEdit3::new("##RefColor", &mut s.ref_color_v) + ColorEdit4::new("##RefColor", &mut s.ref_color_v) .flags(misc_flags) .inputs(false) .build(ui); } } - let mut b = ColorPicker3::new + let mut b = ColorPicker4::new ("MyColor##4", &mut s.color) .flags(misc_flags) .alpha(s.alpha) @@ -657,7 +657,7 @@ CTRL+click on individual component to input value.\n", .display_rgb(true); if s.ref_color { - b = b.reference_color(&s.ref_color_v) + b = b.reference_color(s.ref_color_v) } b.build(ui); }); @@ -806,7 +806,7 @@ CTRL+click on individual component to input value.\n", let items = &["aaaa", "bbbb", "cccc", "dddd", "eeee"]; ui.combo_simple_string("Combo", &mut state.stacked_modals_item, items); - ColorEdit3::new("color", &mut state.stacked_modals_color).build(ui); + ColorEdit4::new("color", &mut state.stacked_modals_color).build(ui); if ui.button("Add another modal..") { ui.open_popup("Stacked 2") ; diff --git a/imgui-sys/Cargo.toml b/imgui-sys/Cargo.toml index 1cbe665..2515d41 100644 --- a/imgui-sys/Cargo.toml +++ b/imgui-sys/Cargo.toml @@ -15,7 +15,7 @@ exclude = ["third-party/*.json", "third-party/*.lua", "third-party/imgui/*/"] [dependencies] chlorine = "1.0.7" -mint = "0.5" +mint = "0.5.6" [build-dependencies] cc = "1.0" diff --git a/imgui/src/input_widget.rs b/imgui/src/input_widget.rs index 6f07544..200df0f 100644 --- a/imgui/src/input_widget.rs +++ b/imgui/src/input_widget.rs @@ -553,9 +553,9 @@ impl<'ui, 'p, L: AsRef> InputFloat<'ui, 'p, L> { } macro_rules! impl_input_floatn { - ($InputFloatN:ident, $MINT_TARGET:ident, $N:expr, $igInputFloatN:ident) => { + ($InputFloatN:ident, $MINT_TARGET:ty, $N:expr, $igInputFloatN:ident) => { #[must_use] - pub struct $InputFloatN<'ui, 'p, L, T = [f32; $N]> { + pub struct $InputFloatN<'ui, 'p, L, T> { label: L, value: &'p mut T, flags: InputTextFlags, @@ -565,8 +565,8 @@ macro_rules! impl_input_floatn { impl<'ui, 'p, L, T> $InputFloatN<'ui, 'p, L, T> where L: AsRef, - T: From<$MINT_TARGET> + Copy, - $MINT_TARGET: From, + T: Copy + Into<$MINT_TARGET>, + $MINT_TARGET: Into + Into<[f32; $N]>, { pub fn new(ui: &'ui Ui<'ui>, label: L, value: &'p mut T) -> Self { $InputFloatN { @@ -578,7 +578,7 @@ macro_rules! impl_input_floatn { } pub fn build(self) -> bool { - let value: $MINT_TARGET = $MINT_TARGET::from(*self.value); + let value: $MINT_TARGET = (*self.value).into(); let mut value: [f32; $N] = value.into(); let changed = unsafe { @@ -620,8 +620,8 @@ macro_rules! impl_input_intn { impl<'ui, 'p, L, T> $InputIntN<'ui, 'p, L, T> where L: AsRef, - T: From<$MINT_TARGET> + Copy, - $MINT_TARGET: From, + T: Copy + Into<$MINT_TARGET>, + $MINT_TARGET: Into + Into<[i32; $N]>, { pub fn new(ui: &'ui Ui<'ui>, label: L, value: &'p mut T) -> Self { $InputIntN { @@ -633,7 +633,7 @@ macro_rules! impl_input_intn { } pub fn build(self) -> bool { - let value: $MINT_TARGET = $MINT_TARGET::from(*self.value); + let value: $MINT_TARGET = (*self.value).into(); let mut value: [i32; $N] = value.into(); let changed = unsafe { diff --git a/imgui/src/lib.rs b/imgui/src/lib.rs index 336b5da..7bfca42 100644 --- a/imgui/src/lib.rs +++ b/imgui/src/lib.rs @@ -397,8 +397,8 @@ impl<'ui> Ui<'ui> { ) -> InputFloat2<'ui, 'p, L, T> where L: AsRef, - T: From + Copy, - MintVec2: From, + T: Copy + Into, + MintVec2: Into + Into<[f32; 2]>, { InputFloat2::new(self, label, value) } @@ -410,8 +410,8 @@ impl<'ui> Ui<'ui> { ) -> InputFloat3<'ui, 'p, L, T> where L: AsRef, - T: From + Copy, - MintVec3: From, + T: Copy + Into, + MintVec3: Into + Into<[f32; 3]>, { InputFloat3::new(self, label, value) } @@ -423,8 +423,8 @@ impl<'ui> Ui<'ui> { ) -> InputFloat4<'ui, 'p, L, T> where L: AsRef, - T: From + Copy, - MintVec4: From, + T: Copy + Into, + MintVec4: Into + Into<[f32; 4]>, { InputFloat4::new(self, label, value) } @@ -440,8 +440,8 @@ impl<'ui> Ui<'ui> { pub fn input_int2<'p, L, T>(&'ui self, label: L, value: &'p mut T) -> InputInt2<'ui, 'p, L, T> where L: AsRef, - T: From + Copy, - MintIVec2: From, + T: Copy + Into, + MintIVec2: Into + Into<[i32; 2]>, { InputInt2::new(self, label, value) } @@ -449,8 +449,8 @@ impl<'ui> Ui<'ui> { pub fn input_int3<'p, L, T>(&'ui self, label: L, value: &'p mut T) -> InputInt3<'ui, 'p, L, T> where L: AsRef, - T: From + Copy, - MintIVec3: From, + T: Copy + Into, + MintIVec3: Into + Into<[i32; 3]>, { InputInt3::new(self, label, value) } @@ -458,8 +458,8 @@ impl<'ui> Ui<'ui> { pub fn input_int4<'p, L, T>(&'ui self, label: L, value: &'p mut T) -> InputInt4<'ui, 'p, L, T> where L: AsRef, - T: From + Copy, - MintIVec4: From, + T: Copy + Into, + MintIVec4: Into + Into<[i32; 4]>, { InputInt4::new(self, label, value) } diff --git a/imgui/src/widget/color_editors.rs b/imgui/src/widget/color_editors.rs index b04a6b4..bec2363 100644 --- a/imgui/src/widget/color_editors.rs +++ b/imgui/src/widget/color_editors.rs @@ -195,8 +195,8 @@ pub struct ColorEdit3<'a, T, C> { impl<'a, T, C> ColorEdit3<'a, T, C> where T: AsRef, - MintVec3: From, - C: From + Copy, + C: Copy + Into, + MintVec3: Into + Into<[f32; 3]>, { /// Constructs a new color editor builder. #[doc(alias = "ColorEdit3")] @@ -377,8 +377,8 @@ pub struct ColorEdit4<'a, T, C> { impl<'a, T, C> ColorEdit4<'a, T, C> where T: AsRef, - MintVec4: From, - C: From + Copy, + C: Copy + Into, + MintVec4: Into + Into<[f32; 4]>, { /// Constructs a new color editor builder. #[doc(alias = "ColorEdit4")] @@ -556,8 +556,8 @@ pub struct ColorPicker3<'a, Label, Color> { impl<'a, Label, Color> ColorPicker3<'a, Label, Color> where Label: AsRef, - MintVec3: From, - Color: From + Copy, + Color: Copy + Into, + MintVec3: Into + Into<[f32; 3]>, { /// Constructs a new color picker builder. #[doc(alias = "ColorPicker3")] @@ -696,7 +696,7 @@ where /// Returns true if the color value was changed. pub fn build(mut self, ui: &Ui<'_>) -> bool { self.flags.insert(ColorEditFlags::NO_ALPHA); - let mut value: [f32; 3] = MintVec3::from(*self.value).into(); + let mut value: [f32; 3] = (*self.value).into().into(); let changed = unsafe { sys::igColorPicker3( ui.scratch_txt(self.label), @@ -741,8 +741,8 @@ pub struct ColorPicker4<'a, Label, Color> { impl<'a, Label, Color> ColorPicker4<'a, Label, Color> where Label: AsRef, - MintVec4: From, - Color: From + Copy, + Color: Copy + Into, + MintVec4: Into + Into<[f32; 4]>, { /// Constructs a new color picker builder. #[doc(alias = "ColorPicker4")] @@ -888,7 +888,7 @@ where /// Returns true if the color value was changed. pub fn build(mut self, ui: &Ui<'_>) -> bool { self.flags.insert(ColorEditFlags::NO_ALPHA); - let mut value: [f32; 4] = MintVec4::from(*self.value).into(); + let mut value: [f32; 4] = (*self.value).into().into(); let ref_color = self.ref_color.map(|c| c.as_ptr()).unwrap_or(ptr::null()); let changed = unsafe {