Split engine object

This commit is contained in:
hodasemi 2024-08-24 19:50:41 +02:00
parent 2c00285217
commit 1517aa11d0

View file

@ -29,14 +29,9 @@ pub enum EngineEvent {
FileDrop(String), FileDrop(String),
} }
pub trait EngineObject: Any { pub trait EngineObjectHelper: Any {
type Payload: Send + Sync; type Payload: Send + Sync;
fn name(&self) -> &str;
fn update(&mut self) -> Result<()>;
fn event(&mut self, event: EngineEvent) -> Result<()>;
fn access(&self) -> EngineObjectAccess<'_, Self::Payload>; fn access(&self) -> EngineObjectAccess<'_, Self::Payload>;
fn payload(&self) -> EngineObjectDataHandle<Self::Payload>; fn payload(&self) -> EngineObjectDataHandle<Self::Payload>;
fn ui(&self) -> &States; fn ui(&self) -> &States;
@ -97,6 +92,13 @@ pub trait EngineObject: Any {
} }
} }
pub trait EngineObject: Any {
fn name(&self) -> &str;
fn update(&mut self) -> Result<()>;
fn event(&mut self, event: EngineEvent) -> Result<()>;
}
pub struct Input { pub struct Input {
pub direction_mapping: HashMap<Keycode, GuiDirection>, pub direction_mapping: HashMap<Keycode, GuiDirection>,
} }