From ebc81d27672911a1fa2b60f003d7e1df45441a57 Mon Sep 17 00:00:00 2001 From: shockham Date: Mon, 30 Jul 2018 17:01:02 +0100 Subject: [PATCH 1/3] Update glium to 0.22 --- imgui-glium-renderer/Cargo.toml | 2 +- imgui-sys/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui-glium-renderer/Cargo.toml b/imgui-glium-renderer/Cargo.toml index 5862c13..269b018 100644 --- a/imgui-glium-renderer/Cargo.toml +++ b/imgui-glium-renderer/Cargo.toml @@ -12,6 +12,6 @@ categories = ["gui", "rendering"] travis-ci = { repository = "Gekkio/imgui-rs" } [dependencies] -glium = { version = "0.21", default-features = false } +glium = { version = "0.22", default-features = false } imgui = { version = "0.0.19-pre", path = "../" } imgui-sys = { version = "0.0.19-pre", path = "../imgui-sys", features = ["glium"] } diff --git a/imgui-sys/Cargo.toml b/imgui-sys/Cargo.toml index 40488d7..4279a2c 100644 --- a/imgui-sys/Cargo.toml +++ b/imgui-sys/Cargo.toml @@ -15,7 +15,7 @@ travis-ci = { repository = "Gekkio/imgui-rs" } [dependencies] libc = "0.2" bitflags = "1.0" -glium = { version = "0.21", default-features = false, optional = true } +glium = { version = "0.22", default-features = false, optional = true } gfx = { version = "0.17", optional = true } [build-dependencies] From b1ebd720e71da8498d74b35ea0f5bf5f2c2f958a Mon Sep 17 00:00:00 2001 From: shockham Date: Mon, 30 Jul 2018 17:44:28 +0100 Subject: [PATCH 2/3] Update gfx_window_glutin to 0.25, glium to 0.22 and glutin to 0.17 in imgui-examples and fix errors --- imgui-examples/Cargo.toml | 6 ++--- imgui-examples/examples/support/mod.rs | 24 ++++++++++---------- imgui-examples/examples/support_gfx/mod.rs | 26 +++++++++++----------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/imgui-examples/Cargo.toml b/imgui-examples/Cargo.toml index 01e0e6a..6681172 100644 --- a/imgui-examples/Cargo.toml +++ b/imgui-examples/Cargo.toml @@ -10,9 +10,9 @@ publish = false [dev-dependencies] gfx = "0.17" -gfx_window_glutin = "0.22" -glium = { version = "0.21", default-features = true } -glutin = "0.14" +gfx_window_glutin = "0.25" +glium = { version = "0.22", default-features = true } +glutin = "0.17" imgui = { version = "0.0.19-pre", path = "../" } imgui-gfx-renderer = { version = "0.0.19-pre", path = "../imgui-gfx-renderer" } imgui-glium-renderer = { version = "0.0.19-pre", path = "../imgui-glium-renderer" } diff --git a/imgui-examples/examples/support/mod.rs b/imgui-examples/examples/support/mod.rs index 7e59b1a..6ee1986 100644 --- a/imgui-examples/examples/support/mod.rs +++ b/imgui-examples/examples/support/mod.rs @@ -17,7 +17,7 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ let context = glutin::ContextBuilder::new().with_vsync(true); let window = glutin::WindowBuilder::new() .with_title(title) - .with_dimensions(1024, 768); + .with_dimensions(glutin::dpi::LogicalSize::new(1024f64, 768f64)); let display = Display::new(window, context, &events_loop).unwrap(); let mut imgui = ImGui::init(); @@ -42,7 +42,7 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ if let Event::WindowEvent { event, .. } = event { match event { - Closed => quit = true, + CloseRequested => quit = true, KeyboardInput { input, .. } => { use glium::glutin::VirtualKeyCode as Key; @@ -76,7 +76,7 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ _ => {} } } - CursorMoved { position: (x, y), .. } => mouse_state.pos = (x as i32, y as i32), + CursorMoved { position: pos, .. } => mouse_state.pos = pos.into(), MouseInput { state, button, .. } => { match button { MouseButton::Left => mouse_state.pressed.0 = state == Pressed, @@ -89,12 +89,12 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ delta: MouseScrollDelta::LineDelta(_, y), phase: TouchPhase::Moved, .. - } | + } => mouse_state.wheel = y, MouseWheel { - delta: MouseScrollDelta::PixelDelta(_, y), + delta: MouseScrollDelta::PixelDelta(pos), phase: TouchPhase::Moved, .. - } => mouse_state.wheel = y, + } => mouse_state.wheel = pos.y as f32, ReceivedCharacter(c) => imgui.add_input_character(c), _ => (), } @@ -113,10 +113,10 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ let mouse_cursor = imgui.mouse_cursor(); if imgui.mouse_draw_cursor() || mouse_cursor == ImGuiMouseCursor::None { // Hide OS cursor - gl_window.set_cursor_state(glutin::CursorState::Hide).unwrap(); + gl_window.hide_cursor(true); } else { // Set OS cursor - gl_window.set_cursor_state(glutin::CursorState::Normal).unwrap(); + gl_window.hide_cursor(false); gl_window.set_cursor(match mouse_cursor { ImGuiMouseCursor::None => unreachable!("mouse_cursor was None!"), ImGuiMouseCursor::Arrow => glutin::MouseCursor::Arrow, @@ -130,13 +130,13 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ } let size_pixels = gl_window.get_inner_size().unwrap(); - let hdipi = gl_window.hidpi_factor(); + let hdipi = gl_window.get_hidpi_factor(); let size_points = ( - (size_pixels.0 as f32 / hdipi) as u32, - (size_pixels.1 as f32 / hdipi) as u32, + (size_pixels.width as f64 / hdipi) as u32, + (size_pixels.height as f64 / hdipi) as u32, ); - let ui = imgui.frame(size_points, size_pixels, delta_s); + let ui = imgui.frame(size_points, size_pixels.into(), delta_s); if !run_ui(&ui) { break; } diff --git a/imgui-examples/examples/support_gfx/mod.rs b/imgui-examples/examples/support_gfx/mod.rs index 474e6e1..30e5060 100644 --- a/imgui-examples/examples/support_gfx/mod.rs +++ b/imgui-examples/examples/support_gfx/mod.rs @@ -21,7 +21,7 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ let context = glutin::ContextBuilder::new().with_vsync(true); let window = glutin::WindowBuilder::new() .with_title(title) - .with_dimensions(1024, 768); + .with_dimensions(glutin::dpi::LogicalSize::new(1024f64, 768f64)); let (window, mut device, mut factory, mut main_color, mut main_depth) = gfx_window_glutin::init::(window, context, &events_loop); let mut encoder: gfx::Encoder<_, _> = factory.create_command_buffer().into(); @@ -82,11 +82,11 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ if let Event::WindowEvent { event, .. } = event { match event { - Resized(_, _) => { + Resized(_) => { gfx_window_glutin::update_views(&window, &mut main_color, &mut main_depth); renderer.update_render_target(main_color.clone()); } - Closed => quit = true, + CloseRequested => quit = true, KeyboardInput { input, .. } => { use glutin::VirtualKeyCode as Key; @@ -120,7 +120,7 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ _ => {} } } - CursorMoved { position: (x, y), .. } => mouse_state.pos = (x as i32, y as i32), + CursorMoved { position: pos, .. } => mouse_state.pos = pos.into(), MouseInput { state, button, .. } => { match button { MouseButton::Left => mouse_state.pressed.0 = state == Pressed, @@ -133,12 +133,12 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ delta: MouseScrollDelta::LineDelta(_, y), phase: TouchPhase::Moved, .. - } | + } => mouse_state.wheel = y, MouseWheel { - delta: MouseScrollDelta::PixelDelta(_, y), + delta: MouseScrollDelta::PixelDelta(pos), phase: TouchPhase::Moved, .. - } => mouse_state.wheel = y, + } => mouse_state.wheel = pos.y as f32, ReceivedCharacter(c) => imgui.add_input_character(c), _ => (), } @@ -158,10 +158,10 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ let mouse_cursor = imgui.mouse_cursor(); if imgui.mouse_draw_cursor() || mouse_cursor == ImGuiMouseCursor::None { // Hide OS cursor - window.set_cursor_state(glutin::CursorState::Hide).unwrap(); + window.hide_cursor(true); } else { // Set OS cursor - window.set_cursor_state(glutin::CursorState::Normal).unwrap(); + window.hide_cursor(false); window.set_cursor(match mouse_cursor { ImGuiMouseCursor::None => unreachable!("mouse_cursor was None!"), ImGuiMouseCursor::Arrow => glutin::MouseCursor::Arrow, @@ -175,13 +175,13 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ } let size_pixels = window.get_inner_size().unwrap(); - let hdipi = window.hidpi_factor(); + let hdipi = window.get_hidpi_factor(); let size_points = ( - (size_pixels.0 as f32 / hdipi) as u32, - (size_pixels.1 as f32 / hdipi) as u32, + (size_pixels.width as f64 / hdipi) as u32, + (size_pixels.height as f64 / hdipi) as u32, ); - let ui = imgui.frame(size_points, size_pixels, delta_s); + let ui = imgui.frame(size_points, size_pixels.into(), delta_s); if !run_ui(&ui) { break; } From 7152cf5b6a03b5848b7a746f891cbe44b1f85800 Mon Sep 17 00:00:00 2001 From: shockham Date: Wed, 8 Aug 2018 09:20:44 +0100 Subject: [PATCH 3/3] Bump minimum rust version to 1.24 --- .travis.yml | 2 +- README.markdown | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 929230d..75988e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ rust: - stable - beta - nightly - - 1.20.0 + - 1.24.0 os: - linux - osx diff --git a/README.markdown b/README.markdown index 5f413b9..fd87a88 100644 --- a/README.markdown +++ b/README.markdown @@ -2,7 +2,7 @@ **Still fairly experimental!** -Minimum Rust version: 1.20 +Minimum Rust version: 1.24 [![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)