Crates.io | bevy_mod_bbcode |
lib.rs | bevy_mod_bbcode |
version | |
source | src |
created_at | 2024-07-21 21:41:29.84088 |
updated_at | 2024-11-30 13:51:35.498389 |
description | Use BBCode-formatted text inside of Bevy. |
homepage | |
repository | https://github.com/TimJentzsch/bevy_mod_bbcode |
max_upload_size | |
id | 1310596 |
Cargo.toml error: | TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Rich text support in Bevy using a custom BBCode markup flavor.
bevy version |
bevy_mod_bbcode version |
---|---|
0.15 |
0.3 |
0.14 |
0.1 - 0.2 |
cargo add bevy_mod_bbcode
Instead of spawning Text
, spawn Bbcode
!
use bevy::prelude::*;
use bevy_mod_bbcode::{Bbcode, BbcodePlugin, BbcodeSettings};
fn main() {
App::new()
// Register the font files stored in `assets/fonts`
.add_plugins((DefaultPlugins, BbcodePlugin::new().with_fonts("fonts")))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
commands.spawn((Bbcode::new(
r"test [b]bold[/b] with [i]italic[/i] and [c=#ff00ff]color[/c]"),
// Use the "Fira Sans" font family with a default font size of 40
BbcodeSettings::new("Fira Sans", 40., Color::WHITE),
));
}
See examples
for more usage patterns!
b
: [b]bold[/b] texti
: [i]italic[/i] textc
: [c=#ff0000]colored[/c] text
ResMut<ColorMap>
and use the names instead of hex valuesm
: [m=foo]text with marker component[/m]
BbcodeSettings::with_marker
and use them to update text dynamicallyfont
: [font="Fira Sans"]change the font family[/font]This project is licensed under the terms of the MIT or Apache 2.0 license at your choice.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Note that the assets used in the examples might use different licenses, see assets/CREDITS.md
.