Skip to content

Commit

Permalink
Give wasm page an arcade look
Browse files Browse the repository at this point in the history
  • Loading branch information
depsypher committed Jun 24, 2024
1 parent 5a93e1f commit 1128bf5
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 13 deletions.
Binary file added wasm/bezel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 35 additions & 13 deletions wasm/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
<!DOCTYPE html>
<script src="wasm_exec.js"></script>
<script>
// Polyfill
if (!WebAssembly.instantiateStreaming) {
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
<style>
html {
background: black;
}
.outer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 4em;
}
.wrapper {
position: relative;
}
.bezel {
width: 1000px;
height: 750px;
background-image: url('bezel.png');
background-size: contain;
background-repeat: no-repeat;
}
.frame {
position: absolute;
width: 640px;
height: 480px;
left: 180px;
top: 120px;
border: none;
}
</style>

const go = new Go();
WebAssembly.instantiateStreaming(fetch("gojoust.wasm"), go.importObject).then(result => {
go.run(result.instance);
});
</script>
<div class="outer">
<div class="wrapper">
<iframe src="main.html" width="100%" height="100%" class="frame"></iframe>
<div class="bezel"></div>
</div>
</div>
16 changes: 16 additions & 0 deletions wasm/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<script src="wasm_exec.js"></script>
<script>
// Polyfill
if (!WebAssembly.instantiateStreaming) {
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}

const go = new Go();
WebAssembly.instantiateStreaming(fetch("gojoust.wasm"), go.importObject).then(result => {
go.run(result.instance);
});
</script>

0 comments on commit 1128bf5

Please sign in to comment.