No description
Find a file
Jonathan Johnson 13e0864bcd
Added ability for windows to call the main loop
When I ran the new Kludgine on my mac last night, I was surprised to
discover it didn't work. It turns out create_surface needs to be called
on the main thread on Metal.

This commit adds a way to provide a callback that can be remotely called
through the EventLoopProxy. This allows Kludgine to send a
CreateSurfaceRequest to the main event loop and receive a wgpu::Surface
back.
2023-07-04 07:42:33 -07:00
src Added ability for windows to call the main loop 2023-07-04 07:42:33 -07:00
.gitignore Initial commit. 2023-06-27 09:21:38 -07:00
Cargo.toml Initial commit. 2023-06-27 09:21:38 -07:00
README.md Initial commit. 2023-06-27 09:21:38 -07:00

appit

An opinionated wrapper for winit that provides a trait-based approach to implementing multi-window applications.

This crate's main type is WindowBehavior, a trait that provides functions for nearly every winit::event::WindowEvent. This allows you to implement exactly which events you wish to respond to, and ignore the rest without a large match statement.

This crate also keeps track of the redraw state of the window, and allows scheduling redraws in the future.

use appit::WindowBehavior;

struct MyWindow;

impl WindowBehavior for MyWindow {
    type Context = ();

    fn initialize(_window: &mut appit::RunningWindow, _context: Self::Context) -> Self {
        Self
    }

    fn redraw(&mut self, window: &mut appit::RunningWindow) {
        println!("Should redraw");
    }
}

fn main() {
    MyWindow::run()
}

Why not use this crate?

  • Very new, largely untested.
  • Not all platforms support threads, and a single-window, single-thread code path is not supported yet.