Crates.io | bevy_toast |
lib.rs | bevy_toast |
version | 0.1.1 |
source | src |
created_at | 2022-03-10 14:22:56.13086 |
updated_at | 2022-03-10 14:26:53.483012 |
description | A bevy plugin to easily show toast notifications to the player |
homepage | |
repository | https://github.com/NightlySide/bevy_toast |
max_upload_size | |
id | 547638 |
size | 402,577 |
A bevy plugin to easily show toast notifications to the player
The source code for the following example is available here: /examples/hello_world.rs
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();
}
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),
});
}
}
bevy | bevy_toast |
---|---|
0.6 | 0.1 |