Files
rust-engine/src/config.rs
2020-12-02 10:21:51 +01:00

35 lines
904 B
Rust

use std::fs;
use serde_derive::{Deserialize, Serialize};
use toml;
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
pub struct LogConfigInput {
pub mouse_motion: bool,
pub buttons: bool,
pub missing_bindings: bool
}
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
pub struct LogConfig {
pub vulkan_validation_layers: bool,
pub mesh_load_info: bool,
pub input: LogConfigInput
}
impl LogConfig {
pub fn from_file(path: &str) -> Self {
toml::from_slice(&fs::read(path).expect("Failed to read log config!")).expect("Failed to parse log config!")
}
}
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
pub struct RenderConfig {
pub msaa_samples: u32
}
impl RenderConfig {
pub fn from_file(path: &str) -> Self {
toml::from_slice(&fs::read(path).expect("Failed to read render config!")).expect("Failed to parse render config!")
}
}