Entity structure

This commit is contained in:
2025-11-26 10:57:21 +01:00
parent fde5f11568
commit df7c547ea4
3 changed files with 41 additions and 1 deletions
+12
View File
@@ -1,17 +1,29 @@
pub mod entity;
use std::collections::HashMap;
pub fn init() -> Engine {
Engine {
threads: HashMap::new(),
entities: Vec::new(),
}
}
pub struct Engine {
threads: HashMap<String, Box<dyn FnMut() + Send + Sync>>,
entities: Vec<entity::Entity>,
}
pub struct Renderer {}
impl Engine {
pub fn thread<F: FnMut() + Send + Sync + 'static>(&mut self, label: &str, f: F) {
self.threads.insert(label.to_string(), Box::new(f));
}
pub fn draw<F: FnMut(&mut Renderer) + 'static>(&self, mut f: F) -> entity::Entity {
let mut renderer = Renderer {};
(f)(&mut renderer);
entity::Entity(Vec::new())
}
}