This commit is contained in:
parent
cc29759cf8
commit
6fb0a4d3e2
6 changed files with 61 additions and 0 deletions
8
config/development/server.toml
Normal file
8
config/development/server.toml
Normal 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
9
content/en/posts/cube.md
Normal 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
5
gbaWasm/package.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"@thenick775/mgba-wasm": "^2.3.4"
|
||||||
|
}
|
||||||
|
}
|
BIN
gbaWasm/vi.gba
Executable file
BIN
gbaWasm/vi.gba
Executable file
Binary file not shown.
|
@ -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"
|
||||||
|
|
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