Upgrade to cimgui/imgui 1.74

This commit is contained in:
Joonas Javanainen 2020-01-12 14:05:51 +02:00
parent af14eb0c24
commit 2b72a2a62c
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
8 changed files with 81 additions and 75 deletions

View File

@ -8,8 +8,8 @@
### Changed
- Upgrade to cimgui / imgui 1.73
-
- Upgrade to cimgui / imgui 1.74
### Removed
- Various things that were deprecated in imgui-rs 0.2.0

View File

@ -4,7 +4,7 @@
Minimum Rust version: 1.36
Wrapped Dear ImGui version: 1.73
Wrapped Dear ImGui version: 1.74
[![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)

View File

@ -90,7 +90,7 @@ pub fn generate_bindings<P: AsRef<Path>>(cimgui_path: &P) -> Result<Bindings, Er
.raw_line("#![allow(non_snake_case)]")
.raw_line("#![allow(clippy::all)]")
.header_contents("cimgui.h", &header)
.rust_target(RustTarget::Stable_1_33)
.rust_target(RustTarget::Stable_1_36)
.default_enum_style(EnumVariation::Consts)
.prepend_enum_name(false)
.generate_comments(false)

View File

@ -1389,12 +1389,11 @@ pub const ImGuiNavInput_FocusNext: ImGuiNavInput_ = 13;
pub const ImGuiNavInput_TweakSlow: ImGuiNavInput_ = 14;
pub const ImGuiNavInput_TweakFast: ImGuiNavInput_ = 15;
pub const ImGuiNavInput_KeyMenu_: ImGuiNavInput_ = 16;
pub const ImGuiNavInput_KeyTab_: ImGuiNavInput_ = 17;
pub const ImGuiNavInput_KeyLeft_: ImGuiNavInput_ = 18;
pub const ImGuiNavInput_KeyRight_: ImGuiNavInput_ = 19;
pub const ImGuiNavInput_KeyUp_: ImGuiNavInput_ = 20;
pub const ImGuiNavInput_KeyDown_: ImGuiNavInput_ = 21;
pub const ImGuiNavInput_COUNT: ImGuiNavInput_ = 22;
pub const ImGuiNavInput_KeyLeft_: ImGuiNavInput_ = 17;
pub const ImGuiNavInput_KeyRight_: ImGuiNavInput_ = 18;
pub const ImGuiNavInput_KeyUp_: ImGuiNavInput_ = 19;
pub const ImGuiNavInput_KeyDown_: ImGuiNavInput_ = 20;
pub const ImGuiNavInput_COUNT: ImGuiNavInput_ = 21;
pub const ImGuiNavInput_InternalStart_: ImGuiNavInput_ = 16;
pub type ImGuiNavInput_ = u32;
pub const ImGuiConfigFlags_None: ImGuiConfigFlags_ = 0;
@ -2008,7 +2007,7 @@ pub struct ImGuiIO {
pub KeyAlt: bool,
pub KeySuper: bool,
pub KeysDown: [bool; 512usize],
pub NavInputs: [f32; 22usize],
pub NavInputs: [f32; 21usize],
pub WantCaptureMouse: bool,
pub WantCaptureKeyboard: bool,
pub WantTextInput: bool,
@ -2037,15 +2036,15 @@ pub struct ImGuiIO {
pub MouseDragMaxDistanceSqr: [f32; 5usize],
pub KeysDownDuration: [f32; 512usize],
pub KeysDownDurationPrev: [f32; 512usize],
pub NavInputsDownDuration: [f32; 22usize],
pub NavInputsDownDurationPrev: [f32; 22usize],
pub NavInputsDownDuration: [f32; 21usize],
pub NavInputsDownDurationPrev: [f32; 21usize],
pub InputQueueCharacters: ImVector_ImWchar,
}
#[test]
fn bindgen_test_layout_ImGuiIO() {
assert_eq!(
::std::mem::size_of::<ImGuiIO>(),
5472usize,
5456usize,
concat!("Size of: ", stringify!(ImGuiIO))
);
assert_eq!(
@ -2524,7 +2523,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).WantCaptureMouse as *const _ as usize },
924usize,
920usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2534,7 +2533,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).WantCaptureKeyboard as *const _ as usize },
925usize,
921usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2544,7 +2543,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).WantTextInput as *const _ as usize },
926usize,
922usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2554,7 +2553,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).WantSetMousePos as *const _ as usize },
927usize,
923usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2564,7 +2563,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).WantSaveIniSettings as *const _ as usize },
928usize,
924usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2574,7 +2573,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).NavActive as *const _ as usize },
929usize,
925usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2584,7 +2583,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).NavVisible as *const _ as usize },
930usize,
926usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2594,7 +2593,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).Framerate as *const _ as usize },
932usize,
928usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2604,7 +2603,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MetricsRenderVertices as *const _ as usize },
936usize,
932usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2614,7 +2613,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MetricsRenderIndices as *const _ as usize },
940usize,
936usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2624,7 +2623,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MetricsRenderWindows as *const _ as usize },
944usize,
940usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2634,7 +2633,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MetricsActiveWindows as *const _ as usize },
948usize,
944usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2646,7 +2645,7 @@ fn bindgen_test_layout_ImGuiIO() {
unsafe {
&(*(::std::ptr::null::<ImGuiIO>())).MetricsActiveAllocations as *const _ as usize
},
952usize,
948usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2656,7 +2655,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDelta as *const _ as usize },
956usize,
952usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2666,7 +2665,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MousePosPrev as *const _ as usize },
964usize,
960usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2676,7 +2675,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseClickedPos as *const _ as usize },
972usize,
968usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2686,7 +2685,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseClickedTime as *const _ as usize },
1016usize,
1008usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2696,7 +2695,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseClicked as *const _ as usize },
1056usize,
1048usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2706,7 +2705,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDoubleClicked as *const _ as usize },
1061usize,
1053usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2716,7 +2715,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseReleased as *const _ as usize },
1066usize,
1058usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2726,7 +2725,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDownOwned as *const _ as usize },
1071usize,
1063usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2736,7 +2735,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDownWasDoubleClick as *const _ as usize },
1076usize,
1068usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2746,7 +2745,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDownDuration as *const _ as usize },
1084usize,
1076usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2756,7 +2755,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDownDurationPrev as *const _ as usize },
1104usize,
1096usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2766,7 +2765,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDragMaxDistanceAbs as *const _ as usize },
1124usize,
1116usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2776,7 +2775,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).MouseDragMaxDistanceSqr as *const _ as usize },
1164usize,
1156usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2786,7 +2785,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).KeysDownDuration as *const _ as usize },
1184usize,
1176usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2796,7 +2795,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).KeysDownDurationPrev as *const _ as usize },
3232usize,
3224usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2806,7 +2805,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).NavInputsDownDuration as *const _ as usize },
5280usize,
5272usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2818,7 +2817,7 @@ fn bindgen_test_layout_ImGuiIO() {
unsafe {
&(*(::std::ptr::null::<ImGuiIO>())).NavInputsDownDurationPrev as *const _ as usize
},
5368usize,
5356usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -2828,7 +2827,7 @@ fn bindgen_test_layout_ImGuiIO() {
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ImGuiIO>())).InputQueueCharacters as *const _ as usize },
5456usize,
5440usize,
concat!(
"Offset of field: ",
stringify!(ImGuiIO),
@ -5735,10 +5734,10 @@ extern "C" {
pub fn igDragScalar(
label: *const ::std::os::raw::c_char,
data_type: ImGuiDataType,
v: *mut ::std::os::raw::c_void,
p_data: *mut ::std::os::raw::c_void,
v_speed: f32,
v_min: *const ::std::os::raw::c_void,
v_max: *const ::std::os::raw::c_void,
p_min: *const ::std::os::raw::c_void,
p_max: *const ::std::os::raw::c_void,
format: *const ::std::os::raw::c_char,
power: f32,
) -> bool;
@ -5747,11 +5746,11 @@ extern "C" {
pub fn igDragScalarN(
label: *const ::std::os::raw::c_char,
data_type: ImGuiDataType,
v: *mut ::std::os::raw::c_void,
p_data: *mut ::std::os::raw::c_void,
components: ::std::os::raw::c_int,
v_speed: f32,
v_min: *const ::std::os::raw::c_void,
v_max: *const ::std::os::raw::c_void,
p_min: *const ::std::os::raw::c_void,
p_max: *const ::std::os::raw::c_void,
format: *const ::std::os::raw::c_char,
power: f32,
) -> bool;
@ -5845,9 +5844,9 @@ extern "C" {
pub fn igSliderScalar(
label: *const ::std::os::raw::c_char,
data_type: ImGuiDataType,
v: *mut ::std::os::raw::c_void,
v_min: *const ::std::os::raw::c_void,
v_max: *const ::std::os::raw::c_void,
p_data: *mut ::std::os::raw::c_void,
p_min: *const ::std::os::raw::c_void,
p_max: *const ::std::os::raw::c_void,
format: *const ::std::os::raw::c_char,
power: f32,
) -> bool;
@ -5856,10 +5855,10 @@ extern "C" {
pub fn igSliderScalarN(
label: *const ::std::os::raw::c_char,
data_type: ImGuiDataType,
v: *mut ::std::os::raw::c_void,
p_data: *mut ::std::os::raw::c_void,
components: ::std::os::raw::c_int,
v_min: *const ::std::os::raw::c_void,
v_max: *const ::std::os::raw::c_void,
p_min: *const ::std::os::raw::c_void,
p_max: *const ::std::os::raw::c_void,
format: *const ::std::os::raw::c_char,
power: f32,
) -> bool;
@ -5890,9 +5889,9 @@ extern "C" {
label: *const ::std::os::raw::c_char,
size: ImVec2,
data_type: ImGuiDataType,
v: *mut ::std::os::raw::c_void,
v_min: *const ::std::os::raw::c_void,
v_max: *const ::std::os::raw::c_void,
p_data: *mut ::std::os::raw::c_void,
p_min: *const ::std::os::raw::c_void,
p_max: *const ::std::os::raw::c_void,
format: *const ::std::os::raw::c_char,
power: f32,
) -> bool;
@ -6007,9 +6006,9 @@ extern "C" {
pub fn igInputScalar(
label: *const ::std::os::raw::c_char,
data_type: ImGuiDataType,
v: *mut ::std::os::raw::c_void,
step: *const ::std::os::raw::c_void,
step_fast: *const ::std::os::raw::c_void,
p_data: *mut ::std::os::raw::c_void,
p_step: *const ::std::os::raw::c_void,
p_step_fast: *const ::std::os::raw::c_void,
format: *const ::std::os::raw::c_char,
flags: ImGuiInputTextFlags,
) -> bool;
@ -6018,10 +6017,10 @@ extern "C" {
pub fn igInputScalarN(
label: *const ::std::os::raw::c_char,
data_type: ImGuiDataType,
v: *mut ::std::os::raw::c_void,
p_data: *mut ::std::os::raw::c_void,
components: ::std::os::raw::c_int,
step: *const ::std::os::raw::c_void,
step_fast: *const ::std::os::raw::c_void,
p_step: *const ::std::os::raw::c_void,
p_step_fast: *const ::std::os::raw::c_void,
format: *const ::std::os::raw::c_char,
flags: ImGuiInputTextFlags,
) -> bool;
@ -6263,18 +6262,18 @@ extern "C" {
float_format: *const ::std::os::raw::c_char,
);
}
extern "C" {
pub fn igBeginMainMenuBar() -> bool;
}
extern "C" {
pub fn igEndMainMenuBar();
}
extern "C" {
pub fn igBeginMenuBar() -> bool;
}
extern "C" {
pub fn igEndMenuBar();
}
extern "C" {
pub fn igBeginMainMenuBar() -> bool;
}
extern "C" {
pub fn igEndMainMenuBar();
}
extern "C" {
pub fn igBeginMenu(label: *const ::std::os::raw::c_char, enabled: bool) -> bool;
}
@ -6486,6 +6485,9 @@ extern "C" {
extern "C" {
pub fn igIsItemDeactivatedAfterEdit() -> bool;
}
extern "C" {
pub fn igIsItemToggledOpen() -> bool;
}
extern "C" {
pub fn igIsAnyItemHovered() -> bool;
}

@ -1 +1 @@
Subproject commit 1c65ee2bdc719fb3ef62b4615d66fe8effa21148
Subproject commit d9e1d9a80d621cd96d9900ac340092853100416f

View File

@ -117,7 +117,7 @@ impl NavInput {
NavInput::TweakFast,
];
/// Amount of internal/hidden variants (not exposed by imgui-rs)
const INTERNAL_COUNT: usize = 6;
const INTERNAL_COUNT: usize = 5;
/// Total count of `NavInput` variants
pub const COUNT: usize = sys::ImGuiNavInput_COUNT as usize - NavInput::INTERNAL_COUNT;
}

View File

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

View File

@ -64,6 +64,10 @@ impl<'ui> Ui<'ui> {
pub fn is_item_deactivated_after_edit(&self) -> bool {
unsafe { sys::igIsItemDeactivatedAfterEdit() }
}
/// Returns `true` if the last item open state was toggled
pub fn is_item_toggled_open(&self) -> bool {
unsafe { sys::igIsItemToggledOpen() }
}
/// Returns `true` if any item is hovered
pub fn is_any_item_hovered(&self) -> bool {
unsafe { sys::igIsAnyItemHovered() }