Phaser.js + Electron Framework. Почему не работает?

300
13 февраля 2017, 13:44

Пытаюсь подключить фреймворк phaser.js к electron, для создания desktop-игры на html5. Не работает код из файла renderer.js. Phaser в консоли показывает, что его инициализация была успешна.

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Game</title>
    <link rel="stylesheet" href="style.css">
    <script>require('./phaser/v3/src/phaser.js')</script>
    <script>require('./renderer.js')</script>
  </head>
  <body>
  </body>
</html>

renderer.js

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
function preload() {
    game.load.image('Conquest', 'assets/Conquest.png');
}
function create() {
    game.add.sprite(0, 0, 'Conquest');
}
function update() {
    game.add.sprite(0, 0, 'Conquest');
    console.log('update');
}

main.js

const electron = require('electron')
const app = electron.app
const Menu = electron.Menu
const {dialog} = require('electron')
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = require('url')
let mainWindow
function createWindow() {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  })
  mainWindow.loadURL(url.format({
    pathname: path.join(__dirname, 'index.html'),
    protocol: 'file:',
    slashes: true,
    webPreferences: { nodeIntegration: false }
  }))
  mainWindow.webContents.openDevTools()
  mainWindow.on('closed', function () {
    mainWindow = null
  })
  mainWindow.setMenu(null)
  mainWindow.maximize()
}
app.on('ready', createWindow)

app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})
app.on('activate', function () {  if (mainWindow === null) {
    createWindow()
  }
})
READ ALSO
Как получить ответ от приложения в командной строке cmd?

Как получить ответ от приложения в командной строке cmd?

Например пишем C:\appexe /h жмем Enter и получаем ответ "Команда выполнена"

447
Переход на другую версию Visual Studio, INotifyPropertyChanged

Переход на другую версию Visual Studio, INotifyPropertyChanged

Добрый день, пользовался VS2016Сейчас решил перейти на версию 2013, открыл проект на 2013 версии, мне начало выдавать ошибки при работе с INotifyPropertyChanged:

409