Adapt to latest cimgui function names

This commit is contained in:
Joonas Javanainen 2020-04-24 23:33:29 +03:00
parent 290429bd12
commit 41ac160bd8
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
7 changed files with 11 additions and 9 deletions

View File

@ -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,

View File

@ -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),
}

View File

@ -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 {

View File

@ -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,

View File

@ -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.

View File

@ -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)
}
}
};

View File

@ -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)
}
}