diff --git a/examples/window/expanding_window.rs b/examples/window/expanding_window.rs index f8f856e56903c8..968039c3480d0e 100644 --- a/examples/window/expanding_window.rs +++ b/examples/window/expanding_window.rs @@ -1,19 +1,27 @@ use bevy::prelude::*; +const MAX_WIDTH: f32 = 400.; +const MAX_HEIGHT: f32 = 400.; + fn main() { App::new() .insert_resource(WindowDescriptor { - width: 200., - height: 200., + width: MAX_WIDTH, + height: MAX_HEIGHT, scale_factor_override: Some(1.), ..Default::default() }) .add_plugins(DefaultPlugins) .insert_resource(Phase::ContractingY) .add_system(change_window_size) + .add_startup_system(setup) .run(); } +fn setup(mut commands: Commands) { + commands.spawn_bundle(OrthographicCameraBundle::new_3d()); +} + enum Phase { ContractingY, ContractingX, @@ -41,13 +49,13 @@ fn change_window_size(mut windows: ResMut, mut phase: ResMut) { primary.set_resolution((width - 4.).max(0.0), height) } Phase::ExpandingY => { - if height >= 200. { + if height >= MAX_HEIGHT { *phase = ExpandingX; } primary.set_resolution(width, height + 4.) } Phase::ExpandingX => { - if width >= 200. { + if width >= MAX_WIDTH { *phase = ContractingY; } primary.set_resolution(width + 4., height)