Fixed build errors with docking feature

This commit is contained in:
Robin 2022-12-21 21:21:57 +01:00
parent 2d9efba59b
commit 0cb64e8b59
6 changed files with 62 additions and 16 deletions

View File

@ -142,7 +142,7 @@ impl<'ui> DrawListMut<'ui> {
cfg_if::cfg_if! {
if #[cfg(feature = "docking")] {
// Has extra overload in docking branch
sys::igGetBackgroundDrawListNil()
sys::igGetBackgroundDrawList_Nil()
} else {
sys::igGetBackgroundDrawList()
}
@ -161,7 +161,7 @@ impl<'ui> DrawListMut<'ui> {
cfg_if::cfg_if! {
if #[cfg(feature = "docking")] {
// Has extra overload in docking branch
sys::igGetForegroundDrawListNil()
sys::igGetForegroundDrawList_Nil()
} else {
sys::igGetForegroundDrawList()
}

View File

@ -345,7 +345,13 @@ impl Ui {
#[inline]
#[doc(alias = "IsKeyDown")]
pub fn is_key_index_down(&self, key_index: u32) -> bool {
unsafe { sys::igIsKeyDown(key_index) }
cfg_if::cfg_if!{
if #[cfg(feature = "docking")] {
unsafe { sys::igIsKeyDown_Nil(key_index) }
} else {
unsafe { sys::igIsKeyDown(key_index) }
}
}
}
/// Returns true if the key was pressed (went from !down to down).
@ -365,7 +371,13 @@ impl Ui {
#[inline]
#[doc(alias = "IsKeyPressed")]
pub fn is_key_index_pressed(&self, key_index: u32) -> bool {
unsafe { sys::igIsKeyPressed(key_index, true) }
cfg_if::cfg_if!{
if #[cfg(feature = "docking")] {
unsafe { sys::igIsKeyPressed_Bool(key_index, true) }
} else {
unsafe { sys::igIsKeyPressed(key_index, true) }
}
}
}
/// Returns true if the key was pressed (went from !down to down).
@ -386,7 +398,13 @@ impl Ui {
#[inline]
#[doc(alias = "IsKeyPressed")]
pub fn is_key_index_pressed_no_repeat(&self, key_index: u32) -> bool {
unsafe { sys::igIsKeyPressed(key_index, false) }
cfg_if::cfg_if!{
if #[cfg(feature = "docking")] {
unsafe { sys::igIsKeyPressed_Bool(key_index, false) }
} else {
unsafe { sys::igIsKeyPressed(key_index, false) }
}
}
}
/// Returns true if the key was released (went from down to !down)
@ -404,7 +422,13 @@ impl Ui {
#[inline]
#[doc(alias = "IsKeyReleased")]
pub fn is_key_index_released(&self, key_index: u32) -> bool {
unsafe { sys::igIsKeyReleased(key_index) }
cfg_if::cfg_if!{
if #[cfg(feature = "docking")] {
unsafe { sys::igIsKeyReleased_Nil(key_index) }
} else {
unsafe { sys::igIsKeyReleased(key_index) }
}
}
}
/// Returns a count of key presses using the given repeat rate/delay settings.

View File

@ -95,7 +95,13 @@ impl Ui {
/// Equivalent to indexing the Io struct with the button, e.g. `ui.io()[button]`.
#[doc(alias = "IsMouseDown")]
pub fn is_mouse_down(&self, button: MouseButton) -> bool {
unsafe { sys::igIsMouseDown(button as i32) }
cfg_if::cfg_if!{
if #[cfg(feature = "docking")] {
unsafe { sys::igIsMouseDown_Nil(button as i32) }
} else {
unsafe { sys::igIsMouseDown(button as i32) }
}
}
}
/// Returns true if any mouse button is held down
#[doc(alias = "IsAnyMouseDown")]
@ -105,7 +111,13 @@ impl Ui {
/// Returns true if the given mouse button was clicked (went from !down to down)
#[doc(alias = "IsMouseClicked")]
pub fn is_mouse_clicked(&self, button: MouseButton) -> bool {
unsafe { sys::igIsMouseClicked(button as i32, false) }
cfg_if::cfg_if!{
if #[cfg(feature = "docking")] {
unsafe { sys::igIsMouseClicked_Bool(button as i32, false) }
} else {
unsafe { sys::igIsMouseClicked(button as i32, false) }
}
}
}
/// Returns true if the given mouse button was double-clicked
#[doc(alias = "IsMouseDoubleClicked")]
@ -115,7 +127,13 @@ impl Ui {
/// Returns true if the given mouse button was released (went from down to !down)
#[doc(alias = "IsMouseReleased")]
pub fn is_mouse_released(&self, button: MouseButton) -> bool {
unsafe { sys::igIsMouseReleased(button as i32) }
cfg_if::cfg_if!{
if #[cfg(feature = "docking")] {
unsafe { sys::igIsMouseReleased_Nil(button as i32) }
} else {
unsafe { sys::igIsMouseReleased(button as i32) }
}
}
}
/// Returns true if the mouse is currently dragging with the given mouse button held down
#[doc(alias = "IsMouseDragging")]

View File

@ -188,7 +188,7 @@ pub struct Io {
#[cfg(feature = "docking")]
pub config_viewports_no_auto_merge: bool,
#[cfg(feature = "docking")]
pub config_viewports_notask_bar_icon: bool,
pub config_viewports_no_task_bar_icon: bool,
#[cfg(feature = "docking")]
pub config_viewports_no_decoration: bool,
#[cfg(feature = "docking")]
@ -312,6 +312,8 @@ pub struct Io {
/// Most users don't have a mouse with a horizontal wheel, and may not be filled by all
/// backends.
pub mouse_wheel_h: f32,
#[cfg(feature = "docking")]
mouse_hovered_viewport: sys::ImGuiID,
/// Keyboard modifier pressed: Control
pub key_ctrl: bool,
/// Keyboard modifier pressed: Shift
@ -337,6 +339,8 @@ pub struct Io {
mouse_down_owned_unless_popup_close: [bool; 5],
mouse_down_duration: [f32; 5],
mouse_down_duration_prev: [f32; 5],
#[cfg(feature = "docking")]
mouse_drag_max_distance_abs: [sys::ImVec2; 5],
mouse_drag_max_distance_sqr: [f32; 5],
pen_pressure: f32,

View File

@ -629,7 +629,7 @@ impl Ui {
// imgui uses utf8...though that is a continuous process there.
cfg_if::cfg_if! {
if #[cfg(feature = "docking")] {
CStr::from_ptr(sys::igTableGetColumnNameInt(-1))
CStr::from_ptr(sys::igTableGetColumnName_Int(-1))
.to_str()
.unwrap()
} else {
@ -650,7 +650,7 @@ impl Ui {
// imgui uses utf8...though that is a continuous process there.
cfg_if::cfg_if! {
if #[cfg(feature="docking")] {
CStr::from_ptr(sys::igTableGetColumnNameInt(column as i32))
CStr::from_ptr(sys::igTableGetColumnName_Int(column as i32))
.to_str()
.unwrap()
} else {

View File

@ -37,7 +37,7 @@ impl<'ui> Ui {
unsafe {
cfg_if::cfg_if! {
if #[cfg(feature = "docking")] {
sys::igSetScrollXFloat(scroll_x);
sys::igSetScrollX_Float(scroll_x);
} else {
sys::igSetScrollX(scroll_x);
}
@ -50,7 +50,7 @@ impl<'ui> Ui {
unsafe {
cfg_if::cfg_if! {
if #[cfg(feature = "docking")] {
sys::igSetScrollYFloat(scroll_y);
sys::igSetScrollY_Float(scroll_y);
} else {
sys::igSetScrollY(scroll_y);
}
@ -113,7 +113,7 @@ impl<'ui> Ui {
unsafe {
cfg_if::cfg_if! {
if #[cfg(feature = "docking")] {
sys::igSetScrollFromPosXFloat(local_x, center_x_ratio)
sys::igSetScrollFromPosX_Float(local_x, center_x_ratio)
} else {
sys::igSetScrollFromPosX(local_x, center_x_ratio)
}
@ -140,7 +140,7 @@ impl<'ui> Ui {
unsafe {
cfg_if::cfg_if! {
if #[cfg(feature = "docking")] {
sys::igSetScrollFromPosYFloat(local_y, center_y_ratio);
sys::igSetScrollFromPosY_Float(local_y, center_y_ratio);
} else {
sys::igSetScrollFromPosY(local_y, center_y_ratio);
}