bevy/examples/2d/sprite.rs
Carter Anderson ebcdc9fb8c
Flexible ECS System Params (#798)
system params can be in any order, faster compiles, remove foreach
2020-11-08 12:34:05 -08:00

22 lines
546 B
Rust

use bevy::prelude::*;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_startup_system(setup.system())
.run();
}
fn setup(
commands: &mut Commands,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
let texture_handle = asset_server.load("branding/icon.png");
commands
.spawn(Camera2dComponents::default())
.spawn(SpriteComponents {
material: materials.add(texture_handle.into()),
..Default::default()
});
}