Refactor system registration to use TypeIds
This commit is contained in:
parent
0c0d5cdb2a
commit
75fd59a504
5 changed files with 68 additions and 73 deletions
|
|
@ -1,12 +1,10 @@
|
|||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use winit::event::Event;
|
||||
use raidillon_core::scene::{Scene, SceneManager};
|
||||
use crate::system::{SystemContext, SystemManager};
|
||||
use raidillon_assets::{ModelManager, ModelManagerRef};
|
||||
use raidillon_core::context::PlatformContext;
|
||||
use raidillon_core::DebugUIBuffer;
|
||||
use raidillon_core::engine::{EngineTrait};
|
||||
use raidillon_core::engine::EngineTrait;
|
||||
|
||||
pub struct Engine {
|
||||
pub scene_manager: SceneManager,
|
||||
|
|
@ -28,7 +26,7 @@ impl EngineTrait for Engine {
|
|||
/// Initialize systems, load the world.
|
||||
fn initialize(&mut self, platform_context: PlatformContext) {
|
||||
// Engine Loading Stage 1: initialize systems
|
||||
for (system_id, system) in self.system_manager.systems.iter_mut() {
|
||||
for system in self.system_manager.systems.values_mut() {
|
||||
system.initialize();
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +37,7 @@ impl EngineTrait for Engine {
|
|||
};
|
||||
|
||||
// Engine Loading Stage 2: load world
|
||||
for (system_id, system) in self.system_manager.systems.iter_mut() {
|
||||
for system in self.system_manager.systems.values_mut() {
|
||||
system.load_world(&mut ctx);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +51,7 @@ impl EngineTrait for Engine {
|
|||
debug_ui_buffer: self.debug_ui_buffer.clone(),
|
||||
};
|
||||
|
||||
for (system_id, system) in self.system_manager.systems.iter_mut() {
|
||||
for system in self.system_manager.systems.values_mut() {
|
||||
system.update(&mut ctx);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue