feat: enma parsing

This commit is contained in:
2024-04-17 18:21:11 +02:00
commit 0f6bfc272c
22 changed files with 5030 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
[package]
name = "wangan_sunrise"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = { version = "0.13", features = ["wayland"] }

View File

@@ -0,0 +1,43 @@
use std::{env, fs::File, path::Path};
use bevy::{
asset::io::{AssetReader, AssetReaderError, Reader},
utils::BoxedFuture,
};
struct GameAssetReader(Box<dyn AssetReader>);
fn get_game_dir() -> String {
env::var("GAME_DIR").unwrap_or(".".to_string())
}
impl AssetReader for GameAssetReader {
fn read<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, Result<Box<Reader<'a>>, AssetReaderError>> {
let full_path = path.join(get_game_dir());
self.0.read(&full_path)
}
fn read_meta<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, Result<Box<Reader<'a>>, AssetReaderError>> {
todo!()
}
fn read_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, Result<Box<bevy::asset::io::PathStream>, AssetReaderError>> {
todo!()
}
fn is_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, Result<bool, AssetReaderError>> {
todo!()
}
}

View File

@@ -0,0 +1 @@
pub mod game_asset_reader;

View File

@@ -0,0 +1,7 @@
mod assets;
use bevy::{app::App, asset::io::AssetReader, DefaultPlugins};
fn main() {
App::new().add_plugins(DefaultPlugins).run();
}