-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtemplate.html
More file actions
65 lines (61 loc) · 1.66 KB
/
Copy pathtemplate.html
File metadata and controls
65 lines (61 loc) · 1.66 KB
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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Ruby 2D</title>
<style>
body {
font-family: system-ui;
}
hr {
border: none;
height: 3px;
margin: 15px 0;
background-color: lightgray;
}
#canvas {
display: block;
margin: 0 auto;
}
#output {
display: block;
box-sizing: border-box;
width: 100%;
height: 300px;
padding: 10px;
font-size: 14px;
font-family: monospace;
color: white;
border: none;
background-color: black;
}
</style>
</head>
<body>
<h1>Ruby 2D</h1>
<p>This is a sample HTML template, but you can create your own!</p>
<hr>
<canvas id="canvas" oncontextmenu=".preventDefault()"></canvas>
<h2 style="margin-bottom: 0;">Output</h2>
<p style="margin: 4px 0 8px 0">Open the JavaScript console in developer tools for more detail.</p>
<textarea id="output"></textarea>
</body>
<script>
var Module = {
canvas: (function() { return document.getElementById('canvas'); })(),
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.log(text);
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})()
};
</script>
<script async src="app.js"></script>
</html>