TanksJS/src/index.js

46 lines
1.0 KiB
JavaScript

// eslint-disable-next-line no-unused-vars
const { ipcRenderer } = require("electron");
var asdf = require("asdf-games");
// eslint-disable-next-line no-unused-vars
const { Game, KeyControls, MouseControls } = asdf;
// TODO: Add more screens
const
//Logo = require(__dirname + "/../src/screens/logo.js"),
//Title = require(__dirname + "/../src/screens/title.js"),
GameScreen = require(__dirname + "/../src/screens/game.js")
//Gameover = require(__dirname + "/../src/screens/gameover.js")
;
const window = { w: 740, h: 480 };
var game = new Game(window.w, window.h, true);
// TODO: Enable resize on release
// ipcRenderer.send("resize", window);
const controls = {
keys: new KeyControls(),
mouse: new MouseControls(game.renderer.view)
};
// function titleScreen() {
// game.scene = new Title(game, keys, newGame, tutorial, remote.app.quit);
// }
function gameOver() {
//game.scene = new Gameover(game, keys, titleScreen);
}
function newGame() {
game.scene = new GameScreen(game, controls, gameOver);
}
newGame();
game.run(() => {
});