mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
wip: slowly putting it back together
This commit is contained in:
parent
7fbb40fad6
commit
461c60d6b3
18 changed files with 788 additions and 774 deletions
23
crates/tek_core/src/engine.rs
Normal file
23
crates/tek_core/src/engine.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use crate::*;
|
||||
|
||||
/// Entry point for main loop
|
||||
pub trait App<T: Engine> {
|
||||
fn run (self, context: T) -> Usually<T>;
|
||||
}
|
||||
|
||||
/// Platform backend.
|
||||
pub trait Engine {
|
||||
type Handled;
|
||||
type Rendered;
|
||||
fn setup (&mut self) -> Usually<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn teardown (&mut self) -> Usually<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn handle (&self, _: &mut impl Handle<Self, Self::Handled>)
|
||||
-> Usually<()> where Self: Sized;
|
||||
fn render (&mut self, _: &impl Render<Self, Self::Rendered>)
|
||||
-> Usually<()> where Self: Sized;
|
||||
fn exited (&self) -> bool;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue