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

const GameConfig: Phaser.Types.Core.GameConfig = {
  title: 'ExampleGame',
  version: '2.0',
  width: 800,
  height: 600,
  type: Phaser.AUTO,
  parent: 'app',
  // `as as Phaser.Types.Scenes.SettingsConfig[]` is required until https://github.com/photonstorm/phaser/pull/6235
  scene: [MainMenuScene] as Phaser.Types.Scenes.SettingsConfig[],
  input: {
    keyboard: true
  },
  physics: {
    default: 'arcade',
    arcade: {
      debug: false
    }
  },
  backgroundColor: '#300000',
  render: { pixelArt: false, antialias: false },
  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 {
  //parent: string = ''
  //phaserGame: Phaser.Game | null = null

  //constructor(parent: string) {
  //  this.parent = parent ?? 'game'
  //}

  /*start() {
    this.phaserGame = new Phaser.Game({
      type: Phaser.AUTO,
      parent: this.parent,
      width: 800,
      height: 600,
      backgroundColor: 'rgba(80, 80, 80, 0)',
      scene: [MainMenuScene],
    })
    return this.phaserGame
  }*/
  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;