TanksJS/src/index.js

40 lines
956 B
JavaScript
Raw Normal View History

2020-04-20 20:11:45 +02:00
const { ipcRenderer } = require("electron");
var asdf = require("asdf-games");
// eslint-disable-next-line no-unused-vars
const { Game, KeyControls, MouseControls } = asdf;
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);
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(() => {
});