mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 06:00:20 +00:00
use relative paths for assets
This commit is contained in:
parent
2bcb8a2a41
commit
8a61ef48d3
9 changed files with 11 additions and 24 deletions
|
@ -12,8 +12,7 @@ fn setup(
|
|||
mut textures: ResMut<Assets<Texture>>,
|
||||
mut materials: ResMut<Assets<ColorMaterial>>,
|
||||
) {
|
||||
let texture_path = concat!(env!("CARGO_MANIFEST_DIR"), "/assets/branding/icon.png");
|
||||
let texture = Texture::load(TextureType::Png(texture_path.to_string()));
|
||||
let texture = Texture::load(TextureType::Png("assets/branding/icon.png".to_string()));
|
||||
let texture_handle = textures.add(texture);
|
||||
|
||||
command_buffer
|
||||
|
|
|
@ -13,8 +13,7 @@ fn setup(
|
|||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
// load the mesh
|
||||
let model_path = concat!(env!("CARGO_MANIFEST_DIR"), "/assets/models/Monkey.gltf");
|
||||
let mesh = gltf::load_gltf(&model_path).unwrap().unwrap();
|
||||
let mesh = gltf::load_gltf("assets/models/monkey/Monkey.gltf").unwrap().unwrap();
|
||||
let mesh_handle = meshes.add(mesh);
|
||||
|
||||
// create a material for the mesh
|
||||
|
|
|
@ -15,11 +15,9 @@ fn setup(
|
|||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
// load a texture
|
||||
let texture_path = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/assets/branding/bevy_logo_dark_big.png"
|
||||
);
|
||||
let texture = Texture::load(TextureType::Png(texture_path.to_string()));
|
||||
let texture = Texture::load(TextureType::Png(
|
||||
"assets/branding/bevy_logo_dark_big.pn".to_string(),
|
||||
));
|
||||
let aspect = texture.aspect();
|
||||
let texture_handle = textures.add(texture);
|
||||
|
||||
|
|
|
@ -3,9 +3,6 @@ use bevy::prelude::*;
|
|||
fn main() {
|
||||
App::build()
|
||||
.add_default_plugins()
|
||||
.load_plugin(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/target/debug/libexample_plugin.so"
|
||||
))
|
||||
.load_plugin("target/debug/libexample_plugin.so")
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
|||
.run();
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
// This "print message plugin" prints a `message` every `wait_duration`
|
||||
pub struct PrintMessagePlugin {
|
||||
// Put your plugin configuration here
|
||||
wait_duration: Duration,
|
||||
|
|
|
@ -13,11 +13,7 @@ fn setup(
|
|||
mut textures: ResMut<Assets<Texture>>,
|
||||
mut materials: ResMut<Assets<ColorMaterial>>,
|
||||
) {
|
||||
let font_path = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/assets/fonts/FiraSans-Bold.ttf"
|
||||
);
|
||||
let mut font_file = File::open(&font_path).unwrap();
|
||||
let mut font_file = File::open("assets/fonts/FiraSans-Bold.ttf").unwrap();
|
||||
let mut buffer = Vec::new();
|
||||
font_file.read_to_end(&mut buffer).unwrap();
|
||||
let font = Font::try_from_bytes(buffer).unwrap();
|
||||
|
|
|
@ -23,11 +23,9 @@ fn setup(
|
|||
// ..Default::default()
|
||||
// });
|
||||
|
||||
let texture_path = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/assets/branding/bevy_logo_dark_big.png"
|
||||
);
|
||||
let texture = Texture::load(TextureType::Png(texture_path.to_string()));
|
||||
let texture = Texture::load(TextureType::Png(
|
||||
"assets/branding/bevy_logo_dark_big.png".to_string(),
|
||||
));
|
||||
let aspect = texture.aspect();
|
||||
let texture_handle = textures.add(texture);
|
||||
|
||||
|
|
Loading…
Reference in a new issue