diff --git a/game/game_logic/Cargo.toml b/game/game_logic/Cargo.toml index be0d2754..e6fb3ce5 100644 --- a/game/game_logic/Cargo.toml +++ b/game/game_logic/Cargo.toml @@ -25,4 +25,4 @@ thiserror = "1.0.30" approx = "0.5.1" poll-promise = { version = "0.1.0", features = ["tokio"] } tempfile = "3.3.0" -nalgebra = "0.30.1" \ No newline at end of file +nalgebra = { version = "0.30.1", features=["serde-serialize"]} \ No newline at end of file diff --git a/game/game_logic/src/model/mod.rs b/game/game_logic/src/model/mod.rs index d44230b1..f576cdb7 100644 --- a/game/game_logic/src/model/mod.rs +++ b/game/game_logic/src/model/mod.rs @@ -1 +1,2 @@ -pub mod player; \ No newline at end of file +pub mod player; +pub mod world_object; \ No newline at end of file diff --git a/game/game_logic/src/model/world_object.rs b/game/game_logic/src/model/world_object.rs new file mode 100644 index 00000000..44ef9a46 --- /dev/null +++ b/game/game_logic/src/model/world_object.rs @@ -0,0 +1,26 @@ +use nalgebra as na; +use serde::Deserialize; + +#[derive(Debug, Clone, Deserialize)] +pub struct PossiblyAnimatedTexture { + /// Signal if the texture is animated or static + pub animated: bool, + /// Relative file path from `dist` to the texture + pub rel_file_path: String, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct WorldObject { + /// Object name. Must match the name of the texture + pub name: String, + /// Object variant name. Must match the name of the texture, or None if there is only one variant + pub variant_name: Option, + /// Object position. 1,1 being up and to the right + pub position: na::Vector2, + /// Object rotation, positive is clockwise + pub rotation_radians: f32, + /// The object's bottom texture + pub bottom_texture: PossiblyAnimatedTexture, + /// The object's top texture + pub top_texture: Option, +}