-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
42 lines (40 loc) · 1.31 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function StartGame(game) {
let main = document.getElementsByTagName('main');
switch (game) {
case "tictactoe":
main[0].innerHTML = getHTMLGameTicTacToe();
StartTicTacToeGame();
break;
case "snake":
main[0].innerHTML = getHTMLGameSnake();
StartSnakeGame();
break;
default:
main[0].innerHTML = "<h1>Nenhum jogo encontrado!</h1>";
break;
}
}
function getHTMLGameTicTacToe() {
return "<canvas id='canvas-tictactoe'></canvas>" +
"<aside>" +
"<div class='detalhe'>" +
"<div>" +
"<h3 class='detalhe-titulo'>Turno</h3>" +
"<span class='turno'></span>" +
"</div>" +
"<div>" +
"<h3 class='detalhe-titulo'>Placar</h3>" +
"<span id='placarX' class='placar'>Jogador X: 0</span>" +
"<span id='placarO' class='placar'>Jogador O: 0</span>" +
"<span id='placarEmpate' class='placar'>Empates: 0</span>" +
"</div>" +
"</div>" +
"<div>" +
"<h3 class='detalhe-titulo'>Histórico</h3>" +
"<ul></ul>" +
"</div>" +
"</aside>";
}
function getHTMLGameSnake() {
return "<canvas id='canvas-snake'></canvas>";
}