forked from JoSSte/BackgammonJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackgammonCanvas.html
57 lines (49 loc) · 1.53 KB
/
BackgammonCanvas.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset="utf-8" />
<title>Backgammon</title>
<style>
/* common styles */
.boardLayer {
position: absolute;
left: 0;
top: 0;
width: 100%;
}
#bgBoard {
border: 1px solid black;
z-index: 0;
}
#bgPieceLayer {
z-index: 1;
}
#bgDiceLayer {
z-index: 2;
}
#possibleMovesLayer {
z-index: 3;
}
.hidden {
display: none;
}
</style>
</head>
<body>
<button onclick="drawBoard()">Redraw Board</button>
<button onclick="resetBoard()">Reset Board</button>
<button onclick="hideMoves()">Toggle Possible Moves</button>
<button onclick="roll()" disabled>Roll dice</button>
<input type="number" id="d1" min="1" max="6" value="2">
<input type="number" id="d2" min="1" max="6" value="3">
<input type="radio" id="white" name="currPlayer" value="white" checked><label for="white">White</label>
<input type="radio" id="black" name="currPlayer" value="black"><label for="black">Black</label>
<div style="position: relative;">
<canvas class="boardLayer" id="bgBoard"></canvas>
<canvas class="boardLayer" id="bgPieceLayer"></canvas>
<canvas class="boardLayer hidden" id="possibleMovesLayer"></canvas>
<canvas class="boardLayer hidden" id="bgDiceLayer"></canvas>
</div>
<script src="backgammonCanvas.js"></script>
</body>
</html>