extra_source
This commit is contained in:
parent
011f8ce97b
commit
d4cf944576
@ -10,7 +10,7 @@ pub struct LoadBatchRequest {
|
||||
impl LoadBatchRequest {
|
||||
pub fn new<T>(requests: Vec<T>) -> Self
|
||||
where
|
||||
T:Into<AssetPath<'static>>,
|
||||
T: Into<AssetPath<'static>>,
|
||||
{
|
||||
Self {
|
||||
requests: requests.into_iter().map(Into::into).collect(),
|
||||
|
||||
@ -8,12 +8,8 @@ use bevy::{
|
||||
},
|
||||
prelude::*,
|
||||
};
|
||||
use bevy_asset::{LoadBatchRequest, LoadedBatch};
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Resource, Default)]
|
||||
struct SpriteBatch(Handle<LoadedBatch>);
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
// Add an extra asset source with the name "example_files" to
|
||||
@ -47,11 +43,4 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
assert_eq!(asset_path, "example_files://bevy_pixel_light.png".into());
|
||||
|
||||
commands.spawn(Sprite::from_image(asset_server.load(asset_path)));
|
||||
|
||||
let path = Path::new("*.png");
|
||||
let source = AssetSourceId::from("example_files");
|
||||
let asset_path = AssetPath::from_path(path).with_source(source);
|
||||
commands.insert_resource(SpriteBatch(
|
||||
asset_server.load_batch(LoadBatchRequest::new(vec![asset_path])),
|
||||
));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user