// import * as MiniGame from "mini-game";
import * as Phaser from "phaser";
import MainMenuScene from "./scenes/main-menu";
import BootScene from "./scenes/boot";
import PreloaderScene from "./scenes/preloader";

const GameConfig: Phaser.Types.Core.GameConfig = {
  title: 'SilverFangMiniGame',
  version: '2.0',
  width: 1080 / 2,
  height: 1920 / 2,
  type: Phaser.AUTO,
  parent: 'silver-fang-mini-game',
  // `as as Phaser.Types.Scenes.SettingsConfig[]` is required until https://github.com/photonstorm/phaser/pull/6235
  scene: [
    BootScene,
    PreloaderScene,
    MainMenuScene,
  ] as Phaser.Types.Scenes.SettingsConfig[],
  input: {
    keyboard: true
  },
  physics: {
    default: 'arcade',
    arcade: {
      debug: false
    }
  },
  backgroundColor: '#AAA',
  render: { pixelArt: false, antialias: true },
  scale: {
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH,
    // `fullscreenTarget` must be defined for phones to not have
    // a small margin during fullscreen.
    fullscreenTarget: 'app',
    expandParent: false,
  },
};

class Game extends Phaser.Game {
  constructor(config: Phaser.Types.Core.GameConfig) {

    super({ ...GameConfig, ...config });
  }
}

/*window.addEventListener('load', () => {
  // Expose `_game` to allow debugging, mute button and fullscreen button
  (window as any)._game = new Game(GameConfig);
});*/

export default Game;