'use strict'; /* eslint-disable no-unused-vars */ /* eslint-disable no-console */ import PhaserEngine from './controller/phaser-engine'; function startGame() { console.log('start Game'); let phaserEngine = new PhaserEngine(); phaserEngine.start(); } let app = { // Application Constructor initialize: function () { console.log('app initialize'); document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); }, // deviceready Event Handler // // Bind any cordova events here. Common events are: // 'pause', 'resume', etc. onDeviceReady: function () { this.receivedEvent('deviceready'); startGame(); }, // Update DOM on a Received Event receivedEvent: function (id) { var parentElement = document.getElementById(id); var listeningElement = parentElement.querySelector('.listening'); var receivedElement = parentElement.querySelector('.received'); listeningElement.setAttribute('style', 'display:none;'); receivedElement.setAttribute('style', 'display:block;'); console.log('Received Event: ' + id); } }; console.log('cordova :', process.env.CORDOVA ); if (process.env.CORDOVA) { app.initialize(); } else { startGame(); } // const config = { // type: Phaser.AUTO, // parent: "phaser-example", // width: 800, // height: 600, // scene: { // preload: preload, // create: create // } // }; // const game = new Phaser.Game(config); // function preload() { // this.load.image("logo", logoImg); // } // function create() { // const logo = this.add.image(400, 150, "logo"); // this.tweens.add({ // targets: logo, // y: 350, // duration: 2000, // ease: "Power2", // yoyo: true, // loop: -1 // }); // }