-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.html
66 lines (59 loc) · 1.68 KB
/
dev.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
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<title>Emerald Hunt</title>
<style>
body {
background-image: url(resources/wallpaper.png);
background-color: black;
}
</style>
</head>
<body>
<h1>Page for dev work</h1>
<label for="scale">Choose a scale:</label>
<select id="scale">
<option value="1">100%</option>
<option value="1.2">120%</option>
<option value="1.4" selected="selected">140%</option>
<option value="1.6">160%</option>
<option value="1.8">180%</option>
<option value="2">200%</option>
</select><br/>
<canvas id="huntCanvas">
This browser can not run this game (canvas support missing).
</canvas>
<br><br>
<hr>
<h3>Resource (image) file</h3>
<span>Upload file: </span>
<input type="file" id="resource-file-input" />
<div id="imagesDiv"></div>
</body>
</html>
<script type="module">
import {EmeraldHunt} from "./js/hunt.js";
import {ScreenshotAnalyser} from "./js/screenshot.js";
window.onload = init;
var app;
async function init() {
let canvas = document.getElementById("huntCanvas");
canvas.focus();
app = new EmeraldHunt(canvas);
let scale = document.getElementById('scale');
scale.addEventListener('change', changeScale, false);
// https://stackoverflow.com/a/23612498/5329728
scale.dispatchEvent(new Event('change'));
await app.init();
document.getElementById('resource-file-input').addEventListener('change', uploadResourceFile);
};
async function uploadResourceFile(event) {
const file = event.target.files[0];
console.log(file);
await app.useImageFile(file);
}
function changeScale(e) {
app.scaleGame(e.target.value);
}
</script>