This commit is contained in:
Chance 2025-02-04 05:10:53 -05:00 committed by BitSyndicate
parent 9f27076f07
commit 78e9d31358
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 443E4198D6BBA6DE
7 changed files with 430 additions and 16 deletions

View file

@ -1,3 +1,15 @@
// struct ComponentRegistry {
// components
// }
pub trait Component: Sized + 'static {
fn update(&mut self, delta_time: f32);
fn serialize(&self) -> Vec<u8>;
fn deserialize(data: &[u8;6]) -> Self;
}
pub trait Entity: Sized {
fn add_component<C: Component>(&mut self, component: C);
fn remove_component<C: Component>(&mut self);
fn get_component<C: Component>(&self) -> Option<&C>;
fn serialize(&self) -> Vec<u8>;
fn deserialize(data: &[u8;6]) -> Self;
}