--- a/src/constants.rs +++ b/src/constants.rs @@ -1,4 +1,4 @@ -pub const APP_NAME: &str = "Game"; +pub const APP_NAME: &str = "Tiny Planet Survivor"; pub const PLANET_RADIUS: f32 = 20.; --- a/src/main.rs +++ b/src/main.rs @@ -78,13 +78,24 @@ fn main() { App::new() - .add_plugins(DefaultPlugins.set(AssetPlugin { - // Wasm builds will check for meta files (that don't exist) if this isn't set. - // This causes errors and even panics in web builds on itch. - // See https://github.com/bevyengine/bevy_github_ci_template/issues/48. - meta_check: AssetMetaCheck::Never, - ..default() - })) + .add_plugins( + DefaultPlugins + .set(AssetPlugin { + // Wasm builds will check for meta files (that don't exist) if this isn't set. + // This causes errors and even panics in web builds on itch. + // See https://github.com/bevyengine/bevy_github_ci_template/issues/48. + meta_check: AssetMetaCheck::Never, + ..default() + }) + .set(WindowPlugin { + primary_window: Some(Window { + title: constants::APP_NAME.to_string(), + fit_canvas_to_parent: true, + ..default() + }), + ..default() + }), + ) .add_plugins(( PlanetPlugin, EnemyPlugin, --- a/src/menu/main_menu.rs +++ b/src/menu/main_menu.rs @@ -21,6 +21,8 @@ .with_children(|p| { menu_title(p, constants::APP_NAME); menu_button_widget(p, "Play", MenuButtonAction::Play); + // A web page cannot quit: the button is left out of the browser build. + #[cfg(not(target_arch = "wasm32"))] menu_button_widget(p, "Quit", MenuButtonAction::Quit); }); } --- a/src/menu/pause_menu.rs +++ b/src/menu/pause_menu.rs @@ -27,7 +27,11 @@ .with_children(|p| { menu_title(p, "Paused"); menu_button_widget(p, "Resume", MenuButtonAction::Resume); + // A web page cannot quit: in the browser build the button goes back to the main menu. + #[cfg(not(target_arch = "wasm32"))] menu_button_widget(p, "Quit", MenuButtonAction::Quit); + #[cfg(target_arch = "wasm32")] + menu_button_widget(p, "Quit to Menu", MenuButtonAction::MainMenu); }); }