Skip to content
Snippets Groups Projects
Verified Commit abe81e44 authored by Louis's avatar Louis :fire:
Browse files

Fix web resolution

parent f02f96a1
No related branches found
No related tags found
No related merge requests found
Pipeline #178 passed with stages
in 3 minutes and 9 seconds
......@@ -7,7 +7,7 @@ edition = "2021"
[features]
default = []
no-aspect = []
no_aspect = []
[dependencies]
anyhow.workspace = true
......
......@@ -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,
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment