diff --git a/src/base_game.rs b/src/base_game.rs index a7f90cd..d994c14 100644 --- a/src/base_game.rs +++ b/src/base_game.rs @@ -7,6 +7,7 @@ pub struct BaseGamePlugin { pub title: String, pub name: String, pub game_type: GameType, + pub window: Option, } pub enum GameType { @@ -20,6 +21,7 @@ impl Default for BaseGamePlugin { title: "My Game".into(), name: "mygame".into(), game_type: GameType::Three, + window: None, } } } @@ -32,7 +34,7 @@ impl Plugin for BaseGamePlugin { primary_window: Some(Window { fit_canvas_to_parent: true, canvas: Some(format!("#{}-canvas", self.name)), - ..default() + ..self.window.clone().unwrap_or_default() }), ..default() }) diff --git a/src/bin/flappy/main.rs b/src/bin/flappy/main.rs index 38bb53c..d8507e1 100644 --- a/src/bin/flappy/main.rs +++ b/src/bin/flappy/main.rs @@ -3,6 +3,7 @@ use bevy::image::{ImageLoaderSettings, ImageSampler}; use bevy::render::view::ColorGrading; +use bevy::window::WindowResolution; use games::physics2d::*; use games::*; use std::hash::BuildHasher; @@ -15,6 +16,7 @@ fn main() { title: "flappy bird (with rewind)".into(), name: "flappy".into(), game_type: GameType::Two, + window: Some(Window { resolution: WindowResolution::new(360.0, 640.0), ..default() }) }, Physics2dPlugin, )) @@ -733,7 +735,7 @@ fn init_ui(mut commands: Commands, server: Res) { ( Text::new("Rewind!\n(Hold R)"), TextColor(BLACK.into()), - TextFont::from_font_size(30.0), + TextFont::from_font_size(20.0), TextLayout::new_with_justify(JustifyText::Center) ), ], @@ -765,7 +767,7 @@ fn init_ui(mut commands: Commands, server: Res) { ( Text::new("Flap!\n(Spacebar)"), TextColor(BLACK.into()), - TextFont::from_font_size(30.0), + TextFont::from_font_size(20.0), TextLayout::new_with_justify(JustifyText::Center) ), ( diff --git a/web/flappy.html b/web/flappy.html index 79e8a89..6113efa 100644 --- a/web/flappy.html +++ b/web/flappy.html @@ -1,7 +1,7 @@ - +