Rename crate folders to remove raidillon prefix

This commit is contained in:
reo 2025-08-17 21:14:59 +03:00
parent 176ea52ab0
commit 3458662cfc
29 changed files with 31 additions and 28 deletions

37
core/src/system.rs Normal file
View file

@ -0,0 +1,37 @@
use crate::Scene;
use indexmap::IndexMap;
use winit::event::Event;
pub struct SystemContext<'a> {
// TODO: time delta etc.
pub scene: &'a mut Scene,
pub event: Option<Event<()>>,
}
pub trait System {
/// Initialize the system.
fn initialize(&mut self);
/// Spawn the first entities of the world.
fn load_world(&mut self, ctx: &mut SystemContext);
fn update(&mut self, ctx: &mut SystemContext);
}
pub type SystemID = String;
pub struct SystemManager {
pub systems: IndexMap<SystemID, Box<dyn System>>,
}
impl SystemManager {
pub fn new() -> Self {
let systems = IndexMap::default();
Self { systems }
}
pub fn add_system(&mut self, id: SystemID, system: Box<dyn System>) {
self.systems.insert(id, system);
}
pub fn remove_system(&mut self, id: SystemID) {
self.systems.shift_remove(&id);
}
}