Upgrade to imgui/cimgui 1.75

This commit is contained in:
Joonas Javanainen 2020-02-15 12:39:27 +02:00
parent 9545ca3d39
commit b759a44c84
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
9 changed files with 128 additions and 59 deletions

View File

@ -9,7 +9,7 @@
### Changed ### Changed
- Upgrade to cimgui / imgui 1.74 - Upgrade to cimgui / imgui 1.75
- Bump minimum Rust version to 1.38 (at least backtrace crate requires it) - Bump minimum Rust version to 1.38 (at least backtrace crate requires it)
- Upgrade to glium 0.26 / winit 0.21 - Upgrade to glium 0.26 / winit 0.21
- Switch imgui-winit-support to 0.20+ by default. Winit 0.19 support is still - Switch imgui-winit-support to 0.20+ by default. Winit 0.19 support is still

View File

@ -4,7 +4,7 @@
Minimum Rust version: 1.38 Minimum Rust version: 1.38
Wrapped Dear ImGui version: 1.74 Wrapped Dear ImGui version: 1.75
[![Build Status](https://github.com/Gekkio/imgui-rs/workflows/ci/badge.svg)](https://github.com/Gekkio/imgui-rs/actions) [![Build Status](https://github.com/Gekkio/imgui-rs/workflows/ci/badge.svg)](https://github.com/Gekkio/imgui-rs/actions)
[![Latest release on crates.io](https://meritbadge.herokuapp.com/imgui)](https://crates.io/crates/imgui) [![Latest release on crates.io](https://meritbadge.herokuapp.com/imgui)](https://crates.io/crates/imgui)

View File

@ -152,6 +152,7 @@ pub type ImGuiCond = ::std::os::raw::c_int;
pub type ImGuiDataType = ::std::os::raw::c_int; pub type ImGuiDataType = ::std::os::raw::c_int;
pub type ImGuiDir = ::std::os::raw::c_int; pub type ImGuiDir = ::std::os::raw::c_int;
pub type ImGuiKey = ::std::os::raw::c_int; pub type ImGuiKey = ::std::os::raw::c_int;
pub type ImGuiMouseButton = ::std::os::raw::c_int;
pub type ImGuiMouseCursor = ::std::os::raw::c_int; pub type ImGuiMouseCursor = ::std::os::raw::c_int;
pub type ImGuiStyleVar = ::std::os::raw::c_int; pub type ImGuiStyleVar = ::std::os::raw::c_int;
pub type ImDrawCornerFlags = ::std::os::raw::c_int; pub type ImDrawCornerFlags = ::std::os::raw::c_int;
@ -1517,6 +1518,11 @@ pub const ImGuiColorEditFlags__DataTypeMask: ImGuiColorEditFlags_ = 25165824;
pub const ImGuiColorEditFlags__PickerMask: ImGuiColorEditFlags_ = 100663296; pub const ImGuiColorEditFlags__PickerMask: ImGuiColorEditFlags_ = 100663296;
pub const ImGuiColorEditFlags__InputMask: ImGuiColorEditFlags_ = 402653184; pub const ImGuiColorEditFlags__InputMask: ImGuiColorEditFlags_ = 402653184;
pub type ImGuiColorEditFlags_ = u32; pub type ImGuiColorEditFlags_ = u32;
pub const ImGuiMouseButton_Left: ImGuiMouseButton_ = 0;
pub const ImGuiMouseButton_Right: ImGuiMouseButton_ = 1;
pub const ImGuiMouseButton_Middle: ImGuiMouseButton_ = 2;
pub const ImGuiMouseButton_COUNT: ImGuiMouseButton_ = 5;
pub type ImGuiMouseButton_ = u32;
pub const ImGuiMouseCursor_None: ImGuiMouseCursor_ = -1; pub const ImGuiMouseCursor_None: ImGuiMouseCursor_ = -1;
pub const ImGuiMouseCursor_Arrow: ImGuiMouseCursor_ = 0; pub const ImGuiMouseCursor_Arrow: ImGuiMouseCursor_ = 0;
pub const ImGuiMouseCursor_TextInput: ImGuiMouseCursor_ = 1; pub const ImGuiMouseCursor_TextInput: ImGuiMouseCursor_ = 1;
@ -1526,7 +1532,8 @@ pub const ImGuiMouseCursor_ResizeEW: ImGuiMouseCursor_ = 4;
pub const ImGuiMouseCursor_ResizeNESW: ImGuiMouseCursor_ = 5; pub const ImGuiMouseCursor_ResizeNESW: ImGuiMouseCursor_ = 5;
pub const ImGuiMouseCursor_ResizeNWSE: ImGuiMouseCursor_ = 6; pub const ImGuiMouseCursor_ResizeNWSE: ImGuiMouseCursor_ = 6;
pub const ImGuiMouseCursor_Hand: ImGuiMouseCursor_ = 7; pub const ImGuiMouseCursor_Hand: ImGuiMouseCursor_ = 7;
pub const ImGuiMouseCursor_COUNT: ImGuiMouseCursor_ = 8; pub const ImGuiMouseCursor_NotAllowed: ImGuiMouseCursor_ = 8;
pub const ImGuiMouseCursor_COUNT: ImGuiMouseCursor_ = 9;
pub type ImGuiMouseCursor_ = i32; pub type ImGuiMouseCursor_ = i32;
pub const ImGuiCond_Always: ImGuiCond_ = 1; pub const ImGuiCond_Always: ImGuiCond_ = 1;
pub const ImGuiCond_Once: ImGuiCond_ = 2; pub const ImGuiCond_Once: ImGuiCond_ = 2;
@ -1570,13 +1577,14 @@ pub struct ImGuiStyle {
pub AntiAliasedLines: bool, pub AntiAliasedLines: bool,
pub AntiAliasedFill: bool, pub AntiAliasedFill: bool,
pub CurveTessellationTol: f32, pub CurveTessellationTol: f32,
pub CircleSegmentMaxError: f32,
pub Colors: [ImVec4; 48usize], pub Colors: [ImVec4; 48usize],
} }
#[test] #[test]
fn bindgen_test_layout_ImGuiStyle() { fn bindgen_test_layout_ImGuiStyle() {
assert_eq!( assert_eq!(
::std::mem::size_of::<ImGuiStyle>(), ::std::mem::size_of::<ImGuiStyle>(),
944usize, 948usize,
concat!("Size of: ", stringify!(ImGuiStyle)) concat!("Size of: ", stringify!(ImGuiStyle))
); );
assert_eq!( assert_eq!(
@ -1929,8 +1937,20 @@ fn bindgen_test_layout_ImGuiStyle() {
) )
); );
assert_eq!( assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiStyle>())).Colors as *const _ as usize }, unsafe {
&(*(::std::ptr::null::<ImGuiStyle>())).CircleSegmentMaxError as *const _ as usize
},
176usize, 176usize,
concat!(
"Offset of field: ",
stringify!(ImGuiStyle),
"::",
stringify!(CircleSegmentMaxError)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiStyle>())).Colors as *const _ as usize },
180usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(ImGuiStyle), stringify!(ImGuiStyle),
@ -1946,7 +1966,7 @@ impl Default for ImGuiStyle {
} }
impl ::std::fmt::Debug for ImGuiStyle { impl ::std::fmt::Debug for ImGuiStyle {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write ! ( f , "ImGuiStyle {{ Alpha: {:?}, WindowPadding: {:?}, WindowRounding: {:?}, WindowBorderSize: {:?}, WindowMinSize: {:?}, WindowTitleAlign: {:?}, WindowMenuButtonPosition: {:?}, ChildRounding: {:?}, ChildBorderSize: {:?}, PopupRounding: {:?}, PopupBorderSize: {:?}, FramePadding: {:?}, FrameRounding: {:?}, FrameBorderSize: {:?}, ItemSpacing: {:?}, ItemInnerSpacing: {:?}, TouchExtraPadding: {:?}, IndentSpacing: {:?}, ColumnsMinSpacing: {:?}, ScrollbarSize: {:?}, ScrollbarRounding: {:?}, GrabMinSize: {:?}, GrabRounding: {:?}, TabRounding: {:?}, TabBorderSize: {:?}, ColorButtonPosition: {:?}, ButtonTextAlign: {:?}, SelectableTextAlign: {:?}, DisplayWindowPadding: {:?}, DisplaySafeAreaPadding: {:?}, MouseCursorScale: {:?}, AntiAliasedLines: {:?}, AntiAliasedFill: {:?}, CurveTessellationTol: {:?}, Colors: [{}] }}" , self . Alpha , self . WindowPadding , self . WindowRounding , self . WindowBorderSize , self . WindowMinSize , self . WindowTitleAlign , self . WindowMenuButtonPosition , self . ChildRounding , self . ChildBorderSize , self . PopupRounding , self . PopupBorderSize , self . FramePadding , self . FrameRounding , self . FrameBorderSize , self . ItemSpacing , self . ItemInnerSpacing , self . TouchExtraPadding , self . IndentSpacing , self . ColumnsMinSpacing , self . ScrollbarSize , self . ScrollbarRounding , self . GrabMinSize , self . GrabRounding , self . TabRounding , self . TabBorderSize , self . ColorButtonPosition , self . ButtonTextAlign , self . SelectableTextAlign , self . DisplayWindowPadding , self . DisplaySafeAreaPadding , self . MouseCursorScale , self . AntiAliasedLines , self . AntiAliasedFill , self . CurveTessellationTol , self . Colors . iter ( ) . enumerate ( ) . map ( | ( i , v ) | format ! ( "{}{:?}" , if i > 0 { ", " } else { "" } , v ) ) . collect :: < String > ( ) ) write ! ( f , "ImGuiStyle {{ Alpha: {:?}, WindowPadding: {:?}, WindowRounding: {:?}, WindowBorderSize: {:?}, WindowMinSize: {:?}, WindowTitleAlign: {:?}, WindowMenuButtonPosition: {:?}, ChildRounding: {:?}, ChildBorderSize: {:?}, PopupRounding: {:?}, PopupBorderSize: {:?}, FramePadding: {:?}, FrameRounding: {:?}, FrameBorderSize: {:?}, ItemSpacing: {:?}, ItemInnerSpacing: {:?}, TouchExtraPadding: {:?}, IndentSpacing: {:?}, ColumnsMinSpacing: {:?}, ScrollbarSize: {:?}, ScrollbarRounding: {:?}, GrabMinSize: {:?}, GrabRounding: {:?}, TabRounding: {:?}, TabBorderSize: {:?}, ColorButtonPosition: {:?}, ButtonTextAlign: {:?}, SelectableTextAlign: {:?}, DisplayWindowPadding: {:?}, DisplaySafeAreaPadding: {:?}, MouseCursorScale: {:?}, AntiAliasedLines: {:?}, AntiAliasedFill: {:?}, CurveTessellationTol: {:?}, CircleSegmentMaxError: {:?}, Colors: [{}] }}" , self . Alpha , self . WindowPadding , self . WindowRounding , self . WindowBorderSize , self . WindowMinSize , self . WindowTitleAlign , self . WindowMenuButtonPosition , self . ChildRounding , self . ChildBorderSize , self . PopupRounding , self . PopupBorderSize , self . FramePadding , self . FrameRounding , self . FrameBorderSize , self . ItemSpacing , self . ItemInnerSpacing , self . TouchExtraPadding , self . IndentSpacing , self . ColumnsMinSpacing , self . ScrollbarSize , self . ScrollbarRounding , self . GrabMinSize , self . GrabRounding , self . TabRounding , self . TabBorderSize , self . ColorButtonPosition , self . ButtonTextAlign , self . SelectableTextAlign , self . DisplayWindowPadding , self . DisplaySafeAreaPadding , self . MouseCursorScale , self . AntiAliasedLines , self . AntiAliasedFill , self . CurveTessellationTol , self . CircleSegmentMaxError , self . Colors . iter ( ) . enumerate ( ) . map ( | ( i , v ) | format ! ( "{}{:?}" , if i > 0 { ", " } else { "" } , v ) ) . collect :: < String > ( ) )
} }
} }
#[repr(C)] #[repr(C)]
@ -3376,12 +3396,12 @@ impl Default for ImGuiStorage {
#[repr(C)] #[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq)] #[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct ImGuiListClipper { pub struct ImGuiListClipper {
pub StartPosY: f32,
pub ItemsHeight: f32,
pub ItemsCount: ::std::os::raw::c_int,
pub StepNo: ::std::os::raw::c_int,
pub DisplayStart: ::std::os::raw::c_int, pub DisplayStart: ::std::os::raw::c_int,
pub DisplayEnd: ::std::os::raw::c_int, pub DisplayEnd: ::std::os::raw::c_int,
pub ItemsCount: ::std::os::raw::c_int,
pub StepNo: ::std::os::raw::c_int,
pub ItemsHeight: f32,
pub StartPosY: f32,
} }
#[test] #[test]
fn bindgen_test_layout_ImGuiListClipper() { fn bindgen_test_layout_ImGuiListClipper() {
@ -3396,23 +3416,23 @@ fn bindgen_test_layout_ImGuiListClipper() {
concat!("Alignment of ", stringify!(ImGuiListClipper)) concat!("Alignment of ", stringify!(ImGuiListClipper))
); );
assert_eq!( assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).StartPosY as *const _ as usize }, unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).DisplayStart as *const _ as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(ImGuiListClipper), stringify!(ImGuiListClipper),
"::", "::",
stringify!(StartPosY) stringify!(DisplayStart)
) )
); );
assert_eq!( assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).ItemsHeight as *const _ as usize }, unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).DisplayEnd as *const _ as usize },
4usize, 4usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(ImGuiListClipper), stringify!(ImGuiListClipper),
"::", "::",
stringify!(ItemsHeight) stringify!(DisplayEnd)
) )
); );
assert_eq!( assert_eq!(
@ -3436,23 +3456,23 @@ fn bindgen_test_layout_ImGuiListClipper() {
) )
); );
assert_eq!( assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).DisplayStart as *const _ as usize }, unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).ItemsHeight as *const _ as usize },
16usize, 16usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(ImGuiListClipper), stringify!(ImGuiListClipper),
"::", "::",
stringify!(DisplayStart) stringify!(ItemsHeight)
) )
); );
assert_eq!( assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).DisplayEnd as *const _ as usize }, unsafe { &(*(::std::ptr::null::<ImGuiListClipper>())).StartPosY as *const _ as usize },
20usize, 20usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
stringify!(ImGuiListClipper), stringify!(ImGuiListClipper),
"::", "::",
stringify!(DisplayEnd) stringify!(StartPosY)
) )
); );
} }
@ -4754,17 +4774,17 @@ pub struct ImFont {
pub ConfigDataCount: ::std::os::raw::c_short, pub ConfigDataCount: ::std::os::raw::c_short,
pub FallbackChar: ImWchar, pub FallbackChar: ImWchar,
pub EllipsisChar: ImWchar, pub EllipsisChar: ImWchar,
pub DirtyLookupTables: bool,
pub Scale: f32, pub Scale: f32,
pub Ascent: f32, pub Ascent: f32,
pub Descent: f32, pub Descent: f32,
pub MetricsTotalSurface: ::std::os::raw::c_int, pub MetricsTotalSurface: ::std::os::raw::c_int,
pub DirtyLookupTables: bool,
} }
#[test] #[test]
fn bindgen_test_layout_ImFont() { fn bindgen_test_layout_ImFont() {
assert_eq!( assert_eq!(
::std::mem::size_of::<ImFont>(), ::std::mem::size_of::<ImFont>(),
120usize, 112usize,
concat!("Size of: ", stringify!(ImFont)) concat!("Size of: ", stringify!(ImFont))
); );
assert_eq!( assert_eq!(
@ -4892,6 +4912,16 @@ fn bindgen_test_layout_ImFont() {
stringify!(EllipsisChar) stringify!(EllipsisChar)
) )
); );
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImFont>())).DirtyLookupTables as *const _ as usize },
94usize,
concat!(
"Offset of field: ",
stringify!(ImFont),
"::",
stringify!(DirtyLookupTables)
)
);
assert_eq!( assert_eq!(
unsafe { &(*(::std::ptr::null::<ImFont>())).Scale as *const _ as usize }, unsafe { &(*(::std::ptr::null::<ImFont>())).Scale as *const _ as usize },
96usize, 96usize,
@ -4932,16 +4962,6 @@ fn bindgen_test_layout_ImFont() {
stringify!(MetricsTotalSurface) stringify!(MetricsTotalSurface)
) )
); );
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImFont>())).DirtyLookupTables as *const _ as usize },
112usize,
concat!(
"Offset of field: ",
stringify!(ImFont),
"::",
stringify!(DirtyLookupTables)
)
);
} }
impl Default for ImFont { impl Default for ImFont {
fn default() -> Self { fn default() -> Self {
@ -6315,20 +6335,20 @@ extern "C" {
extern "C" { extern "C" {
pub fn igBeginPopupContextItem( pub fn igBeginPopupContextItem(
str_id: *const ::std::os::raw::c_char, str_id: *const ::std::os::raw::c_char,
mouse_button: ::std::os::raw::c_int, mouse_button: ImGuiMouseButton,
) -> bool; ) -> bool;
} }
extern "C" { extern "C" {
pub fn igBeginPopupContextWindow( pub fn igBeginPopupContextWindow(
str_id: *const ::std::os::raw::c_char, str_id: *const ::std::os::raw::c_char,
mouse_button: ::std::os::raw::c_int, mouse_button: ImGuiMouseButton,
also_over_items: bool, also_over_items: bool,
) -> bool; ) -> bool;
} }
extern "C" { extern "C" {
pub fn igBeginPopupContextVoid( pub fn igBeginPopupContextVoid(
str_id: *const ::std::os::raw::c_char, str_id: *const ::std::os::raw::c_char,
mouse_button: ::std::os::raw::c_int, mouse_button: ImGuiMouseButton,
) -> bool; ) -> bool;
} }
extern "C" { extern "C" {
@ -6344,7 +6364,7 @@ extern "C" {
extern "C" { extern "C" {
pub fn igOpenPopupOnItemClick( pub fn igOpenPopupOnItemClick(
str_id: *const ::std::os::raw::c_char, str_id: *const ::std::os::raw::c_char,
mouse_button: ::std::os::raw::c_int, mouse_button: ImGuiMouseButton,
) -> bool; ) -> bool;
} }
extern "C" { extern "C" {
@ -6469,7 +6489,7 @@ extern "C" {
pub fn igIsItemFocused() -> bool; pub fn igIsItemFocused() -> bool;
} }
extern "C" { extern "C" {
pub fn igIsItemClicked(mouse_button: ::std::os::raw::c_int) -> bool; pub fn igIsItemClicked(mouse_button: ImGuiMouseButton) -> bool;
} }
extern "C" { extern "C" {
pub fn igIsItemVisible() -> bool; pub fn igIsItemVisible() -> bool;
@ -6568,22 +6588,19 @@ extern "C" {
) -> ::std::os::raw::c_int; ) -> ::std::os::raw::c_int;
} }
extern "C" { extern "C" {
pub fn igIsMouseDown(button: ::std::os::raw::c_int) -> bool; pub fn igCaptureKeyboardFromApp(want_capture_keyboard_value: bool);
} }
extern "C" { extern "C" {
pub fn igIsAnyMouseDown() -> bool; pub fn igIsMouseDown(button: ImGuiMouseButton) -> bool;
} }
extern "C" { extern "C" {
pub fn igIsMouseClicked(button: ::std::os::raw::c_int, repeat: bool) -> bool; pub fn igIsMouseClicked(button: ImGuiMouseButton, repeat: bool) -> bool;
} }
extern "C" { extern "C" {
pub fn igIsMouseDoubleClicked(button: ::std::os::raw::c_int) -> bool; pub fn igIsMouseReleased(button: ImGuiMouseButton) -> bool;
} }
extern "C" { extern "C" {
pub fn igIsMouseReleased(button: ::std::os::raw::c_int) -> bool; pub fn igIsMouseDoubleClicked(button: ImGuiMouseButton) -> bool;
}
extern "C" {
pub fn igIsMouseDragging(button: ::std::os::raw::c_int, lock_threshold: f32) -> bool;
} }
extern "C" { extern "C" {
pub fn igIsMouseHoveringRect(r_min: ImVec2, r_max: ImVec2, clip: bool) -> bool; pub fn igIsMouseHoveringRect(r_min: ImVec2, r_max: ImVec2, clip: bool) -> bool;
@ -6592,16 +6609,19 @@ extern "C" {
pub fn igIsMousePosValid(mouse_pos: *const ImVec2) -> bool; pub fn igIsMousePosValid(mouse_pos: *const ImVec2) -> bool;
} }
extern "C" { extern "C" {
pub fn igResetMouseDragDelta(button: ::std::os::raw::c_int); pub fn igIsAnyMouseDown() -> bool;
}
extern "C" {
pub fn igIsMouseDragging(button: ImGuiMouseButton, lock_threshold: f32) -> bool;
}
extern "C" {
pub fn igResetMouseDragDelta(button: ImGuiMouseButton);
} }
extern "C" { extern "C" {
pub fn igGetMouseCursor() -> ImGuiMouseCursor; pub fn igGetMouseCursor() -> ImGuiMouseCursor;
} }
extern "C" { extern "C" {
pub fn igSetMouseCursor(type_: ImGuiMouseCursor); pub fn igSetMouseCursor(cursor_type: ImGuiMouseCursor);
}
extern "C" {
pub fn igCaptureKeyboardFromApp(want_capture_keyboard_value: bool);
} }
extern "C" { extern "C" {
pub fn igCaptureMouseFromApp(want_capture_mouse_value: bool); pub fn igCaptureMouseFromApp(want_capture_mouse_value: bool);
@ -7111,6 +7131,25 @@ extern "C" {
num_segments: ::std::os::raw::c_int, num_segments: ::std::os::raw::c_int,
); );
} }
extern "C" {
pub fn ImDrawList_AddNgon(
self_: *mut ImDrawList,
center: ImVec2,
radius: f32,
col: ImU32,
num_segments: ::std::os::raw::c_int,
thickness: f32,
);
}
extern "C" {
pub fn ImDrawList_AddNgonFilled(
self_: *mut ImDrawList,
center: ImVec2,
radius: f32,
col: ImU32,
num_segments: ::std::os::raw::c_int,
);
}
extern "C" { extern "C" {
pub fn ImDrawList_AddText( pub fn ImDrawList_AddText(
self_: *mut ImDrawList, self_: *mut ImDrawList,
@ -7154,10 +7193,10 @@ extern "C" {
extern "C" { extern "C" {
pub fn ImDrawList_AddBezierCurve( pub fn ImDrawList_AddBezierCurve(
self_: *mut ImDrawList, self_: *mut ImDrawList,
pos0: ImVec2, p1: ImVec2,
cp0: ImVec2, p2: ImVec2,
cp1: ImVec2, p3: ImVec2,
pos1: ImVec2, p4: ImVec2,
col: ImU32, col: ImU32,
thickness: f32, thickness: f32,
num_segments: ::std::os::raw::c_int, num_segments: ::std::os::raw::c_int,
@ -7239,9 +7278,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn ImDrawList_PathBezierCurveTo( pub fn ImDrawList_PathBezierCurveTo(
self_: *mut ImDrawList, self_: *mut ImDrawList,
p1: ImVec2,
p2: ImVec2, p2: ImVec2,
p3: ImVec2, p3: ImVec2,
p4: ImVec2,
num_segments: ::std::os::raw::c_int, num_segments: ::std::os::raw::c_int,
); );
} }
@ -7289,6 +7328,13 @@ extern "C" {
vtx_count: ::std::os::raw::c_int, vtx_count: ::std::os::raw::c_int,
); );
} }
extern "C" {
pub fn ImDrawList_PrimUnreserve(
self_: *mut ImDrawList,
idx_count: ::std::os::raw::c_int,
vtx_count: ::std::os::raw::c_int,
);
}
extern "C" { extern "C" {
pub fn ImDrawList_PrimRect(self_: *mut ImDrawList, a: ImVec2, b: ImVec2, col: ImU32); pub fn ImDrawList_PrimRect(self_: *mut ImDrawList, a: ImVec2, b: ImVec2, col: ImU32);
} }
@ -7768,13 +7814,13 @@ extern "C" {
extern "C" { extern "C" {
pub fn igGetMouseDragDelta_nonUDT( pub fn igGetMouseDragDelta_nonUDT(
pOut: *mut ImVec2, pOut: *mut ImVec2,
button: ::std::os::raw::c_int, button: ImGuiMouseButton,
lock_threshold: f32, lock_threshold: f32,
); );
} }
extern "C" { extern "C" {
pub fn igGetMouseDragDelta_nonUDT2( pub fn igGetMouseDragDelta_nonUDT2(
button: ::std::os::raw::c_int, button: ImGuiMouseButton,
lock_threshold: f32, lock_threshold: f32,
) -> ImVec2_Simple; ) -> ImVec2_Simple;
} }

@ -1 +1 @@
Subproject commit d9e1d9a80d621cd96d9900ac340092853100416f Subproject commit c5eea0b2dbfb2fc763292c410aba69a72eccfc4f

View File

@ -654,6 +654,7 @@ impl WinitPlatform {
imgui::MouseCursor::ResizeNESW => MouseCursor::NeswResize, imgui::MouseCursor::ResizeNESW => MouseCursor::NeswResize,
imgui::MouseCursor::ResizeNWSE => MouseCursor::NwseResize, imgui::MouseCursor::ResizeNWSE => MouseCursor::NwseResize,
imgui::MouseCursor::Hand => MouseCursor::Hand, imgui::MouseCursor::Hand => MouseCursor::Hand,
imgui::MouseCursor::NotAllowed => MouseCursor::NotAllowed,
}); });
} }
_ => window.hide_cursor(true), _ => window.hide_cursor(true),
@ -685,6 +686,7 @@ impl WinitPlatform {
imgui::MouseCursor::ResizeNESW => MouseCursor::NeswResize, imgui::MouseCursor::ResizeNESW => MouseCursor::NeswResize,
imgui::MouseCursor::ResizeNWSE => MouseCursor::NwseResize, imgui::MouseCursor::ResizeNWSE => MouseCursor::NwseResize,
imgui::MouseCursor::Hand => MouseCursor::Hand, imgui::MouseCursor::Hand => MouseCursor::Hand,
imgui::MouseCursor::NotAllowed => MouseCursor::NotAllowed,
}); });
} }
_ => window.set_cursor_visible(false), _ => window.set_cursor_visible(false),

View File

@ -20,11 +20,11 @@ pub struct Font {
pub config_data_count: i16, pub config_data_count: i16,
pub fallback_char: sys::ImWchar, pub fallback_char: sys::ImWchar,
pub ellipsis_char: sys::ImWchar, pub ellipsis_char: sys::ImWchar,
pub dirty_lookup_tables: bool,
pub scale: f32, pub scale: f32,
pub ascent: f32, pub ascent: f32,
pub descent: f32, pub descent: f32,
pub metrics_total_surface: c_int, pub metrics_total_surface: c_int,
pub dirty_lookup_tables: bool,
} }
unsafe impl RawCast<sys::ImFont> for Font {} unsafe impl RawCast<sys::ImFont> for Font {}
@ -59,9 +59,10 @@ fn test_font_memory_layout() {
assert_field_offset!(config_data, ConfigData); assert_field_offset!(config_data, ConfigData);
assert_field_offset!(config_data_count, ConfigDataCount); assert_field_offset!(config_data_count, ConfigDataCount);
assert_field_offset!(fallback_char, FallbackChar); assert_field_offset!(fallback_char, FallbackChar);
assert_field_offset!(ellipsis_char, EllipsisChar);
assert_field_offset!(dirty_lookup_tables, DirtyLookupTables);
assert_field_offset!(scale, Scale); assert_field_offset!(scale, Scale);
assert_field_offset!(ascent, Ascent); assert_field_offset!(ascent, Ascent);
assert_field_offset!(descent, Descent); assert_field_offset!(descent, Descent);
assert_field_offset!(metrics_total_surface, MetricsTotalSurface); assert_field_offset!(metrics_total_surface, MetricsTotalSurface);
assert_field_offset!(dirty_lookup_tables, DirtyLookupTables);
} }

View File

@ -1,3 +1,5 @@
use std::ptr;
use crate::sys; use crate::sys;
use crate::Ui; use crate::Ui;
@ -50,6 +52,10 @@ pub enum MouseCursor {
ResizeNWSE = sys::ImGuiMouseCursor_ResizeNWSE, ResizeNWSE = sys::ImGuiMouseCursor_ResizeNWSE,
/// Not used automatically, use for e.g. hyperlinks /// Not used automatically, use for e.g. hyperlinks
Hand = sys::ImGuiMouseCursor_Hand, Hand = sys::ImGuiMouseCursor_Hand,
/// When hovering something with disallowed interactions.
///
/// Usually a crossed circle.
NotAllowed = sys::ImGuiMouseCursor_NotAllowed,
} }
impl MouseCursor { impl MouseCursor {
@ -63,6 +69,7 @@ impl MouseCursor {
MouseCursor::ResizeNESW, MouseCursor::ResizeNESW,
MouseCursor::ResizeNWSE, MouseCursor::ResizeNWSE,
MouseCursor::Hand, MouseCursor::Hand,
MouseCursor::NotAllowed,
]; ];
/// Total count of `MouseCursor` variants /// Total count of `MouseCursor` variants
pub const COUNT: usize = sys::ImGuiMouseCursor_COUNT as usize; pub const COUNT: usize = sys::ImGuiMouseCursor_COUNT as usize;
@ -155,6 +162,7 @@ impl<'ui> Ui<'ui> {
sys::ImGuiMouseCursor_ResizeNESW => Some(MouseCursor::ResizeNESW), sys::ImGuiMouseCursor_ResizeNESW => Some(MouseCursor::ResizeNESW),
sys::ImGuiMouseCursor_ResizeNWSE => Some(MouseCursor::ResizeNWSE), sys::ImGuiMouseCursor_ResizeNWSE => Some(MouseCursor::ResizeNWSE),
sys::ImGuiMouseCursor_Hand => Some(MouseCursor::Hand), sys::ImGuiMouseCursor_Hand => Some(MouseCursor::Hand),
sys::ImGuiMouseCursor_NotAllowed => Some(MouseCursor::NotAllowed),
_ => None, _ => None,
} }
} }
@ -170,6 +178,12 @@ impl<'ui> Ui<'ui> {
); );
} }
} }
pub fn is_current_mouse_pos_valid(&self) -> bool {
unsafe { sys::igIsMousePosValid(ptr::null()) }
}
pub fn is_mouse_pos_valid(&self, mouse_pos: [f32; 2]) -> bool {
unsafe { sys::igIsMousePosValid(&mouse_pos.into()) }
}
} }
#[test] #[test]

View File

@ -85,7 +85,7 @@ pub fn dear_imgui_version() -> &'static str {
#[test] #[test]
fn test_version() { fn test_version() {
assert_eq!(dear_imgui_version(), "1.74"); assert_eq!(dear_imgui_version(), "1.75");
} }
impl Context { impl Context {

View File

@ -123,6 +123,11 @@ pub struct Style {
/// Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce /// Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce
/// quality. /// quality.
pub curve_tessellation_tol: f32, pub curve_tessellation_tol: f32,
/// Maximum error (in pixels) allowed when drawing circles or rounded corner rectangles with no
/// explicit segment count specified.
///
/// Decrease for higher quality but more geometry.
pub circle_segment_max_error: f32,
/// Style colors. /// Style colors.
pub colors: [[f32; 4]; 48], pub colors: [[f32; 4]; 48],
} }
@ -446,6 +451,7 @@ fn test_style_memory_layout() {
assert_field_offset!(anti_aliased_lines, AntiAliasedLines); assert_field_offset!(anti_aliased_lines, AntiAliasedLines);
assert_field_offset!(anti_aliased_fill, AntiAliasedFill); assert_field_offset!(anti_aliased_fill, AntiAliasedFill);
assert_field_offset!(curve_tessellation_tol, CurveTessellationTol); assert_field_offset!(curve_tessellation_tol, CurveTessellationTol);
assert_field_offset!(circle_segment_max_error, CircleSegmentMaxError);
assert_field_offset!(colors, Colors); assert_field_offset!(colors, Colors);
} }