mirror of
https://github.com/danbulant/appit
synced 2026-06-14 20:01:08 +00:00
No description
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. |
||
|---|---|---|
| src | ||
| .gitignore | ||
| Cargo.toml | ||
| README.md | ||
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.