this is jank, but a good start

This commit is contained in:
2021-02-20 02:08:48 -08:00
parent c2b62a5f53
commit 26f2cf4836
4 changed files with 113 additions and 90 deletions

View File

@@ -4,7 +4,7 @@ use std::path::PathBuf;
use std::time::Instant;
use cgmath::{Euler, Quaternion};
use config::Config;
use config::{Config, Value};
use config::File;
use legion::world::SubWorld;
use legion::IntoQuery;
@@ -21,7 +21,8 @@ use crate::geometry::{load_obj, RawMesh};
pub struct EntityMeta {
pub name: String,
pub ent_type: String,
pub mesh: String,
pub mesh: Option<String>,
pub position: Option<Position>
}
pub struct RuntimeState {
@@ -51,10 +52,22 @@ impl RuntimeState {
let mut out = Vec::new();
for entity in self.config_db.get_array("entities").unwrap() {
let table = entity.into_table().unwrap();
let mesh = match table.get("mesh") {
None => { None }
Some(v) => { Some(v.kind.to_string())}
};
// let position = match table.get("position") {
// None => { None }
// Some(v) => { Some(v.kind.to_string())}
// };
out.push(EntityMeta {
name: table.get("name").unwrap().kind.to_string(),
ent_type: table.get("type").unwrap().kind.to_string(),
mesh: table.get("mesh").unwrap().kind.to_string(),
mesh: mesh,
position: None
});
}
out