Fixing loading logo being displayed when nothing was loaded

This commit is contained in:
David Négrier 2021-02-09 12:41:35 +01:00
parent adb535d1b6
commit 969c9fd544
5 changed files with 14 additions and 8 deletions

View file

@ -6,6 +6,10 @@ const LogoResource: string = 'resources/logos/logo.png';
const LogoFrame: ImageFrameConfig = {frameWidth: 307, frameHeight: 59};
export const addLoader = (scene: Phaser.Scene): void => {
// If there is nothing to load, do not display the loader.
if (scene.load.list.entries.length === 0) {
return;
}
let loadingText: Phaser.GameObjects.Text|null = null;
const loadingBarWidth: number = Math.floor(scene.game.renderer.width / 3);
const loadingBarHeight: number = 16;