docs/bevy/examples/2d/sprite_flipping.rs 595 B · 23 lines · raw · history
| 1 | //! Displays a single [`Sprite`], created from an image, but flipped on one axis. |
| 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 { |
| 16 | image: asset_server.load("branding/bevy_bird_dark.png"), |
| 17 | // Flip the logo to the left |
| 18 | flip_x: true, |
| 19 | // And don't flip it upside-down ( the default ) |
| 20 | flip_y: false, |
| 21 | ..Default::default() |
| 22 | }); |
| 23 | } |