mirror of
https://github.com/Theaninova/WanganSunrise.git
synced 2025-12-12 19:46:16 +00:00
feat: enma parsing
This commit is contained in:
7
wangan_sunrise/Cargo.toml
Normal file
7
wangan_sunrise/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "wangan_sunrise"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["wayland"] }
|
||||
43
wangan_sunrise/src/assets/game_asset_reader.rs
Normal file
43
wangan_sunrise/src/assets/game_asset_reader.rs
Normal 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!()
|
||||
}
|
||||
}
|
||||
1
wangan_sunrise/src/assets/mod.rs
Normal file
1
wangan_sunrise/src/assets/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod game_asset_reader;
|
||||
7
wangan_sunrise/src/main.rs
Normal file
7
wangan_sunrise/src/main.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
mod assets;
|
||||
|
||||
use bevy::{app::App, asset::io::AssetReader, DefaultPlugins};
|
||||
|
||||
fn main() {
|
||||
App::new().add_plugins(DefaultPlugins).run();
|
||||
}
|
||||
Reference in New Issue
Block a user