pub fn init(
event_loop: &ActiveEventLoop,
properties: &WindowProperties,
) -> (RawWindow, RawSurface)
Expand description
Initialises and returns a new RawWindow and RawSurface given an ActiveEventLoop
and WindowProperties
.
For instance, implementation within ApplicationHandler::resumed
may look like:
use winit::application::ApplicationHandler;
use winit::event::WindowEvent;
use winit::event_loop::ActiveEventLoop;
use winit::window::WindowId;
use softbuffer_quickstart::{init, RawSurface, RawWindow, WindowProperties};
struct MyWindow {
window: RawWindow,
surface: RawSurface
}
impl ApplicationHandler for MyWindow {
/// `ApplicationHandler::resumed()` implementation here
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
(self.window, self.surface) = init(event_loop, &WindowProperties::default());
}
fn window_event(&mut self, event_loop: &ActiveEventLoop, window_id: WindowId, event: WindowEvent) {
todo!()
}
}