mirror of
https://github.com/danbulant/appit
synced 2026-06-14 20:01:08 +00:00
No description
Prior to this commit, if a window panic happened, the window would be left on the screen frozen. Now, the panic is caught and the window is closed before resuming the panic. The app event loop has a separate message it receives when a window panics, and if it's the last window, the process exits with a non-zero exit code. This places the burden of handling a panicking window into the developer's hands: ultimately if the window has a way to communicate with it, the behavior is being dropped as part of the panic handling, which ensures any channels the window had will be dropped too. |
||
|---|---|---|
| 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.