Skip to content

Commit

Permalink
Use bevy default_font instead of custom font
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahShomette committed Nov 12, 2023
1 parent 21727b2 commit 78f4f16
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ repository = "https://github.com/jamescarterbell/bevy_eventwork"
license = "MIT"
categories = ["game-development", "network-programming"]
autoexamples = false
exclude = ["assets"]
resolver = "2"

[badges]
Expand Down Expand Up @@ -48,4 +47,4 @@ async-net = {version = "2.0.0", optional = true}
futures-lite = "2.0.0"

[dev-dependencies]
bevy = "0.12.0"
bevy = {version = "0.12.0", features = ["default_font"]}
Binary file removed assets/fonts/OpenSans-Regular.ttf
Binary file not shown.
Binary file removed assets/fonts/Staatliches-Regular.ttf
Binary file not shown.
14 changes: 6 additions & 8 deletions examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,18 @@ struct GlobalChatSettings {
}

impl FromWorld for GlobalChatSettings {
fn from_world(world: &mut World) -> Self {
let asset_server = world.get_resource::<AssetServer>().unwrap();
fn from_world(_world: &mut World) -> Self {

GlobalChatSettings {
chat_style: TextStyle {
font: asset_server.load("fonts/OpenSans-Regular.ttf"),
font_size: 20.,
color: Color::BLACK,
..default()
},
author_style: TextStyle {
font: asset_server.load("fonts/OpenSans-Regular.ttf"),
font_size: 20.,
color: Color::RED,
..default()
},
}
}
Expand Down Expand Up @@ -321,7 +320,6 @@ fn handle_chat_area(

fn setup_ui(
mut commands: Commands,
asset_server: Res<AssetServer>,
_materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(Camera2dBundle::default());
Expand Down Expand Up @@ -385,9 +383,9 @@ fn setup_ui(
text: Text::from_section(
"Send Message!",
TextStyle {
font: asset_server.load("fonts/Staatliches-Regular.ttf"),
font_size: 40.,
font_size: 40.,
color: Color::BLACK,
..default()
},
)
.with_alignment(TextAlignment::Center),
Expand All @@ -412,9 +410,9 @@ fn setup_ui(
text: Text::from_section(
"Connect to server",
TextStyle {
font: asset_server.load("fonts/Staatliches-Regular.ttf"),
font_size: 40.,
color: Color::BLACK,
..default()
},
)
.with_alignment(TextAlignment::Center),
Expand Down

0 comments on commit 78f4f16

Please sign in to comment.