https://github.com/edouardpoitras/bevy_text_popup
Bevy plugin to easily create UI text popups using events
https://github.com/edouardpoitras/bevy_text_popup
bevy bevy-plugin bevy-ui
Last synced: 3 months ago
JSON representation
Bevy plugin to easily create UI text popups using events
- Host: GitHub
- URL: https://github.com/edouardpoitras/bevy_text_popup
- Owner: edouardpoitras
- License: apache-2.0
- Created: 2023-08-22T15:46:17.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T01:03:45.000Z (6 months ago)
- Last Synced: 2025-02-27T05:51:29.753Z (3 months ago)
- Topics: bevy, bevy-plugin, bevy-ui
- Language: Rust
- Homepage:
- Size: 604 KB
- Stars: 22
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE.md
Awesome Lists containing this project
README
# Bevy Text Popup
[](https://github.com/edouardpoitras/bevy_text_popup/actions/workflows/rust.yml)
[](https://crates.io/crates/bevy_text_popup)
[](https://docs.rs/bevy_text_popup)

Bevy plugin to easily create UI text popups with events.
Popups are meant to be short-lived and on top of all other UI components.
Useful for notifications and prompting user input.
Current Customization Options:
- Font: `cargo run --example custom_font`
- Background: Color and Transparency (image background to come)
- Border: `cargo run --example border`
- Buttons: `cargo run --example buttons`
- Timeouts: Dismiss automatically after X seconds
- Modal: `cargo run --example modal`Upcoming Customization Options:
- Dismiss: Click anywhere to dismiss, X close button, etc.
- Input: Allow for user input.
- Hover/Click: Color change on button/popup hover/click.
- Animations: Open/Close/Dismiss/Click/etc.## Examples
This example will display a modal popup for 10s with a 'Close' button.
```rust,ignore
use bevy::prelude::*;
use bevy_text_popup::{TextPopupEvent, TextPopupPlugin, TextPopupTimeout, TextPopupButton};fn main() {
App::new()
.add_plugins((DefaultPlugins, TextPopupPlugin))
.add_systems(Startup, setup)
.run();
}fn setup(mut commands: Commands, mut text_popup_events: EventWriter) {
commands.spawn(Camera2d::default());text_popup_events.send(TextPopupEvent {
content: "Modal Example".to_string(),
modal: Some(Color::linear_rgba(0., 0., 1., 0.75).into()),
timeout: TextPopupTimeout::Seconds(10),
dismiss_button: Some(TextPopupButton {
text: "Close".to_string(),
text_color: TextColor::from(Color::BLACK),
background_color: Color::linear_rgb(1., 1., 1.).into(),
..Default::default()
}),
name: Some(Name::new("custom_popup_name")), // Name component will be added to entity.
..default()
});
}
```### Buttons
`cargo run --example buttons`

### Border
`cargo run --example border`

### Custom Font
`cargo run --example custom_font`

### Locations
`cargo run --example locations`

And example showing custom pixel coordinates:
`cargo run --example custom_locations`
### Modal
`cargo run --example modal`

### Transparency
`cargo run --example transparency`

## Bevy Compatibility
|bevy|bevy_text_popup|
|---|---|
|0.15|0.5|
|0.14|0.4|
|0.13|0.3|
|0.12|0.2|
|0.11|0.1|