use megafb::{ winit::{ dpi::LogicalSize, event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, window::WindowBuilder, }, FramebufferWindow, }; fn main() { let event_loop = EventLoop::new(); let builder = WindowBuilder::new() .with_title("Hello") .with_visible(true) .with_inner_size(LogicalSize { width: 800.0, height: 600.0, }); let window = builder.build(&event_loop).unwrap(); let fb_window = FramebufferWindow::try_new(window).unwrap(); event_loop.run(move |event, _, control_flow| match event { Event::EventsCleared => { // Normally you'll want to poll for events until the loop is clear, run // the game simulation, and then request a redraw. fb_window.request_redraw() } Event::WindowEvent { event: WindowEvent::RedrawRequested, .. } => { // This can happen because the program requested a redraw or because the // OS requested a redraw, so you shouldn't simulate anything here, only do // the draw. fb_window.draw().unwrap() } Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => *control_flow = ControlFlow::Exit, _ => *control_flow = ControlFlow::Poll, }); }