Updated versions and fixed build errors. See comments.

- This commit fixes the regular build and the glium example. The WGPU
  example needs an updated imgui-wgpu to point to the new imgui-sys
  version for things to work.
- The im_str and ImString usage deprecations are not fixed yet.
- There is no version bump for cimplot yet.
This commit is contained in:
4bb4 2021-09-19 10:34:09 +02:00
parent 07403f5802
commit 6bb1809690
10 changed files with 274 additions and 301 deletions

View file

@ -12,7 +12,7 @@ readme = "README.md"
[dependencies] [dependencies]
implot-sys = { version = "0.6.0", path = "implot-sys" } implot-sys = { version = "0.6.0", path = "implot-sys" }
imgui = { version = "=0.7.0" } imgui = { version = "=0.8.0" }
bitflags = "1.0" bitflags = "1.0"
parking_lot = "0.11" parking_lot = "0.11"
rustversion = "1.0.4" rustversion = "1.0.4"

View file

@ -8,4 +8,4 @@ edition = "2018"
[dependencies] [dependencies]
implot = { path = "../../" } implot = { path = "../../" }
imgui = "=0.7.0" imgui = "=0.8.0"

File diff suppressed because it is too large Load diff

View file

@ -11,12 +11,12 @@ publish = false
[dependencies] [dependencies]
clipboard = "0.5" clipboard = "0.5"
glium = { version = "0.29", default-features = true } glium = { version = "0.30", default-features = true }
image = "0.23" image = "0.23"
imgui-sys = "0.7.0" imgui-sys = "0.8.0"
imgui = "=0.7.0" imgui = "=0.8.0"
imgui-glium-renderer = "=0.7.0" imgui-glium-renderer = "=0.8.0"
imgui-winit-support = "=0.7.0" imgui-winit-support = "=0.8.0"
implot-sys = { path = "../../implot-sys" } implot-sys = { path = "../../implot-sys" }
implot = { path = "../../" } implot = { path = "../../" }

View file

@ -4,21 +4,19 @@
// //
// Not my code. Originally by Joonas Javanainen and the ImGUI-rs contributors // Not my code. Originally by Joonas Javanainen and the ImGUI-rs contributors
use clipboard::{ClipboardContext, ClipboardProvider}; use clipboard::{ClipboardContext, ClipboardProvider};
use imgui::{ClipboardBackend, ImStr, ImString}; use imgui::ClipboardBackend;
pub struct ClipboardSupport(ClipboardContext); pub struct ClipboardSupport(ClipboardContext);
pub fn init() -> Option<ClipboardSupport> { pub fn init() -> Option<ClipboardSupport> {
ClipboardContext::new() ClipboardContext::new().ok().map(ClipboardSupport)
.ok()
.map(ClipboardSupport)
} }
impl ClipboardBackend for ClipboardSupport { impl ClipboardBackend for ClipboardSupport {
fn get(&mut self) -> Option<ImString> { fn get(&mut self) -> Option<String> {
self.0.get_contents().ok().map(|text| text.into()) self.0.get_contents().ok().map(|text| text.into())
} }
fn set(&mut self, text: &ImStr) { fn set(&mut self, text: &str) {
let _ = self.0.set_contents(text.to_str().to_owned()); let _ = self.0.set_contents(text.to_owned());
} }
} }

View file

@ -41,7 +41,7 @@ pub fn init(title: &str) -> System {
imgui.set_ini_filename(None); imgui.set_ini_filename(None);
if let Some(backend) = clipboard::init() { if let Some(backend) = clipboard::init() {
imgui.set_clipboard_backend(Box::new(backend)); imgui.set_clipboard_backend(backend);
} else { } else {
eprintln!("Failed to initialize clipboard"); eprintln!("Failed to initialize clipboard");
} }
@ -50,7 +50,7 @@ pub fn init(title: &str) -> System {
{ {
let gl_window = display.gl_window(); let gl_window = display.gl_window();
let window = gl_window.window(); let window = gl_window.window();
platform.attach_window(imgui.io_mut(), &window, HiDpiMode::Rounded); platform.attach_window(imgui.io_mut(), window, HiDpiMode::Rounded);
} }
let hidpi_factor = platform.hidpi_factor(); let hidpi_factor = platform.hidpi_factor();
@ -97,7 +97,7 @@ impl System {
Event::MainEventsCleared => { Event::MainEventsCleared => {
let gl_window = display.gl_window(); let gl_window = display.gl_window();
platform platform
.prepare_frame(imgui.io_mut(), &gl_window.window()) .prepare_frame(imgui.io_mut(), gl_window.window())
.expect("Failed to prepare frame"); .expect("Failed to prepare frame");
gl_window.window().request_redraw(); gl_window.window().request_redraw();
} }

View file

@ -11,7 +11,7 @@ implot = { path = "../../" }
wgpu = "0.10" wgpu = "0.10"
winit = "0.24" # opening windows and handling input winit = "0.24" # opening windows and handling input
futures = "^0.3.5" # executing async functions using blocking executor futures = "^0.3.5" # executing async functions using blocking executor
imgui = "=0.7.0" imgui = "=0.8.0"
imgui-winit-support = "=0.7.0" # connection of input (keys) to imgui imgui-winit-support = "=0.8.0" # connection of input (keys) to imgui
imgui-wgpu = "=0.17.0" imgui-wgpu = "=0.17.0"
examples-shared = { path = "../examples-shared" } examples-shared = { path = "../examples-shared" }

View file

@ -6,4 +6,4 @@ edition = "2018"
[dependencies] [dependencies]
bindgen = "0.57" bindgen = "0.57"
imgui-sys = { version = "=0.7.0" } imgui-sys = { version = "=0.8.0" }

View file

@ -12,7 +12,7 @@ build = "build.rs"
links = "implot" links = "implot"
[dependencies] [dependencies]
imgui-sys = "=0.7.0" imgui-sys = "=0.8.0"
[build-dependencies] [build-dependencies]
cc = "1.0" cc = "1.0"

View file

@ -20,9 +20,8 @@ use implot_sys as sys;
// TODO(4bb4) facade-wrap these? // TODO(4bb4) facade-wrap these?
pub use self::{context::*, plot::*, plot_elements::*}; pub use self::{context::*, plot::*, plot_elements::*};
use imgui::im_str;
pub use sys::{ImPlotLimits, ImPlotPoint, ImPlotRange, ImVec2, ImVec4};
use std::os::raw::c_char; use std::os::raw::c_char;
pub use sys::{ImPlotLimits, ImPlotPoint, ImPlotRange, ImVec2, ImVec4};
mod context; mod context;
mod plot; mod plot;
@ -576,7 +575,7 @@ pub fn is_plot_y_axis_hovered(y_axis_choice: Option<YAxisChoice>) -> bool {
/// Returns true if the given item in the legend of the current plot is hovered. /// Returns true if the given item in the legend of the current plot is hovered.
pub fn is_legend_entry_hovered(legend_entry: &str) -> bool { pub fn is_legend_entry_hovered(legend_entry: &str) -> bool {
unsafe { sys::ImPlot_IsLegendEntryHovered(im_str!("{}", legend_entry).as_ptr() as *const c_char) } unsafe { sys::ImPlot_IsLegendEntryHovered(legend_entry.as_ptr() as *const c_char) }
} }
// --- Demo window ------------------------------------------------------------------------------- // --- Demo window -------------------------------------------------------------------------------