bevy_pretty_text 0.1.0

Text2D effects library for Bevy
Documentation

crates.io docs.rs

Pretty Text is a Text2d effects library for Bevy.

Demos

cargo run --example type_writer

A type writer demonstration


cargo run --example effects

Various text effects


cargo run --bin demo

Getting Started

First, add bevy_pretty_text to the dependencies in your Cargo.toml:

[dependencies]
bevy_pretty_text = "0.1"

Then, you'll need to add the PrettyTextPlugin to your app.

use bevy::prelude::*;
use bevy_pretty_text::prelude::*;

fn main() {
    App::default()
        .add_plugins((DefaultPlugins, PrettyTextPlugin))
        .run();
}

And then you can make some pretty text!

fn spawn_text(mut commands: Commands) {
    // Spawn text.
    commands.spawn(pretty!("I am very `pretty`[wave, !green]!"));

    // Spawn type writer text.
    commands
        .spawn((
            TypeWriter::new(30.),
            pretty!("I am [1]<0.8>*sniff*[1]<1.2> very `pretty`[wave, !green]![3]<1>"),
            Transform::from_xyz(0., 200., 0.),
        ))
        .observe(
            |trigger: Trigger<TypeWriterFinished>, mut commands: Commands| {
                commands
                    .entity(trigger.target())
                    .insert(TypeWriter::new(30.));
            },
        );
}

The repository’s examples should help you get up to speed on common usage patterns.

Feature flags

Flag Description Default feature
default_effects Enable the built-in text effects. Yes
serialize Enable serialization for PrettyTextSpans. No

Bevy version compatibility

bevy bevy_pretty_text
0.16 0.1

License

Pretty Text is free and open source. All code in this repository is dual-licensed under either:

at your option.