From 0440752e0bc0e35ef850e715d211d5f45fab5441 Mon Sep 17 00:00:00 2001 From: Joonas Javanainen Date: Thu, 29 Nov 2018 22:10:49 +0200 Subject: [PATCH] Upgrade to cimgui 1.66.2 / imgui 1.66 --- CHANGELOG.markdown | 2 +- README.markdown | 2 +- imgui-sys/src/flags.rs | 10 ++++++++-- imgui-sys/src/lib.rs | 13 ++++++++++++- imgui-sys/src/structs.rs | 9 ++------- imgui-sys/third-party/cimgui | 2 +- src/fonts.rs | 8 +++++--- 7 files changed, 30 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 444ffec..f0acb3b 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -8,7 +8,7 @@ ### Changed -- Upgrade to cimgui 1.65.2 / imgui 1.65. **This is a very big update, so there +- Upgrade to cimgui 1.66.2 / imgui 1.66. **This is a very big update, so there are a lot of breaking changes** ## [0.0.21] - 2018-10-11 diff --git a/README.markdown b/README.markdown index 4879639..085753d 100644 --- a/README.markdown +++ b/README.markdown @@ -4,7 +4,7 @@ Minimum Rust version: 1.26 -Wrapped Dear ImGui version: 1.65 +Wrapped Dear ImGui version: 1.66 [![Build Status](https://travis-ci.org/Gekkio/imgui-rs.svg?branch=master)](https://travis-ci.org/Gekkio/imgui-rs) [![Latest release on crates.io](https://meritbadge.herokuapp.com/imgui)](https://crates.io/crates/imgui) diff --git a/imgui-sys/src/flags.rs b/imgui-sys/src/flags.rs index fb21235..bf6e0b6 100644 --- a/imgui-sys/src/flags.rs +++ b/imgui-sys/src/flags.rs @@ -378,10 +378,12 @@ bitflags!( const NoCollapse = 1 << 5; /// Resize every window to its content every frame. const AlwaysAutoResize = 1 << 6; + /// Disable drawing background color (WindowBg, etc.) and outside border + const NoBackground = 1 << 7; /// Never load/save settings in .ini file. const NoSavedSettings = 1 << 8; - /// Disable catching mouse or keyboard inputs;hovering test with pass through. - const NoInputs = 1 << 9; + /// Disable catching mouse, hovering test with pass through. + const NoMouseInputs = 1 << 9; /// Has a menu-bar. const MenuBar = 1 << 10; /// Allow horizontal scrollbar to appear (off by default). @@ -405,5 +407,9 @@ bitflags!( const NoNavFocus = 1 << 19; const NoNav = ImGuiWindowFlags::NoNavInputs.bits | ImGuiWindowFlags::NoNavFocus.bits; + const NoDecoration = ImGuiWindowFlags::NoTitleBar.bits | ImGuiWindowFlags::NoResize.bits + | ImGuiWindowFlags::NoScrollbar.bits | ImGuiWindowFlags::NoCollapse.bits; + const NoInputs = ImGuiWindowFlags::NoMouseInputs.bits | ImGuiWindowFlags::NoNavInputs.bits + | ImGuiWindowFlags::NoNavFocus.bits; } ); diff --git a/imgui-sys/src/lib.rs b/imgui-sys/src/lib.rs index 8850d28..ac5c397 100644 --- a/imgui-sys/src/lib.rs +++ b/imgui-sys/src/lib.rs @@ -316,10 +316,19 @@ extern "C" { pub fn igGetScrollMaxY() -> c_float; pub fn igSetScrollX(scroll_x: c_float); pub fn igSetScrollY(scroll_y: c_float); - pub fn igSetScrollHere(center_y_ratio: c_float); + pub fn igSetScrollHereY(center_y_ratio: c_float); pub fn igSetScrollFromPosY(pos_y: c_float, center_y_ratio: c_float); } +#[deprecated( + since = "0.0.22", + note = "please use igSetScrollHereY instead" +)] +#[allow(non_snake_case)] +pub unsafe fn igSetScrollHere(center_y_ratio: c_float) { + igSetScrollHereY(center_y_ratio) +} + // Parameter stacks (shared) extern "C" { pub fn igPushFont(font: *mut ImFont); @@ -652,6 +661,7 @@ extern "C" { v_rad: *mut c_float, v_degrees_min: c_float, v_degrees_max: c_float, + format: *const c_char, ) -> bool; pub fn igSliderInt( label: *const c_char, @@ -1082,6 +1092,7 @@ extern "C" { flags: ImGuiDragDropFlags, ) -> *const ImGuiPayload; pub fn igEndDragDropTarget(); + pub fn igGetDragDropPayload() -> *const ImGuiPayload; } // Clipping diff --git a/imgui-sys/src/structs.rs b/imgui-sys/src/structs.rs index 6469571..fb299f5 100644 --- a/imgui-sys/src/structs.rs +++ b/imgui-sys/src/structs.rs @@ -116,7 +116,7 @@ pub struct ImFont { pub display_offset: ImVec2, pub glyphs: ImVector, pub index_advance_x: ImVector, - pub index_lookup: ImVector, + pub index_lookup: ImVector, pub fallback_glyph: *const ImFontGlyph, pub fallback_advance_x: c_float, pub fallback_char: ImWchar, @@ -875,11 +875,6 @@ extern "C" { pub fn ImDrawData_ScaleClipRects(this: *mut ImDrawData, sc: ImVec2); } -// ImFontConfig -extern "C" { - pub fn ImFontConfig_DefaultConstructor(config: *mut ImFontConfig); -} - // ImFontAtlas extern "C" { pub fn ImFontAtlas_AddFont( @@ -1039,7 +1034,7 @@ extern "C" { size: c_float, pos: ImVec2, col: ImU32, - c: c_ushort, + c: ImWchar, ); pub fn ImFont_RenderText( this: *mut ImFont, diff --git a/imgui-sys/third-party/cimgui b/imgui-sys/third-party/cimgui index 3efb100..204f282 160000 --- a/imgui-sys/third-party/cimgui +++ b/imgui-sys/third-party/cimgui @@ -1 +1 @@ -Subproject commit 3efb1001aa4639676b5626eaaf2c58e1370be3b2 +Subproject commit 204f2828bb81857ffa4b9e2dbc360eabbb7cbd25 diff --git a/src/fonts.rs b/src/fonts.rs index 1e5e6bf..d9c0c4e 100644 --- a/src/fonts.rs +++ b/src/fonts.rs @@ -1,6 +1,7 @@ +use std::f32; use std::marker::PhantomData; use std::mem; -use std::os::raw::{c_int, c_void}; +use std::os::raw::{c_float, c_int, c_void}; use std::ptr; use sys; @@ -203,8 +204,9 @@ impl ImFontConfig { fn make_config(self) -> sys::ImFontConfig { let mut config = unsafe { - let mut config = mem::uninitialized(); - sys::ImFontConfig_DefaultConstructor(&mut config); + let mut config = mem::zeroed::(); + config.font_data_owned_by_atlas = true; + config.glyph_max_advance_x = f32::MAX as c_float; config }; config.size_pixels = self.size_pixels;