-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
107 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use stecs::prelude::*; | ||
|
||
// #[derive(World)] | ||
pub struct World { | ||
pub players: StructOf<Dense<Player>>, | ||
pub enemies: StructOf<Dense<Enemy>>, | ||
pub particles: StructOf<Dense<Particle>>, | ||
} | ||
|
||
#[derive(SplitFields)] | ||
pub struct Position { | ||
pub x: f32, | ||
} | ||
|
||
#[derive(SplitFields)] | ||
pub struct Particle { | ||
#[split(nested)] | ||
pub position: Position, | ||
pub size: f32, | ||
} | ||
|
||
#[derive(SplitFields)] | ||
pub struct Actor {} | ||
|
||
pub enum EnemyAi { | ||
Crawler, | ||
} | ||
|
||
#[derive(SplitFields)] | ||
pub struct Player { | ||
#[split(nested)] | ||
pub position: Position, | ||
#[split(nested)] | ||
pub actor: Actor, | ||
} | ||
|
||
#[derive(SplitFields)] | ||
pub struct Enemy { | ||
#[split(nested)] | ||
pub position: Position, | ||
#[split(nested)] | ||
pub actor: Actor, | ||
pub ai: EnemyAi, | ||
} | ||
|
||
fn main() {} |