bevy/examples/2d/sprite.rs
2020-06-04 17:09:24 -07:00

23 lines
602 B
Rust

use bevy::prelude::*;
fn main() {
App::build()
.add_default_plugins()
.add_startup_system(setup.system())
.run();
}
fn setup(
command_buffer: &mut CommandBuffer,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
let texture_handle = asset_server.load("assets/branding/icon.png").unwrap();
command_buffer
.build()
.add_entity(OrthographicCameraEntity::default())
.add_entity(SpriteEntity {
material: materials.add(texture_handle.into()),
..Default::default()
});
}