Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ickshonpe/bevy_mod_ui_sprite
draw sprites with the bevy ui
https://github.com/ickshonpe/bevy_mod_ui_sprite
bevy bevy-engine bevy-ui rust
Last synced: 3 months ago
JSON representation
draw sprites with the bevy ui
- Host: GitHub
- URL: https://github.com/ickshonpe/bevy_mod_ui_sprite
- Owner: ickshonpe
- License: mit
- Created: 2022-10-11T16:30:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-17T09:25:27.000Z (about 2 years ago)
- Last Synced: 2024-09-28T15:03:38.821Z (3 months ago)
- Topics: bevy, bevy-engine, bevy-ui, rust
- Language: Rust
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bevy_mod_ui_sprite
[![crates.io](https://img.shields.io/crates/v/bevy_mod_ui_sprite)](https://crates.io/crates/bevy_mod_ui_sprite)
[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/ickshonpe/bevy_mod_ui_sprite)
[![crates.io](https://img.shields.io/crates/d/bevy_mod_ui_sprite)](https://crates.io/crates/bevy_mod_ui_sprite)Draw sprites, texture atlas sprites, and colored rectangles with the Bevy UI.
![image](example.png)
## Usage
Add the dependency to `Cargo.toml`:
```toml
bevy_mod_ui_sprite = "0.2.1"
```Add the plugin to your app:
```rust
use bevy_mod_ui_sprite::*;fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(UiSpritePlugin)
// ..rest of app
.run()
}
```
Don't forget a camera:```rust
commands.spawn_bundle(Camera2dBundle::default());
```Then you can spawn a UiSpriteBundle:
```rust
commands.spawn_bundle(UiSpriteBundle {
sprite: UiSprite::Image(asset_loader.load("sprite.png")),
size: SpriteSize::Size(Vec2::new(64., 64.)),
color: UiColor(Color::YELLOW),
transform: Transform::from_translation(Vec3::new(100., 100., 100.)),
..Default::default()
});
```## Full Example
```
cargo --run --example example
```## Notes
Performance should be fine, but this crate is not a substitute for the much more efficient Bevy 2D renderer.