feat: WIP cube
All checks were successful
/ test (push) Successful in 8s

This commit is contained in:
violette 2025-09-13 02:43:27 -04:00
parent cc29759cf8
commit 6fb0a4d3e2
6 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,8 @@
[[headers]]
for = '/**'
[headers.values]
# for the cube
Cross-Origin-Opener-Policy = "same-origin"
Cross-Origin-Resource-Policy = "same-site"
Cross-Origin-Embedder-Policy = "require-corp"
Referrer-Policy = 'origin'

9
content/en/posts/cube.md Normal file
View file

@ -0,0 +1,9 @@
+++
title = 'Cube'
date = 2025-09-07T06:09:55-04:00
+++
## This page requires WASM / WebGL!
here is a small animations of a cube rolling. its meant for game boy architecture, and is a WIP.
{{< cube >}}

5
gbaWasm/package.json Normal file
View file

@ -0,0 +1,5 @@
{
"dependencies": {
"@thenick775/mgba-wasm": "^2.3.4"
}
}

BIN
gbaWasm/vi.gba Executable file

Binary file not shown.

View file

@ -41,3 +41,12 @@ weight = 30
path = "github.com/KKKZOZ/hugo-admonitions" path = "github.com/KKKZOZ/hugo-admonitions"
[[module.imports]] [[module.imports]]
theme = "violette" theme = "violette"
[[module.mounts]]
source = "gbaWasm/node_modules/@thenick775/mgba-wasm/dist"
target = "assets/js"
[[module.mounts]]
source = "gbaWasm/mgba.map.wasm"
target = "assets/js/mgba.map.wasm"
[[module.mounts]]
source = "gbaWasm/vi.gba"
target = "assets/js/vi.gba"

View 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 }}