Skip to content

Commit

Permalink
Improve chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Dec 27, 2024
1 parent b06d4e6 commit 7277f32
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/chapters/add_player_sprite.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ fn main() {
let initial_player_size = Vec2::new(64.0, 32.0);
let mut app = create_app(initial_player_position, initial_player_size);
let add_camera_fn = |mut commands: Commands| {
commands.spawn(Camera2d::default());
commands.spawn(Camera2d);
};
app.add_systems(Startup, add_camera_fn);
app.add_plugins(DefaultPlugins);
Expand Down
2 changes: 1 addition & 1 deletion docs/chapters/add_player_sprite_with_texture.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn create_app() -> App {
if cfg!(test) {
app.add_plugins(AssetPlugin::default());
app.add_plugins(TaskPoolPlugin::default());
app.init_asset::<bevy::render::texture::Image>();
app.init_asset::<bevy::image::Image>();
}
app.add_systems(Startup, add_player);

Expand Down
2 changes: 1 addition & 1 deletion docs/chapters/add_text.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fn main() {
let text = String::from("Hello from main");
let mut app = create_app(text);
let add_camera_fn = |mut commands: Commands| {
commands.spawn(Camera2d::default());
commands.spawn(Camera2d);
};
app.add_systems(Startup, add_camera_fn);
app.add_plugins(DefaultPlugins);
Expand Down
2 changes: 1 addition & 1 deletion docs/chapters/move_player.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn main() {
let velocity = Vec2::new(0.2, 0.1);
let mut app = create_app(velocity);
let add_camera_fn = |mut commands: Commands| {
commands.spawn(Camera2d::default());
commands.spawn(Camera2d);
};
app.add_systems(Startup, add_camera_fn);
app.add_plugins(DefaultPlugins);
Expand Down
2 changes: 1 addition & 1 deletion docs/chapters/move_player_with_keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This chapter introduces:
fn main() {
let mut app = create_app();
let add_camera_fn = |mut commands: Commands| {
commands.spawn(Camera2d::default());
commands.spawn(Camera2d);
};
app.add_systems(Startup, add_camera_fn);

Expand Down
2 changes: 1 addition & 1 deletion docs/chapters/move_player_with_mouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn test_player_responds_to_mouse_wheel_turn() {
fn main() {
let mut app = create_app();
let add_camera_fn = |mut commands: Commands| {
commands.spawn(Camera2d::default());
commands.spawn(Camera2d);
};
app.add_systems(Startup, add_camera_fn);
app.add_plugins(DefaultPlugins);
Expand Down
4 changes: 2 additions & 2 deletions docs/chapters/respond_to_window_resize.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ Results in:

```rust
fn respond_to_window_resize(
mut q: Query<&mut Text>,
mut q: Query<&mut Text2d>,
mut resize_reader: EventReader<bevy::window::WindowResized>,
) {
let mut text = q.single_mut();
for e in resize_reader.read() {
text.sections[0].value = format!("{:.1} x {:.1}", e.width, e.height);
text.0 = format!("{:.1} x {:.1}", e.width, e.height);
}
}
```
Expand Down

0 comments on commit 7277f32

Please sign in to comment.