Function icon_value

Source
pub fn icon_value(
    x: f32,
    cy: f32,
    icon: Icon,
    value: &str,
    size: f32,
    color: Color,
    theme: &KitTheme,
) -> f32
Expand description

The standard HUD stat: icon then value, vertically centered on cy and starting at x (for example a heart and 12). size is the icon’s box; the value uses the theme’s body size scaled to match. Returns the width.

use ferravex_render::{Color, icons::Icon, ui::kit::{self, KitTheme}};
let theme = KitTheme::default();
let w = kit::icon_value(20., 40., Icon::Coin, "158", 20., Color::from_hex(0xf7b553), &theme);
assert!(w > 20.);