TanksJS/src/index.js

46 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-04-24 22:52:45 +02:00
// eslint-disable-next-line no-unused-vars
2020-04-20 20:11:45 +02:00
const { ipcRenderer } = require("electron");
2020-04-20 20:11:45 +02:00
var asdf = require("asdf-games");
// eslint-disable-next-line no-unused-vars
const { Game, KeyControls, MouseControls } = asdf;
// TODO: Add more screens
2020-04-20 20:11:45 +02:00
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);
2020-04-24 22:52:45 +02:00
// TODO: Enable resize on release
// ipcRenderer.send("resize", window);
2020-04-20 20:11:45 +02:00
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(() => {
});