Push break job work [not work]
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 7m55s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 7m55s
This commit is contained in:
parent
e58c22b531
commit
5b74eef561
13 changed files with 118 additions and 18 deletions
29
src/core/scene.rs
Normal file
29
src/core/scene.rs
Normal file
|
@ -0,0 +1,29 @@
|
|||
use vulkano_util::renderer::VulkanoWindowRenderer;
|
||||
|
||||
use super::{input::InputState, render::vulkan_context::VulkanContext, timer::Timer};
|
||||
|
||||
pub trait Scene {
|
||||
fn load(&mut self, app: &mut App);
|
||||
fn update(&mut self, app: &mut App);
|
||||
fn render(&self);
|
||||
fn unload(&mut self);
|
||||
}
|
||||
|
||||
pub struct SceneManager {
|
||||
current_scene: Option<Box<dyn Scene>>,
|
||||
}
|
||||
|
||||
impl SceneManager {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
current_scene: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_scene(&mut self, scene: Box<dyn Scene>) {
|
||||
if let Some(current_scene) = self.current_scene.as_mut() {
|
||||
current_scene.unload();
|
||||
}
|
||||
self.current_scene = Some(scene);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue