2 releases
0.1.1 | Mar 10, 2022 |
---|---|
0.1.0 | Mar 10, 2022 |
#1111 in Game dev
23 downloads per month
335KB
205 lines
🍞 Bevy Toast
A bevy plugin to easily show toast notifications to the player
Features
- Add in-game notifications to your bevy project
- Customize the duration and the text of the toast
Demo
The source code for the following example is available here: /examples/hello_world.rs
Usage
Plugin setup
Add the following plugins to your project:
use bevy_tweening::TweeningPlugin;
use bevy_toast::ToastPlugin;
fn main() {
App::new()
.add_plugin(TweeningPlugin)
.add_plugin(ToastPlugin)
.run();
}
Send a toast 🍞
Sending a Toast is a simple as sending a ShowToast
event:
// send a toast when pressing 'E'
fn keyboard_handler(
keyboard: Res<Input<KeyCode>>,
toast_sender: EventWriter<ShowToast>,
) {
if keyboard.just_pressed(KeyCode::E) {
toast_evt.send(ShowToast {
title: "Achievement reached!".to_string(),
subtitle: "You pressed 'E'".to_string(),
duration: Duration::from_secs(2),
});
}
}
Compatible versions
bevy | bevy_toast |
---|---|
0.6 | 0.1 |
Dependencies
~42–57MB
~811K SLoC