[−][src]Struct riddle_platform_winit::PlatformSystem
The winit platform system core state, along with PlatformMainThreadState
.
Mostly used to lookup Window
by WindowId
, and subscribe to PlatformEvent
s.
Implementations
impl PlatformSystem
[src]
pub fn new() -> (PlatformSystemHandle, PlatformMainThreadState)
[src]
Create a new platform system and its main thread state pair.
Do not call if using the riddle
crate as recommended, as RiddleLib
manages
the creation and platform lifetime automatically.
Example
This example is only relevant if you're not using riddle
let (platform_system, main_thread_state) = PlatformSystem::new(); let window = WindowBuilder::new().build(main_thread_state.borrow_context())?; main_thread_state.run::<PlatformError, _>(move |ctx| { match ctx.event() { PlatformEvent::WindowClose(_) => { ctx.quit(); } _ => () }; Ok(()) })
pub fn event_pub(&self) -> &EventPub<PlatformEvent>
[src]
Get the PlatformEvent
publisher, so that other systems can consume events.
Example
let rdl = RiddleLib::new()?; let subscriber: EventSub<PlatformEvent> = EventSub::new(); // Attach subscriber to the platform event stream rdl.state().platform().event_pub().attach(&subscriber);
pub fn lookup_window(&self, window_id: WindowId) -> Option<WindowHandle>
[src]
Get a WindowHandle
associated with a WindowId
, if one exists.
Example
let rdl = RiddleLib::new()?; let window = WindowBuilder::new().build(rdl.context())?; let window_id = window.id(); assert!(WindowHandle::eq(&window, &rdl.state().platform().lookup_window(window_id).unwrap()));
Trait Implementations
impl CloneHandle for PlatformSystem
[src]
type Handle = PlatformSystemHandle
The type which represents a strong reference, and which may be dereferenced as Self. Read more
type WeakHandle = PlatformSystemWeak
The type which represents a weak reference.
fn clone_handle(&self) -> PlatformSystemHandle
[src]
fn clone_weak_handle(&self) -> PlatformSystemWeak
[src]
Auto Trait Implementations
impl RefUnwindSafe for PlatformSystem
impl Send for PlatformSystem
impl Sync for PlatformSystem
impl Unpin for PlatformSystem
impl UnwindSafe for PlatformSystem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,