nightshade-editor 0.32.0

Interactive map editor for the Nightshade game engine
mod dev_tools;
mod ecs;
mod editor_scene;
mod gltf_fetch;
mod project;
mod scene_writeback;
mod state;
mod systems;
mod undo;

use nightshade::prelude::launch;
use state::Editor;

pub const HDR_BYTES: &[u8] = include_bytes!("../assets/sky/moonrise.hdr");

#[cfg(not(target_arch = "wasm32"))]
#[derive(clap::Parser)]
#[command(
    name = "nightshade-editor",
    about = "Interactive map editor for the Nightshade game engine"
)]
struct Arguments {
    /// Map (.nsmap) or scene (.json) file to open at startup
    map: Option<std::path::PathBuf>,
}

#[cfg(not(target_arch = "wasm32"))]
fn main() -> Result<(), Box<dyn std::error::Error>> {
    use clap::Parser;
    let arguments = Arguments::parse();
    if let Some(path) = &arguments.map
        && !path.is_file()
    {
        return Err(format!("map file not found: {}", path.display()).into());
    }
    launch(Editor {
        startup_map: arguments.map,
        ..Editor::default()
    })
}

#[cfg(target_arch = "wasm32")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
    launch(Editor::default())
}