-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmario.html
57 lines (50 loc) · 1.46 KB
/
mario.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>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>mario</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
</head>
<body>
<h3> </h3>
<canvas id="id-canvas" width="640" height="640"></canvas>
<canvas id="id-canvas-sprite" width="160" height="320"></canvas>
<div class="ryoua-controls">
<button data-action = 'change_offset' data-offset="-1024">-1024</button>
<button data-action = 'change_offset' data-offset="1024">1024</button>
<button data-action = 'change_offset' data-offset="-16">-16</button>
<button data-action = 'change_offset' data-offset="16">16</button>
</div>
<script>
const e = sel => document.querySelector(sel)
const log = console.log.bind(console)
const ajax = request => {
let r = new XMLHttpRequest()
r.open(request.method, request.url, true)
r.responseType = 'arraybuffer'
r.onreadystatechange = event => {
if (r.readyState == 4) {
request.callback(r.response)
}
}
r.send()
}
const drawNes = bytes => {
}
const __main = () => {
let request = {
method: 'GET',
url: 'mario.nes',
callback(response) {
let bytes = new Uint8Array(response)
log('bytes', bytes)
},
}
ajax(request)
}
__main()
</script>
</body>
</html>