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

File diff suppressed because it is too large Load diff

View file

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

View file

@ -4,21 +4,19 @@
//
// Not my code. Originally by Joonas Javanainen and the ImGUI-rs contributors
use clipboard::{ClipboardContext, ClipboardProvider};
use imgui::{ClipboardBackend, ImStr, ImString};
use imgui::ClipboardBackend;
pub struct ClipboardSupport(ClipboardContext);
pub fn init() -> Option<ClipboardSupport> {
ClipboardContext::new()
.ok()
.map(ClipboardSupport)
ClipboardContext::new().ok().map(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())
}
fn set(&mut self, text: &ImStr) {
let _ = self.0.set_contents(text.to_str().to_owned());
fn set(&mut self, text: &str) {
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);
if let Some(backend) = clipboard::init() {
imgui.set_clipboard_backend(Box::new(backend));
imgui.set_clipboard_backend(backend);
} else {
eprintln!("Failed to initialize clipboard");
}
@ -50,7 +50,7 @@ pub fn init(title: &str) -> System {
{
let gl_window = display.gl_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();
@ -97,7 +97,7 @@ impl System {
Event::MainEventsCleared => {
let gl_window = display.gl_window();
platform
.prepare_frame(imgui.io_mut(), &gl_window.window())
.prepare_frame(imgui.io_mut(), gl_window.window())
.expect("Failed to prepare frame");
gl_window.window().request_redraw();
}