bevy/examples/2d/sprite.rs

23 lines
565 B
Rust
Raw Normal View History

2020-05-04 08:22:25 +00:00
use bevy::prelude::*;
fn main() {
App::build()
.add_default_plugins()
2020-05-14 00:31:56 +00:00
.add_startup_system(setup.system())
2020-05-04 08:22:25 +00:00
.run();
}
2020-05-14 00:31:56 +00:00
fn setup(
2020-07-10 04:18:35 +00:00
mut commands: Commands,
2020-05-16 02:30:02 +00:00
asset_server: Res<AssetServer>,
2020-05-14 00:52:47 +00:00
mut materials: ResMut<Assets<ColorMaterial>>,
2020-05-14 00:31:56 +00:00
) {
2020-05-16 02:30:02 +00:00
let texture_handle = asset_server.load("assets/branding/icon.png").unwrap();
2020-07-10 04:18:35 +00:00
commands
.spawn(OrthographicCameraComponents::default())
.spawn(SpriteComponents {
2020-05-14 00:31:56 +00:00
material: materials.add(texture_handle.into()),
2020-05-04 08:22:25 +00:00
..Default::default()
});
}