Add: tauri frontend as bevy alternative
This commit is contained in:
@@ -26,6 +26,7 @@ pub struct AppConfig {
|
||||
pub api: ApiConfig,
|
||||
pub logging: LoggingConfig,
|
||||
pub controls: ControlsConfig,
|
||||
pub frontend: FrontendConfig,
|
||||
}
|
||||
|
||||
impl Default for AppConfig {
|
||||
@@ -37,6 +38,7 @@ impl Default for AppConfig {
|
||||
api: ApiConfig::default(),
|
||||
logging: LoggingConfig::default(),
|
||||
controls: ControlsConfig::default(),
|
||||
frontend: FrontendConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,6 +147,27 @@ impl Default for ControlsConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum FrontendBackend {
|
||||
Bevy,
|
||||
Tauri,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct FrontendConfig {
|
||||
pub backend: FrontendBackend,
|
||||
}
|
||||
|
||||
impl Default for FrontendConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
backend: FrontendBackend::Bevy,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn config_path(app_name: &str) -> Result<PathBuf, ConfigError> {
|
||||
let dirs =
|
||||
@@ -198,9 +221,11 @@ mod tests {
|
||||
let path = temp.path().join("config.toml");
|
||||
let mut config = AppConfig::default();
|
||||
config.window.x = 42.0;
|
||||
config.frontend.backend = super::FrontendBackend::Tauri;
|
||||
|
||||
save(&path, &config).expect("save");
|
||||
let (_, loaded) = load_or_create_at(&path).expect("reload");
|
||||
assert!((loaded.window.x - 42.0).abs() < f32::EPSILON);
|
||||
assert_eq!(loaded.frontend.backend, super::FrontendBackend::Tauri);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user