mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
start implementing run --browser
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import loaderUrl from "data-url:../../platform/bin/loader.wasm";
|
||||
import platformUrl from "data-url:../../platform/bin/platform.uw8";
|
||||
|
||||
export default function MicroW8(screen, config) {
|
||||
export default function MicroW8(screen, config = {}) {
|
||||
let canvasCtx = screen.getContext('2d');
|
||||
let imageData = canvasCtx.createImageData(320, 240);
|
||||
|
||||
@@ -310,5 +310,3 @@ export default function MicroW8(screen, config) {
|
||||
setDevkitMode: (m) => devkitMode = m,
|
||||
};
|
||||
}
|
||||
|
||||
this.uw8 = MicroW8;
|
||||
14
web/src/run-web.html
Normal file
14
web/src/run-web.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8" />
|
||||
<title>uw8-run</title>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="screen" width="320" height="240">
|
||||
</canvas>
|
||||
</body>
|
||||
<script type="module">
|
||||
import "./run-web.js";
|
||||
</script>
|
||||
</html>
|
||||
10
web/src/run-web.js
Normal file
10
web/src/run-web.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import MicroW8 from './microw8.js';
|
||||
|
||||
let uw8 = MicroW8(document.getElementById('screen'));
|
||||
let events = new EventSource('events');
|
||||
events.onmessage = event => {
|
||||
console.log(event.data);
|
||||
if(event.data == 'L') {
|
||||
uw8.runModuleFromURL('cart');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user