[−][src]Struct thyme::WinitIo
A Thyme Input/Output adapter for winit
.
This adapter handles events from winit
and sends them to the Thyme Context
.
WindowEvents should be passed to this handler, assuming Context.wants_mouse
returns true for the given frame.
Example
fn main_loop(event_loop: winit::EventLoop<()>, thyme: thyme::Context) { event_loop.run(move |event, _, control_flow| match event { Event::MainEventsCleared => { // Renderer specific code here let mut ui = context.create_frame(); // create UI here // draw the frame and finish up rendering here } Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *control_flow = ControlFlow::Exit, event => { io.handle_event(&mut context, &event); } }) }
Implementations
impl WinitIo
[src]
pub fn new<T>(event_loop: &EventLoop<T>, logical_display_size: Point) -> WinitIo
[src]
Creates a new adapter from the given EventLoop
, with the specified initial display size,
in logical pixels. This may change over time.
pub fn handle_event<T>(&mut self, context: &mut Context, event: &Event<'_, T>)
[src]
Handles a winit Event
and passes it to the Thyme Context
.
Trait Implementations
impl IO for WinitIo
[src]
fn scale_factor(&self) -> f32
[src]
fn display_size(&self) -> Point
[src]
Auto Trait Implementations
impl RefUnwindSafe for WinitIo
impl Send for WinitIo
impl Sync for WinitIo
impl Unpin for WinitIo
impl UnwindSafe for WinitIo
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> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[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>,