fennel_engine/scenes.rs
1//! Scenes are compositions of entities/components and scripts the user sees on their screen.
2//! A scene has a name, a list of scripts it uses (doesn't actually owns them, retrieves from
3//! resource manager) and a list of entities (same as with scripts)
4use ron::Value;
5use serde::Deserialize;
6use specs::{Component, DenseVecStorage};
7
8/// Scene struct
9#[derive(Deserialize, Debug, Clone, Component)]
10pub struct Scene {
11 /// Scene internal name
12 pub name: String,
13 /// List of entities in a scene
14 pub entities: Vec<EntityDescriptor>,
15}
16
17/// Descriptor of an entity in scene config
18#[derive(Deserialize, Debug, Clone)]
19pub struct EntityDescriptor {
20 /// Entity internal id
21 pub id: String,
22 /// List of components in an entity
23 pub components: Vec<ComponentDescriptor>,
24}
25
26/// Descriptor of a component in scene config
27#[derive(Deserialize, Debug, Clone)]
28pub struct ComponentDescriptor {
29 /// Component internal id
30 pub id: String,
31 /// Component configuration
32 pub config: Value,
33}