Skip to content

Commit 0d21fb5

Browse files
committed
upgrade to bevy 0.12
1 parent 40da51b commit 0d21fb5

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
- `LShift` -> `ShiftLeft`
2020
- `LWin` -> `SuperLeft`
2121
- `RWin` -> `SuperRight`
22-
22+
2323

2424
### Improved
2525

26-
- Update bevy from 0.8 to 0.11
27-
- Update bevy_prototype_lyon from 0.6 to 0.9
26+
- Update bevy from 0.8 to 0.12
27+
- Update bevy_prototype_lyon from 0.6 to 0.10
2828
- Update ron from 0.7 to 0.8
2929
- Fixed some inconsistent parameter names in examples
3030
- Some examples' audio was turned down lower

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exclude = [
2121
]
2222

2323
[dependencies]
24-
bevy = { version = "0.11.3", default-features = false, features = [
24+
bevy = { version = "0.12.1", default-features = false, features = [
2525
"bevy_audio",
2626
"bevy_gilrs",
2727
"bevy_gltf",
@@ -34,7 +34,7 @@ bevy = { version = "0.11.3", default-features = false, features = [
3434
"x11",
3535
"vorbis",
3636
] }
37-
bevy_prototype_lyon = "0.9.0"
37+
bevy_prototype_lyon = "0.10.0"
3838
ron = "0.8"
3939
serde = { version = "1.0", features = [ "derive" ] }
4040

src/audio.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,8 @@ pub fn queue_managed_audio_system(
242242
mut game_state: ResMut<Engine>,
243243
) {
244244
for (sfx, volume) in game_state.audio_manager.sfx_queue.drain(..) {
245-
let sfx_path = format!("audio/{}", sfx);
246245
commands.spawn(AudioBundle {
247-
source: asset_server.load(sfx_path.as_str()),
246+
source: asset_server.load(format!("audio/{}", sfx)),
248247
settings: PlaybackSettings {
249248
mode: PlaybackMode::Despawn,
250249
volume: Volume::new_relative(volume),
@@ -261,10 +260,9 @@ pub fn queue_managed_audio_system(
261260
}
262261
// start the new music...if we have some
263262
if let Some((music, volume)) = item {
264-
let music_path = format!("audio/{}", music);
265263
let entity = commands
266264
.spawn(AudioBundle {
267-
source: asset_server.load(music_path.as_str()),
265+
source: asset_server.load(format!("audio/{}", music)),
268266
settings: PlaybackSettings {
269267
volume: Volume::new_relative(volume),
270268
mode: PlaybackMode::Loop,

src/game.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn add_collider_lines(commands: &mut Commands, sprite: &mut Sprite) {
170170
.spawn((
171171
ShapeBundle {
172172
path: GeometryBuilder::new().add(&line).build(),
173-
transform,
173+
spatial: SpatialBundle::from_transform(transform),
174174
..Default::default()
175175
},
176176
Stroke::new(Color::WHITE, 1.0 / transform.scale.x),
@@ -220,7 +220,7 @@ pub fn add_texts(commands: &mut Commands, asset_server: &Res<AssetServer>, engin
220220
text: BevyText::from_section(
221221
text_string,
222222
TextStyle {
223-
font: asset_server.load(font_path.as_str()),
223+
font: asset_server.load(font_path),
224224
font_size,
225225
color: Color::WHITE,
226226
},
@@ -307,6 +307,8 @@ impl<S: Resource + Send + Sync + 'static> Game<S> {
307307
pub fn run(&mut self, initial_game_state: S) {
308308
self.app.insert_resource::<S>(initial_game_state);
309309
self.app
310+
// TODO: Remove this to use the new, darker default color once the videos have been remastered
311+
.insert_resource(ClearColor(Color::rgb(0.4, 0.4, 0.4)))
310312
// Built-ins
311313
.add_plugins(
312314
DefaultPlugins
@@ -386,7 +388,7 @@ fn game_logic_sync<S: Resource + Send + Sync + 'static>(
386388

387389
// Copy all collision events over to the engine to give to users
388390
engine.collision_events.clear();
389-
for collision_event in collision_events.iter() {
391+
for collision_event in collision_events.read() {
390392
engine.collision_events.push(collision_event.clone());
391393
}
392394

@@ -478,7 +480,7 @@ fn game_logic_sync<S: Resource + Send + Sync + 'static>(
478480
if text.font_size != bevy_text_component.sections[0].style.font_size {
479481
bevy_text_component.sections[0].style.font_size = text.font_size;
480482
}
481-
let font = asset_server.load(text.font.as_str());
483+
let font = asset_server.load(text.font.clone());
482484
if bevy_text_component.sections[0].style.font != font {
483485
bevy_text_component.sections[0].style.font = font;
484486
}

src/keyboard.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn sync_keyboard_events(
2424
engine.keyboard_events.clear();
2525

2626
// Populate this frame's events
27-
for event in keyboard_input_events.iter() {
27+
for event in keyboard_input_events.read() {
2828
engine.keyboard_events.push(event.clone());
2929
}
3030
}

src/mouse.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,23 @@ fn sync_mouse_events(
191191
game_state.mouse_wheel_events.clear();
192192

193193
// Populate this frame's events
194-
for ev in mouse_button_events.iter() {
194+
for ev in mouse_button_events.read() {
195195
game_state.mouse_button_events.push(ev.clone());
196196
}
197-
for ev in cursor_moved_events.iter() {
197+
for ev in cursor_moved_events.read() {
198198
let mut new_event = ev.clone();
199199
// Convert from screen space to game space
200200
// TODO: Check to see if this needs to be adjusted for different DPIs
201201
new_event.position.x -= game_state.window_dimensions.x * 0.5;
202202
new_event.position.y = -new_event.position.y + (game_state.window_dimensions.y * 0.5);
203203
game_state.mouse_location_events.push(new_event);
204204
}
205-
for ev in mouse_motion_events.iter() {
205+
for ev in mouse_motion_events.read() {
206206
let mut ev2 = ev.clone();
207207
ev2.delta.y *= -1.0;
208208
game_state.mouse_motion_events.push(ev2.clone());
209209
}
210-
for ev in mouse_wheel_events.iter() {
210+
for ev in mouse_wheel_events.read() {
211211
game_state.mouse_wheel_events.push(ev.clone());
212212
}
213213
}
@@ -223,7 +223,7 @@ fn sync_mouse_state(
223223
) {
224224
// Sync the current mouse location, which will be the last cursor_moved event that occurred.
225225
// Only changes when we get a new event, otherwise we preserve the last location.
226-
if let Some(event) = cursor_moved_events.iter().last() {
226+
if let Some(event) = cursor_moved_events.read().last() {
227227
// Convert from bevy's window space to our game space
228228
let mut location = event.position.clone();
229229
location.x -= game_state.window_dimensions.x * 0.5;
@@ -232,7 +232,7 @@ fn sync_mouse_state(
232232
}
233233
// Sync the relative mouse motion. This is the cumulative relative motion during the last frame.
234234
mouse_state.motion = Vec2::ZERO;
235-
for ev in mouse_motion_events.iter() {
235+
for ev in mouse_motion_events.read() {
236236
// Convert motion to game space direction (positive y is up, not down)
237237
// TODO: Check to see if this needs to be adjusted for different DPIs
238238
let mut ev2 = ev.clone();
@@ -243,7 +243,7 @@ fn sync_mouse_state(
243243
mouse_state.wheel = MouseWheelState::default();
244244
let mut cumulative_x = 0.0;
245245
let mut cumulative_y = 0.0;
246-
for ev in mouse_wheel_events.iter() {
246+
for ev in mouse_wheel_events.read() {
247247
cumulative_x += ev.x;
248248
cumulative_y += ev.y;
249249
}

0 commit comments

Comments
 (0)