text_gizmos_font/text_gizmos_font.rs
1//! Example displaying all the available glyphs from the Simplex Hershey font
2//! used by `bevy_gizmos`
3
4use bevy::prelude::*;
5
6const ALL_GLYPHS: &str = " !\"#$%&'()*\n\
7+,-./012345\n\
86789:;<=>?@\n\
9ABCDEFGHIJK\n\
10LMNOPQRSTUV\n\
11WXYZ[\\]^_`a\n\
12bcdefghijkl\n\
13mnopqrstuvw\n\
14xyz{|}~";
15
16fn main() {
17 App::new()
18 .add_plugins(DefaultPlugins)
19 .add_systems(Startup, setup_camera)
20 .add_systems(Update, draw_all_glyphs)
21 .run();
22}
23
24fn setup_camera(mut commands: Commands) {
25 commands.spawn(Camera2d);
26}
27
28fn draw_all_glyphs(mut text_gizmos: Gizmos) {
29 text_gizmos.text_2d(
30 Isometry2d::IDENTITY,
31 ALL_GLYPHS,
32 40.0,
33 Vec2::ZERO,
34 Color::WHITE,
35 );
36}