diff options
author | 2020-01-11 00:44:56 +0100 | |
---|---|---|
committer | 2020-01-11 00:44:56 +0100 | |
commit | de71776e02495df5dc962fb8b8853f666ab8be4f (patch) | |
tree | 1f87cc68dc554783c6102f3587377f9956bcddba /winit/src/application.rs | |
parent | e879982cfdf0c6a1c6781a9bc46e0a77839de88f (diff) | |
parent | 84f1a936db93c16255a07f079c47e351635586f4 (diff) | |
download | iced-de71776e02495df5dc962fb8b8853f666ab8be4f.tar.gz iced-de71776e02495df5dc962fb8b8853f666ab8be4f.tar.bz2 iced-de71776e02495df5dc962fb8b8853f666ab8be4f.zip |
Merge branch 'master' into paint-example
Diffstat (limited to 'winit/src/application.rs')
-rw-r--r-- | winit/src/application.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index a8612b1a..8529c99c 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -1,9 +1,9 @@ use crate::{ - conversion, + container, conversion, input::{keyboard, mouse}, renderer::{Target, Windowed}, - subscription, Cache, Clipboard, Command, Container, Debug, Element, Event, - Length, MouseCursor, Settings, Subscription, UserInterface, + subscription, window, Cache, Clipboard, Command, Container, Debug, Element, + Event, Length, MouseCursor, Settings, Subscription, UserInterface, }; /// An interactive, native cross-platform application. @@ -18,7 +18,7 @@ pub trait Application: Sized { /// The renderer to use to draw the [`Application`]. /// /// [`Application`]: trait.Application.html - type Renderer: Windowed; + type Renderer: Windowed + container::Renderer; /// The type of __messages__ your [`Application`] will produce. /// @@ -81,8 +81,10 @@ pub trait Application: Sized { /// It should probably be that last thing you call in your `main` function. /// /// [`Application`]: trait.Application.html - fn run(settings: Settings) - where + fn run( + settings: Settings, + renderer_settings: <Self::Renderer as Windowed>::Settings, + ) where Self: 'static, { use winit::{ @@ -140,7 +142,7 @@ pub trait Application: Sized { let mut resized = false; let clipboard = Clipboard::new(&window); - let mut renderer = Self::Renderer::new(); + let mut renderer = Self::Renderer::new(renderer_settings); let mut target = { let (width, height) = to_physical(size, dpi); @@ -371,10 +373,13 @@ pub trait Application: Sized { *control_flow = ControlFlow::Exit; } WindowEvent::Resized(new_size) => { + events.push(Event::Window(window::Event::Resized { + width: new_size.width.round() as u32, + height: new_size.height.round() as u32, + })); + size = new_size; resized = true; - - log::debug!("Resized: {:?}", new_size); } _ => {} }, |