From 41ac160bd85986cf0a839e89d0003fa2c364b58d Mon Sep 17 00:00:00 2001 From: Joonas Javanainen Date: Fri, 24 Apr 2020 23:33:29 +0300 Subject: [PATCH] Adapt to latest cimgui function names --- src/plotlines.rs | 2 +- src/stacks.rs | 6 +++--- src/utils.rs | 2 +- src/widget/selectable.rs | 2 +- src/widget/tree.rs | 4 +++- src/window/child_window.rs | 2 +- src/window_draw_list.rs | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/plotlines.rs b/src/plotlines.rs index 0850088..b329918 100644 --- a/src/plotlines.rs +++ b/src/plotlines.rs @@ -62,7 +62,7 @@ impl<'ui, 'p> PlotLines<'ui, 'p> { pub fn build(self) { unsafe { - sys::igPlotLines( + sys::igPlotLinesFloatPtr( self.label.as_ptr(), self.values.as_ptr() as *const c_float, self.values.len() as i32, diff --git a/src/stacks.rs b/src/stacks.rs index 5d2d0cd..d3945a7 100644 --- a/src/stacks.rs +++ b/src/stacks.rs @@ -58,7 +58,7 @@ impl<'ui> Ui<'ui> { /// color.pop(&ui); /// ``` pub fn push_style_color(&self, style_color: StyleColor, color: [f32; 4]) -> ColorStackToken { - unsafe { sys::igPushStyleColor(style_color as i32, color.into()) }; + unsafe { sys::igPushStyleColorVec4(style_color as i32, color.into()) }; ColorStackToken { count: 1, ctx: self.ctx, @@ -90,7 +90,7 @@ impl<'ui> Ui<'ui> { { let mut count = 0; for &(style_color, color) in style_colors { - unsafe { sys::igPushStyleColor(style_color as i32, color.into()) }; + unsafe { sys::igPushStyleColorVec4(style_color as i32, color.into()) }; count += 1; } ColorStackToken { @@ -387,7 +387,7 @@ impl<'ui> Ui<'ui> { Id::Str(s) => { let start = s.as_ptr() as *const c_char; let end = start.add(s.len()); - sys::igPushIDRange(start, end) + sys::igPushIDStrStr(start, end) } Id::Ptr(p) => sys::igPushIDPtr(p as *const c_void), } diff --git a/src/utils.rs b/src/utils.rs index 864b42c..26cfa7b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -114,7 +114,7 @@ impl<'ui> Ui<'ui> { impl<'ui> Ui<'ui> { /// Returns `true` if the rectangle (of given size, starting from cursor position) is visible pub fn is_cursor_rect_visible(&self, size: [f32; 2]) -> bool { - unsafe { sys::igIsRectVisible(size.into()) } + unsafe { sys::igIsRectVisibleNil(size.into()) } } /// Returns `true` if the rectangle (in screen coordinates) is visible pub fn is_rect_visible(&self, rect_min: [f32; 2], rect_max: [f32; 2]) -> bool { diff --git a/src/widget/selectable.rs b/src/widget/selectable.rs index 9f3ce39..6297d7b 100644 --- a/src/widget/selectable.rs +++ b/src/widget/selectable.rs @@ -108,7 +108,7 @@ impl<'a> Selectable<'a> { /// Returns true if the selectable was clicked. pub fn build(self, _: &Ui) -> bool { unsafe { - sys::igSelectable( + sys::igSelectableBool( self.label.as_ptr(), self.selected, self.flags.bits() as i32, diff --git a/src/widget/tree.rs b/src/widget/tree.rs index 42de8d4..8d978e8 100644 --- a/src/widget/tree.rs +++ b/src/widget/tree.rs @@ -388,7 +388,9 @@ impl<'a> CollapsingHeader<'a> { /// Returns true if the collapsing header is open and content should be rendered. #[must_use] pub fn build(self, _: &Ui) -> bool { - unsafe { sys::igCollapsingHeader(self.label.as_ptr(), self.flags.bits() as i32) } + unsafe { + sys::igCollapsingHeaderTreeNodeFlags(self.label.as_ptr(), self.flags.bits() as i32) + } } /// Builds the collapsing header, and adds an additional close button that changes the value of /// the given mutable reference when clicked. diff --git a/src/window/child_window.rs b/src/window/child_window.rs index 06e9542..2edcb54 100644 --- a/src/window/child_window.rs +++ b/src/window/child_window.rs @@ -261,7 +261,7 @@ impl<'a> ChildWindow<'a> { Id::Str(s) => { let start = s.as_ptr() as *const c_char; let end = start.add(s.len()); - sys::igGetIDRange(start, end) + sys::igGetIDStrStr(start, end) } } }; diff --git a/src/window_draw_list.rs b/src/window_draw_list.rs index fbfbb98..d5e28ac 100644 --- a/src/window_draw_list.rs +++ b/src/window_draw_list.rs @@ -222,7 +222,7 @@ impl<'ui> WindowDrawList<'ui> { unsafe { let start = text.as_ptr() as *const c_char; let end = (start as usize + text.len()) as *const c_char; - sys::ImDrawList_AddText(self.draw_list, pos.into(), col.into().into(), start, end) + sys::ImDrawList_AddTextVec2(self.draw_list, pos.into(), col.into().into(), start, end) } }