Continue new platform/glium implementations

- Assets, asset manager system
- Rendering system trait
- Kick off glium platform implementation
- And more
This commit is contained in:
reo 2025-08-07 17:56:35 +03:00 committed by Emre
parent f7d5c14caf
commit e817abf8ab
18 changed files with 2557 additions and 32 deletions

View file

@ -0,0 +1,35 @@
use std::collections::HashMap;
use raidillon_core::Scene;
use glium::Surface;
pub struct RenderingContext<'a, S: Surface> {
pub scene: &'a mut Scene,
pub target: &'a mut S,
}
/// The internal "rendering system" trait of raidillon_glium.
/// This is unrelated to the main System trait in raidillon_core.
pub trait RenderingSystem {
fn render<S: Surface>(ctx: &mut RenderingContext<S>);
}
type SystemID = String;
pub struct RenderingSystemManager<T: RenderingSystem> {
pub systems: HashMap<SystemID, Box<T>>,
}
impl<T: RenderingSystem> RenderingSystemManager<T> {
pub fn new() -> Self {
Self {
systems: HashMap::new(),
}
}
pub fn add_system(&mut self, id: SystemID, system: T) {
self.systems.insert(id, Box::new(system));
}
pub fn remove_system(&mut self, id: SystemID) {
self.systems.remove(&id);
}
}