var game;
var DEBUG = false;
var MAX_SCREEN_X = 1280;
var MAX_SCREEN_Y = 800;
var SCREEN_X = 960;
var SCREEN_Y = 600;

function minit() {
    game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
    game.scale.setShowAll();
    game.scale.refresh();
}

mLog('**** creating environnement ****');
game = new Phaser.Game(MAX_SCREEN_X, MAX_SCREEN_Y, Phaser.AUTO, '', { init: minit, preload: onPreload, create: onCreate, update: onUpdate, resize: onResize});

mLog('**** end of creating environnement ****');

function onPreload() {console.log('preload');}

function onCreate() {
    game.state.add('Menu', Menu);

    // Adding the Game state.
    game.state.add('GameMgr', GameMgr);
    game.state.add('LoadingScreen', loadingScreen);
    game.state.add('BootState', bootState);
}

function onUpdate() {
    mLog('Démarrage du jeu Dragon vs Archers');
    game.state.start('BootState');
}

function onResize() {
    game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
    game.scale.setShowAll();
    game.scale.refresh();
}