38 lines
1.6 KiB
HTML
38 lines
1.6 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="snake.js" type="application/javascript"></script>
|
|
</head>
|
|
<body>
|
|
<h1>Snake</h1>
|
|
<label>Rows</label>
|
|
<input id=rows type=text placeholder="Rows" value=20>
|
|
<label>Columns</label>
|
|
<input id=cols type=text placeholder="Columns" value=20>
|
|
<label>Speed (higher = faster)</label>
|
|
<input id=fps type=text placeholder="Speed (higher = faster)" value=10>
|
|
<input id=reset type=button value="Apply">
|
|
|
|
<br/>
|
|
<canvas id=gameCanvas width=600 height=600></canvas>
|
|
|
|
<script type="application/javascript">
|
|
var canvas = document.getElementById("gameCanvas");
|
|
var resetButton = document.getElementById("reset");
|
|
|
|
Snake.initialize({ canvas: canvas,
|
|
keyContext: window,
|
|
rows: parseInt(document.getElementById("rows").value),
|
|
cols: parseInt(document.getElementById("cols").value),
|
|
fps: parseInt(document.getElementById("fps").value)});
|
|
|
|
resetButton.onclick = function() {
|
|
Snake.initialize({ canvas: canvas,
|
|
keyContext: window,
|
|
rows: parseInt(document.getElementById("rows").value),
|
|
cols: parseInt(document.getElementById("cols").value),
|
|
fps: parseInt(document.getElementById("fps").value)}); };
|
|
</script>
|
|
</body>
|
|
</html>
|