mirror of
https://github.com/bevyengine/bevy
synced 2024-11-13 00:17:27 +00:00
28 lines
755 B
Rust
28 lines
755 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::ui())
|
|
.add_entity(SpriteEntity {
|
|
rect: Rect {
|
|
position: Vec2::new(300.0, 300.0),
|
|
z_index: 0.5,
|
|
..Default::default()
|
|
},
|
|
material: materials.add(texture_handle.into()),
|
|
..Default::default()
|
|
});
|
|
}
|