[][src]Struct thyme::WinitIo

pub struct WinitIo { /* fields omitted */ }

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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.