forked from galsjel/RuneScape-317
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
83 lines (78 loc) · 2.87 KB
/
index.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
<title>Main page</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script type="text/javascript" charset="utf-8" src="js/timidity.js"></script>
<script type="text/javascript" charset="utf-8" src="js/gaintimidity.js"></script>
<script type="text/javascript" charset="utf-8" src="js/m4.js"></script>
<script type="text/javascript" charset="utf-8" src="js/howler.min.js"></script>
<script type="text/javascript" charset="utf-8" src="target/javascript/classes.js"></script>
<script type="text/javascript" charset="utf-8" src="js/idb-filestore.js"></script>
<script type="text/javascript" charset="utf-8" src="js/config.js"></script>
<style type="text/css">
.pointer {cursor: pointer;}
.dir {cursor: pointer;}
.file {cursor: pointer;}
.game {
margin: 5px;
}
#startGame {
width:125px;
}
fieldset{
width: 250px;
}
</style>
</head>
<body>
<canvas id="web-client" class="game pointer" width="765" height="503" tabindex="-1" style="float:left"></canvas>
<fieldset>
<legend>FileSystem</legend>
<label for="file-update-interval">Update:</label>
<input type="number" value="100" min="100" id="file-update-interval"
style="width:5em;"/>
ms
<table border="1" id="file-view">
<tr>
<th colspan="3" data-id="file-refresh" class="pointer" title="Click to refresh"><span
id="file-id">/</span></th>
</tr>
<tr>
<th>Name</th>
<th>Type</th>
<th>Size</th>
</tr>
</table>
</fieldset>
<script type="text/javascript">
canvas = document.getElementById("web-client");
let font = "Helvetica";
let width = canvas.width;
let height = canvas.height;
canvas.onclick = init;
ctx = canvas.getContext("2d");
ctx.fillColor = "black";
ctx.fillRect(0,0, width, height);
ctx.fillStyle = "white";
ctx.textAlign = "center";
ctx.font = "15pt " + font;
ctx.fillText("Click here to load the game!", width / 2, height / 2);
ctx.font = "10px " + font;
ctx.fillText("(To play audio from JavaScript you have to have had a user interact with the webpage in some way)", width / 2, height - 12);
ctx.textAlign = "start";
canvas.addEventListener('resize', data =>{
console.log("This is an example resize event!");
});
//User input is required for audio to play on a webpage, so we require them to press a button to start the game
function init(){
canvas.onclick = undefined;
canvas.classList.remove("pointer");
//replace the canvas with a new one, allows us to use a different rendering context later (if we want to)
let newCanvas = canvas.cloneNode();
canvas.parentNode.replaceChild(newCanvas, canvas);
main();
}
</script>
</body>
</html>