1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Prepare standalone build

This commit is contained in:
tobspr
2020-05-21 13:05:21 +02:00
parent 8dd3a7c748
commit 58442eaeec
23 changed files with 1436 additions and 46 deletions

View File

@@ -33,10 +33,22 @@ export class MainMenuState extends GameState {
return `
<button class="settingsButton"></button>
${
G_IS_STANDALONE
? `
<button class="exitAppButton"></button>
`
: ""
}
<video autoplay muted loop class="fullscreenBackgroundVideo">
${
G_IS_STANDALONE
? ""
: `<video autoplay muted loop class="fullscreenBackgroundVideo">
<source src="${cachebust("res/bg_render.webm")}" type="video/webm">
</video>
</video>`
}
<div class="logo">
@@ -184,6 +196,11 @@ export class MainMenuState extends GameState {
}
this.trackClicks(qs(".settingsButton"), this.onSettingsButtonClicked);
if (G_IS_STANDALONE) {
this.trackClicks(qs(".exitAppButton"), this.onExitAppButtonClicked);
}
this.renderSavegames();
const steamLinks = this.htmlElement.querySelectorAll(".steamLink");
@@ -199,6 +216,10 @@ export class MainMenuState extends GameState {
return false;
}
onExitAppButtonClicked() {
this.app.platformWrapper.exitApp();
}
renderSavegames() {
const oldContainer = this.htmlElement.querySelector(".mainContainer .savegames");
if (oldContainer) {

View File

@@ -100,6 +100,13 @@ export class PreloadState extends GameState {
return this.app.settings.initialize();
})
.then(() => {
// Initialize fullscreen
if (this.app.platformWrapper.getSupportsFullscreen()) {
this.app.platformWrapper.setFullscreen(this.app.settings.getIsFullScreen());
}
})
.then(() => this.setStatus("Initializing sounds"))
.then(() => {
// Notice: We don't await the sounds loading itself