This commit is contained in:
parent
cc29759cf8
commit
6fb0a4d3e2
6 changed files with 61 additions and 0 deletions
30
themes/violette/layouts/_shortcodes/cube.html
Normal file
30
themes/violette/layouts/_shortcodes/cube.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<canvas id="gbaScreen" width="240" height="160" ></canvas>
|
||||
{{ with resources.Get "js/mgba.js" }}
|
||||
{{ $wasm := resources.Get "js/mgba.wasm" }}
|
||||
{{ $cube := resources.Get "js/vi.gba" }}
|
||||
{{ $wasm_map := resources.Get "js/mgba.wasm.map" }}
|
||||
<script type="module" async>
|
||||
import mGBA from {{ .Permalink }}
|
||||
var Module = {
|
||||
canvas: (function () {
|
||||
return document.getElementById("gbaScreen");
|
||||
})()
|
||||
};
|
||||
console.log({{ $wasm_map.Permalink }})
|
||||
|
||||
mGBA(Module).then(async function (Module) {
|
||||
let mGBAVersion =
|
||||
Module.version.projectName +
|
||||
' ' +
|
||||
Module.version.projectVersion;
|
||||
console.log(mGBAVersion);
|
||||
Module.FSInit().then(async () => {
|
||||
let res = await fetch("{{ $cube.Permalink }}");
|
||||
res = await res.text();
|
||||
let file = new File([res], "vi.gba");
|
||||
Module.uploadRom(file, () => console.log(Module.loadGame("vi.gba", undefined)));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue