mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-13 06:28:36 +00:00
examples: Fix winit deprecation warnings
Since the following pull request https://github.com/tomaka/winit/pull/319, `winit` has deprecated `get_inner_size_points()` and `get_inner_size_pixels()`. We replace the deprecated API by `get_inner_size()` and `hidpi_factor()`. The size in points in computed from the returned hidpi_factor.
This commit is contained in:
parent
bafe886ebb
commit
e86cd8838d
@ -105,8 +105,12 @@ pub fn run<F: FnMut(&Ui) -> bool>(title: String, clear_color: [f32; 4], mut run_
|
||||
update_mouse(&mut imgui, &mut mouse_state);
|
||||
|
||||
let gl_window = display.gl_window();
|
||||
let size_points = gl_window.get_inner_size_points().unwrap();
|
||||
let size_pixels = gl_window.get_inner_size_pixels().unwrap();
|
||||
let size_pixels = gl_window.get_inner_size().unwrap();
|
||||
let hdipi = gl_window.hidpi_factor();
|
||||
let size_points = (
|
||||
(size_pixels.0 as f32 / hdipi) as u32,
|
||||
(size_pixels.1 as f32 / hdipi) as u32,
|
||||
);
|
||||
|
||||
let ui = imgui.frame(size_points, size_pixels, delta_s);
|
||||
if !run_ui(&ui) {
|
||||
|
||||
@ -131,8 +131,12 @@ pub fn run<F: FnMut(&Ui) -> bool>(title: String, clear_color: [f32; 4], mut run_
|
||||
|
||||
update_mouse(&mut imgui, &mut mouse_state);
|
||||
|
||||
let size_points = window.get_inner_size_points().unwrap();
|
||||
let size_pixels = window.get_inner_size_pixels().unwrap();
|
||||
let size_pixels = window.get_inner_size().unwrap();
|
||||
let hdipi = window.hidpi_factor();
|
||||
let size_points = (
|
||||
(size_pixels.0 as f32 / hdipi) as u32,
|
||||
(size_pixels.1 as f32 / hdipi) as u32,
|
||||
);
|
||||
|
||||
let ui = imgui.frame(size_points, size_pixels, delta_s);
|
||||
if !run_ui(&ui) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user