Skip to content

Commit 994518c

Browse files
authored
Update documentation with m tag and new font loading (#7)
1 parent 9fb125e commit 994518c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# bevy_mod_bbcode
22

3-
Use BBCode-formatted text in Bevy.
3+
Rich text support in Bevy using a custom [BBCode](https://en.wikipedia.org/wiki/BBCode) markup flavor.
44

55
## Bevy Compatibility
66

@@ -24,7 +24,8 @@ use bevy_mod_bbcode::{BbcodeBundle, BbcodePlugin, BbcodeSettings};
2424

2525
fn main() {
2626
App::new()
27-
.add_plugins((DefaultPlugins, BbcodePlugin))
27+
// Register the font files stored in `assets/fonts`
28+
.add_plugins((DefaultPlugins, BbcodePlugin::new().with_fonts("fonts")))
2829
.add_systems(Startup, setup)
2930
.run();
3031
}
@@ -34,14 +35,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
3435

3536
commands.spawn(BbcodeBundle::from_content(
3637
"test [b]bold[/b] with [i]italic[/i] and [c=#ff00ff]color[/c]",
37-
BbcodeSettings {
38-
regular_font: asset_server.load("fonts/FiraSans-Regular.ttf"),
39-
bold_font: asset_server.load("fonts/FiraSans-Bold.ttf"),
40-
italic_font: asset_server.load("fonts/FiraSans-Italic.ttf"),
41-
42-
font_size: 40.,
43-
color: Color::WHITE,
44-
},
38+
// Use the "Fira Sans" font family with a default font size of 40
39+
BbcodeSettings::new("Fira Sans", 40., Color::WHITE),
4540
));
4641
}
4742
```
@@ -50,14 +45,17 @@ See `examples` for more usage patterns!
5045

5146
### Supported Tags
5247

53-
| Tag | Usage |
54-
| ------------------------ | ------------ |
55-
| `[b]bold[/b]` | Bold text |
56-
| `[i]italic[/i]` | Italic text |
57-
| `[c=#ff00ff]colored[/c]` | Colored text |
48+
| Tag | Usage |
49+
| ------------------------ | ----------------------------------------------------------------------------------------- |
50+
| `[b]bold[/b]` | Bold text |
51+
| `[i]italic[/i]` | Italic text |
52+
| `[c=#ff00ff]colored[/c]` | Colored text |
53+
| `[m=foo]test[/m]` | Add a marker component to the `Text` "test", registered via `BbcodeSettings::with_marker` |
5854

5955
## License
6056

6157
This project is licensed under the terms of the [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE) license at your choice.
6258

6359
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.
60+
61+
Note that the assets used in the examples might use different licenses, see [`assets/CREDITS.md`](assets/CREDITS.md).

examples/static.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use bevy_mod_bbcode::{BbcodeBundle, BbcodePlugin, BbcodeSettings};
33

44
fn main() {
55
App::new()
6+
// Register the font files stored in `assets/fonts`
67
.add_plugins((DefaultPlugins, BbcodePlugin::new().with_fonts("fonts")))
78
.add_systems(Startup, setup)
89
.run();
@@ -13,6 +14,7 @@ fn setup(mut commands: Commands) {
1314

1415
commands.spawn(BbcodeBundle::from_content(
1516
"test [b]bold with [i]italic[/i][/b] and [c=#ff00ff]color[/c]",
17+
// Use the "Fira Sans" font family with a default font size of 40
1618
BbcodeSettings::new("Fira Sans", 40., Color::WHITE),
1719
));
1820
}

0 commit comments

Comments
 (0)