mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-28 03:32:45 +01:00
Destroyed GopherJS (markdown)
parent
bf9660c0a7
commit
e5f3fab7a8
59
GopherJS.md
59
GopherJS.md
@ -1,59 +0,0 @@
|
||||
See [[Installation]].
|
||||
|
||||
Install `gopherjs` command.
|
||||
|
||||
```sh
|
||||
$ go get github.com/gopherjs/gopherjs
|
||||
```
|
||||
|
||||
Compile your game with [GopherJS](http://www.gopherjs.org/):
|
||||
|
||||
```sh
|
||||
$ gopherjs build -o yourgame.js path/to/yourgame
|
||||
```
|
||||
|
||||
Then, open the below HTML on your HTTP server:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<script src="yourgame.js"></script>
|
||||
```
|
||||
|
||||
NOTE: `file://` URL may not work with Ebiten. Execute your game on a HTTP server.
|
||||
|
||||
If you want to embed your game into your web page, using iframe is strongly recommended.
|
||||
|
||||
If you find this message with Chrome:
|
||||
|
||||
```
|
||||
The AudioContext was not allowed to start. It must be resume (or created) after a user gesture on the page. https://goo.gl/7K7WLu
|
||||
```
|
||||
|
||||
you can solve this by putting `allow="autoplay"` on the iframe.
|
||||
|
||||
# Emulate context-lost
|
||||
|
||||
```
|
||||
document.getElementsByTagName("canvas")[0].getContext("webgl").getExtension('WEBGL_lose_context').loseContext();
|
||||
```
|
||||
|
||||
Note that Ebiten automatically restores images on desktop browsers when the context is lost. This restoring doesn't work on mobile browsers for a performance reason.
|
||||
|
||||
# Run examples on browsers
|
||||
|
||||
```
|
||||
gopherjs serve --tags=example
|
||||
```
|
||||
|
||||
And access to `http://127.0.0.1:8080/github.com/hajimehoshi/ebiten/examples/blocks`.
|
||||
|
||||
On Windows, you might need to set `GOOS` environment variable:
|
||||
|
||||
```
|
||||
set GOOS=linux
|
||||
```
|
||||
|
||||
# jsgo.io
|
||||
|
||||
Dave's [jsgo.io](https://jsgo.io/) is so wonderful that you can play your game on browsers. For example, if you want to play `github.com/hajimehoshi/go-inovation`, you can access `https://jsgo.io/github.com/hajimehoshi/go-inovation`. That's it! Note that you would need to put your resources in appropriate paths, or embed your resources in Go by [file2byteslice](https://github.com/hajimehoshi/file2byteslice) or other similar tools.
|
||||
|
Loading…
Reference in New Issue
Block a user