diff --git a/game_core/Cargo.toml b/game_core/Cargo.toml index 48018ea667b9e8fd82b056492aa24e7903e1ed9c..268949dafb357ee4661e16be8a906cfcf63bcd92 100644 --- a/game_core/Cargo.toml +++ b/game_core/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [features] default = [] -no-aspect = [] +no_aspect = [] [dependencies] anyhow.workspace = true diff --git a/game_core/src/splash_screen/systems.rs b/game_core/src/splash_screen/systems.rs index c0c90b444e47880b85519218c6e65cd406b6baf4..4054c76c6ae9642b4ef7ab12d58688eebfaa587b 100644 --- a/game_core/src/splash_screen/systems.rs +++ b/game_core/src/splash_screen/systems.rs @@ -9,7 +9,7 @@ use crate::splash_screen::components::{ SplashAnimation, SplashAnimationBundle, SplashAnimationTimer, SplashAnimationType, }; use crate::system::flow::AppState; -use crate::system::load_config::initial_size; +use crate::system::load_config::{initial_size, viewport_size}; use crate::system::utilities::f32_min; use crate::system::window::WindowManager; @@ -49,7 +49,7 @@ pub fn setup_splash_screen( // } // }; - let window_size = initial_size(); + let window_size = viewport_size(); let handle = match handles.images.get("splash") { Some(handle) => handle, diff --git a/game_core/src/system/camera.rs b/game_core/src/system/camera.rs index e7d082bdcd5c13c6ce72ba709c682198d741a04f..992a9874b31455251ff3acc4fc45fac491a67425 100644 --- a/game_core/src/system/camera.rs +++ b/game_core/src/system/camera.rs @@ -8,7 +8,7 @@ use bevy::render::camera::ScalingMode; use iyes_loopless::prelude::AppLooplessStateExt; use crate::system::flow::AppState; -use crate::system::load_config::initial_size; +use crate::system::load_config::{initial_size, viewport_size}; /// A flag component to indicate which entity should be followed by the camera #[derive(Component)] @@ -19,7 +19,7 @@ pub struct GameCamera; /// System that creates a default orthographic camera, with correct tags for querying pub fn spawn_orthographic_camera(mut commands: Commands) { - let (target_width, target_height) = initial_size(); + let (target_width, target_height) = viewport_size(); commands .spawn_bundle(Camera2dBundle { projection: OrthographicProjection { diff --git a/game_core/src/system/load_config.rs b/game_core/src/system/load_config.rs index 8d172b9ab361ff5876a0caefaa900891d4ae7249..5481bd2250cf6d9622f6e0bc0cb558ba311c11a0 100644 --- a/game_core/src/system/load_config.rs +++ b/game_core/src/system/load_config.rs @@ -10,6 +10,11 @@ mod setup { } pub fn initial_size() -> (f32, f32) { + let (w, h) = viewport_size(); + (w * 3.0, h * 3.0) + } + + pub fn viewport_size() -> (f32, f32) { (16.0 * 32.0, 16.0 * 18.0) } } @@ -20,6 +25,10 @@ mod setup { String::from("assets") } + pub fn viewport_size() -> (f32, f32) { + (16.0 * 32.0, 16.0 * 18.0) + } + #[cfg(feature = "no_aspect")] pub fn initial_size() -> (f32, f32) { static default_width: f32 = 16.0 * 32.0; diff --git a/game_core/src/system/resources.rs b/game_core/src/system/resources.rs index 9ac587c915a74e3e59a82e30393655786d1701c4..cab2bb41f4b06c203ba2eafed356374142e0d811 100644 --- a/game_core/src/system/resources.rs +++ b/game_core/src/system/resources.rs @@ -11,8 +11,8 @@ impl Plugin for DefaultResourcesPlugin { let (width, height) = initial_size(); app.insert_resource(WindowDescriptor { - width: width * 3.0, - height: height * 3.0, + width, + height, resizable: true, title: String::from("Ludum Dare 51"), present_mode: PresentMode::AutoNoVsync,