diff options
author | 2023-03-05 06:35:20 +0100 | |
---|---|---|
committer | 2023-03-05 06:35:20 +0100 | |
commit | 99e0a71504456976ba88040f5d1d3bbc347694ea (patch) | |
tree | a228c064fd3847831ff8072aa9375dc59db47f47 /winit/src/window.rs | |
parent | 8af69be47e88896b3c5f70174db609eee0c67971 (diff) | |
download | iced-99e0a71504456976ba88040f5d1d3bbc347694ea.tar.gz iced-99e0a71504456976ba88040f5d1d3bbc347694ea.tar.bz2 iced-99e0a71504456976ba88040f5d1d3bbc347694ea.zip |
Rename `iced_native` to `iced_runtime`
Diffstat (limited to '')
-rw-r--r-- | runtime/src/window.rs (renamed from winit/src/window.rs) | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/winit/src/window.rs b/runtime/src/window.rs index 6ac58e20..236064f7 100644 --- a/winit/src/window.rs +++ b/runtime/src/window.rs @@ -1,7 +1,27 @@ -//! Interact with the window of your application. -use crate::core::window::{Mode, UserAttention}; -use crate::native::command::{self, Command}; -use crate::native::window::Action; +//! Build window-based GUI applications. +mod action; + +pub use action::Action; + +use crate::command::{self, Command}; +use crate::core::time::Instant; +use crate::core::window::{Event, Mode, UserAttention}; +use crate::futures::subscription::{self, Subscription}; + +/// Subscribes to the frames of the window of the running application. +/// +/// The resulting [`Subscription`] will produce items at a rate equal to the +/// refresh rate of the window. Note that this rate may be variable, as it is +/// normally managed by the graphics driver and/or the OS. +/// +/// In any case, this [`Subscription`] is useful to smoothly draw application-driven +/// animations without missing any frames. +pub fn frames() -> Subscription<Instant> { + subscription::raw_events(|event, _status| match event { + iced_core::Event::Window(Event::RedrawRequested(at)) => Some(at), + _ => None, + }) +} /// Closes the current window and exits the application. pub fn close<Message>() -> Command<Message> { |