khors/src/modules/config/mod.rs

55 lines
1.2 KiB
Rust

use flax::{Schedule, World};
use serde::{Deserialize, Serialize};
use crate::core::module::Module;
use self::systems::first_read_config_system;
pub mod components;
pub mod systems;
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct Config {
pub asset_path: String,
}
#[allow(dead_code)]
pub struct ConfigModule {
// watcher: INotifyWatcher,
// watcher_rx: std::sync::mpsc::Receiver<Result<notify::Event, notify::Error>>,
}
impl ConfigModule {
pub fn new(
schedule: &mut Schedule,
_world: &mut World,
_events: &mut crate::core::events::Events,
) -> Self {
let schedule_r = Schedule::builder()
// .with_system(read_config_system())
.with_system(first_read_config_system())
.build();
schedule.append(schedule_r);
Self {
// schedule,
// watcher,
// watcher_rx: rx,
}
}
}
impl Module for ConfigModule {
fn on_update(
&mut self,
_world: &mut World,
_events: &mut crate::core::events::Events,
_frame_time: std::time::Duration,
) -> anyhow::Result<()> {
// println!("ConfigModule on_update");
Ok(())
}
}