So far, we've created an Electron window that's 800 x 600 pixels in size. We also initialized a Phaser game with the same size parameters. If you don't want to deal with scaling and resizing and want to restrict the size of the screen, you can do so in the main.js file:
const { app, BrowserWindow } = require('electron');
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
},
resizable: false
});
win.loadFile('index.html');
}
app.on('ready', createWindow);
You can always disable this option later and adopt the game in multiple screen sizes. Now, let's create a spaceship sprite.