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

Add fullscreen video background

This commit is contained in:
tobspr
2020-05-12 09:56:11 +02:00
parent da64a46ad8
commit 7036a4ac95
6 changed files with 71 additions and 19 deletions

View File

@@ -66,7 +66,7 @@ export const globalConfig = {
debug: {
/* dev:start */
fastGameEnter: true,
fastGameEnter: false,
noArtificialDelays: true,
disableSavegameWrite: false,
showEntityBounds: false,

View File

@@ -9,15 +9,20 @@ export class MainMenuState extends GameState {
getInnerHTML() {
return `
<video autoplay muted loop class="fullscreenBackgroundVideo">
<source src="${cachebust("res/bg_render.webm")}" type="video/webm">
</video>
<div class="logo">
<img src="${cachebust("res/logo.png")}" alt="shapez.io Logo">
</div>
<div class="betaWarning">
This game is still under development - Please report any issues!
</div>
<div class="mainContainer">
<div class="betaWarning">
This game is still in BETA - Please report any issues!
</div>
<button class="playButton styledButton">Play</button>
</div>
@@ -53,6 +58,17 @@ export class MainMenuState extends GameState {
if (G_IS_DEV && globalConfig.debug.fastGameEnter) {
this.onPlayButtonClicked();
}
// Initialize video
this.videoElement = this.htmlElement.querySelector("video");
if (this.videoElement) {
this.videoElement.playbackRate = 0.9;
this.videoElement.addEventListener("canplay", () => {
if (this.videoElement) {
this.videoElement.classList.add("loaded");
}
});
}
}
onPlayButtonClicked() {