Add title screen
Multi-language support
This commit is contained in:
20
menu.js
Normal file
20
menu.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// const canvas = document.getElementById("tetris");
|
||||
// const context = canvas.getContext('2d');
|
||||
|
||||
window.onresize = function (event) {
|
||||
scaleWindow();
|
||||
};
|
||||
|
||||
function scaleWindow() {
|
||||
canvas.height = window.innerHeight - 40;
|
||||
canvas.width = canvas.height / (5 / 3);
|
||||
context.scale(canvas.width / fieldSize.x, canvas.height / fieldSize.y);
|
||||
}
|
||||
|
||||
scaleWindow();
|
||||
|
||||
document.getElementById("game-play").addEventListener("click", (event) => {
|
||||
document.getElementById("game-title").parentNode.removeChild(document.getElementById("game-title"));
|
||||
document.getElementById("game-play").parentNode.removeChild(document.getElementById("game-play"));
|
||||
startGame();
|
||||
});
|
Reference in New Issue
Block a user