Upgrade to cimgui/imgui 1.72b

This commit is contained in:
Joonas Javanainen 2019-09-05 09:19:35 +03:00
parent a34262b6eb
commit 8a862ae220
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
10 changed files with 1050 additions and 863 deletions

View File

@ -31,6 +31,7 @@
Closure-based function (e.g. build()) are unaffected and do this
automatically
- Bump minimum Rust version to 1.36 (some dependencies, including winit, require MaybeUninit)
- Upgrade to cimgui / imgui 1.72b
### Removed

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
Subproject commit 2b03f434d4afd5cae9d352035edc1fbfd1ac3c2d
Subproject commit c0d75f6f8d6ddf7262576fb57e6096f188e807b8

View File

@ -51,7 +51,7 @@ pub struct FontAtlas {
tex_uv_scale: [f32; 2],
tex_uv_white_pixel: [f32; 2],
fonts: ImVector<*mut Font>,
custom_rects: sys::ImVector_CustomRect,
custom_rects: sys::ImVector_ImFontAtlasCustomRect,
config_data: sys::ImVector_ImFontConfig,
custom_rect_ids: [i32; 1],
}

View File

@ -20,6 +20,7 @@ pub enum Key {
Space = sys::ImGuiKey_Space,
Enter = sys::ImGuiKey_Enter,
Escape = sys::ImGuiKey_Escape,
KeyPadEnter = sys::ImGuiKey_KeyPadEnter,
A = sys::ImGuiKey_A,
C = sys::ImGuiKey_C,
V = sys::ImGuiKey_V,
@ -46,6 +47,7 @@ impl Key {
Key::Space,
Key::Enter,
Key::Escape,
Key::KeyPadEnter,
Key::A,
Key::C,
Key::V,

View File

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

View File

@ -288,7 +288,9 @@ impl<'ui> Ui<'ui> {
pub fn set_next_item_width(&self, item_width: f32) {
unsafe { sys::igSetNextItemWidth(item_width) };
}
/// Returns the width of the item given the pushed settings and the current cursor position
/// Returns the width of the item given the pushed settings and the current cursor position.
///
/// This is NOT necessarily the width of last item.
pub fn calc_item_width(&self) -> f32 {
unsafe { sys::igCalcItemWidth() }
}

View File

@ -87,8 +87,10 @@ pub struct Style {
///
/// Set to 0.0 to have rectangular tabs.
pub tab_rounding: f32,
/// Thichkness of border around tabs
/// Thickness of border around tabs
pub tab_border_size: f32,
/// Side of the color buttonton pubin color editor widgets (left/right).
pub color_button_position: Direction,
/// Alignment of button text when button is larger than text.
///
/// Defaults to [0.5, 0.5] (centered).
@ -435,6 +437,7 @@ fn test_style_memory_layout() {
assert_field_offset!(grab_rounding, GrabRounding);
assert_field_offset!(tab_rounding, TabRounding);
assert_field_offset!(tab_border_size, TabBorderSize);
assert_field_offset!(color_button_position, ColorButtonPosition);
assert_field_offset!(button_text_align, ButtonTextAlign);
assert_field_offset!(selectable_text_align, SelectableTextAlign);
assert_field_offset!(display_window_padding, DisplayWindowPadding);

View File

@ -13,7 +13,7 @@ bitflags! {
const ALLOW_WHEN_BLOCKED_BY_POPUP = sys::ImGuiHoveredFlags_AllowWhenBlockedByPopup;
/// Return true even if an active item is blocking access to this item
const ALLOW_WHEN_BLOCKED_BY_ACTIVE_ITEM = sys::ImGuiHoveredFlags_AllowWhenBlockedByActiveItem;
/// Return true even if the position is overlapped by another window
/// Return true even if the position is obstructed or overlapped by another window
const ALLOW_WHEN_OVERLAPPED = sys::ImGuiHoveredFlags_AllowWhenOverlapped;
/// Return true even if the item is disabled
const ALLOW_WHEN_DISABLED = sys::ImGuiHoveredFlags_AllowWhenDisabled;

View File

@ -35,6 +35,20 @@ impl<'ui> Ui<'ui> {
pub fn set_scroll_y(&self, scroll_y: f32) {
unsafe { sys::igSetScrollY(scroll_y) };
}
/// Adjusts the horizontal scroll position to make the current cursor position visible
pub fn set_scroll_here_x(&self) {
unsafe { sys::igSetScrollHereX(0.5) };
}
/// Adjusts the horizontal scroll position to make the current cursor position visible.
///
/// center_x_ratio:
///
/// - `0.0`: left
/// - `0.5`: center
/// - `1.0`: right
pub fn set_scroll_here_x_with_ratio(&self, center_x_ratio: f32) {
unsafe { sys::igSetScrollHereX(center_x_ratio) };
}
/// Adjusts the vertical scroll position to make the current cursor position visible
pub fn set_scroll_here_y(&self) {
unsafe { sys::igSetScrollHereY(0.5) };
@ -49,6 +63,20 @@ impl<'ui> Ui<'ui> {
pub fn set_scroll_here_y_with_ratio(&self, center_y_ratio: f32) {
unsafe { sys::igSetScrollHereY(center_y_ratio) };
}
/// Adjusts the horizontal scroll position to make the given position visible
pub fn set_scroll_from_pos_x(&self, local_x: f32) {
unsafe { sys::igSetScrollFromPosX(local_x, 0.5) };
}
/// Adjusts the horizontal scroll position to make the given position visible.
///
/// center_x_ratio:
///
/// - `0.0`: left
/// - `0.5`: center
/// - `1.0`: right
pub fn set_scroll_from_pos_x_with_ratio(&self, local_x: f32, center_x_ratio: f32) {
unsafe { sys::igSetScrollFromPosX(local_x, center_x_ratio) };
}
/// Adjusts the vertical scroll position to make the given position visible
pub fn set_scroll_from_pos_y(&self, local_y: f32) {
unsafe { sys::igSetScrollFromPosY(local_y, 0.5) };