Function toast

Source
pub fn toast(
    center_x: f32,
    top: f32,
    icon: Option<char>,
    text: &str,
    tone: Tone,
    look: Appearance,
    theme: &KitTheme,
) -> Rect
Expand description

A toast centered horizontally on center_x with its top at top. Pass the Appearance from a ferravex_play::tween::Entrance to slide/fade it. icon is drawn in the tone’s color before the text. Returns its rectangle.

use ferravex_play::tween::Appearance;
use ferravex_render::ui::kit::{self, KitTheme, Tone};
let r = kit::toast(640., 24., Some('★'), "Achievement unlocked", Tone::Success,
    Appearance::SHOWN, &KitTheme::default());
assert!(r.w > 100.);