Skip to main content

ursus_core/app/
traits.rs

1use crate::app::context::EngineContext;
2use crate::app::window_config::WindowConfig;
3use crate::assets::loader_registry::LoaderRegistry;
4use crate::render::thread::command::PipelineFactory;
5
6pub trait App {
7    fn initial_pipeline() -> PipelineFactory
8    where
9        Self: Sized,
10    {
11        PipelineFactory::empty()
12    }
13
14    fn register_loaders(_registry: &mut LoaderRegistry)
15    where
16        Self: Sized,
17    {
18    }
19
20    fn window_config() -> WindowConfig
21    where
22        Self: Sized,
23    {
24        WindowConfig::default()
25    }
26
27    fn tick_rate(&self) -> f32 {
28        60.0
29    }
30
31    fn on_start(&mut self, ctx: &mut EngineContext);
32    fn on_update(&mut self, ctx: &mut EngineContext, dt: f32);
33    fn on_render(&mut self, ctx: &mut EngineContext);
34    fn on_stop(&mut self, ctx: &mut EngineContext);
35}