docs/bevy/examples/2d/sprite.rs 406 B · 18 lines · raw · history
| 1 | //! Displays a single [`Sprite`], created from an image. |
| 2 | |
| 3 | use bevy::prelude::*; |
| 4 | |
| 5 | fn main() { |
| 6 | App::new() |
| 7 | .add_plugins(DefaultPlugins) |
| 8 | .add_systems(Startup, setup) |
| 9 | .run(); |
| 10 | } |
| 11 | |
| 12 | fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { |
| 13 | commands.spawn(Camera2d); |
| 14 | |
| 15 | commands.spawn(Sprite::from_image( |
| 16 | asset_server.load("branding/bevy_bird_dark.png"), |
| 17 | )); |
| 18 | } |