From e31d49c9d2943721f10f389c35819e623c682b57 Mon Sep 17 00:00:00 2001 From: Lqxc <55340837+lovebaihezi@users.noreply.github.com> Date: Thu, 14 Nov 2024 01:21:23 -0500 Subject: [PATCH] fixup: game full screen on Web (#37) --- src/game_logic.rs | 6 ++++++ src/main.rs | 11 ++++++++++- web/index.html | 33 +++++++++++++++++++++++++-------- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/game_logic.rs b/src/game_logic.rs index 02e56de..22f96fc 100644 --- a/src/game_logic.rs +++ b/src/game_logic.rs @@ -62,3 +62,9 @@ pub fn reset_game( } } } + +#[cfg(test)] +mod game_logic_test { + #[test] + fn time_paused_on() {} +} diff --git a/src/main.rs b/src/main.rs index 0f53ade..adce07c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,17 @@ use dinosaur::{ }; fn main() { + let default_plugin = DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + title: "Dinosaur Game".to_string(), + canvas: Some("#game".to_string()), + fit_canvas_to_parent: true, + ..Default::default() + }), + ..Default::default() + }); let exit = App::new() - .add_plugins((DefaultPlugins, FrameTimeDiagnosticsPlugin)) + .add_plugins((default_plugin, FrameTimeDiagnosticsPlugin)) .insert_resource(GameStatus { speed: 5, score: 0 }) .insert_resource(ClearColor(Color::srgb(1.0, 1.0, 1.0))) .add_systems( diff --git a/web/index.html b/web/index.html index ef38060..7496607 100644 --- a/web/index.html +++ b/web/index.html @@ -25,19 +25,36 @@ +