mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-01 05:24:27 +01:00
Updated WebAssembly (markdown)
parent
30279bf2dd
commit
12ca64f36b
@ -7,6 +7,12 @@ As there are differences between the latest Go and Go 1.11 beta, I recommend to
|
|||||||
|
|
||||||
After that, use the compiled `go` binary.
|
After that, use the compiled `go` binary.
|
||||||
|
|
||||||
|
# Compile your game
|
||||||
|
|
||||||
|
```sh
|
||||||
|
GOOS=js GOARCH=wasm /path/to/latest/gocode/bin/go build -o yourgame.wasm github.com/yourname/yourgame
|
||||||
|
```
|
||||||
|
|
||||||
# Create an HTML
|
# Create an HTML
|
||||||
|
|
||||||
```html
|
```html
|
||||||
@ -22,7 +28,7 @@ if (!WebAssembly.instantiateStreaming) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const go = new Go();
|
const go = new Go();
|
||||||
WebAssembly.instantiateStreaming(fetch("sprites.wasm"), go.importObject).then(result => {
|
WebAssembly.instantiateStreaming(fetch("yourgame.wasm"), go.importObject).then(result => {
|
||||||
go.run(result.instance);
|
go.run(result.instance);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user