Add explanation to run developer's game on a web browser

This commit is contained in:
Hajime Hoshi 2015-01-06 02:23:41 +09:00
parent 1d8c3dbbb4
commit c71f55a7a7
3 changed files with 39 additions and 6 deletions

View File

@ -32,7 +32,7 @@ table.examples iframe {
<li>A simple SNES-like 2D game library in Go</li> <li>A simple SNES-like 2D game library in Go</li>
<li>Works on <li>Works on
<ul> <ul>
<li>HTML5 (powered by <a href="http://gopherjs.org/">GopherJS</a>) <li>Web browsers (powered by <a href="http://gopherjs.org/">GopherJS</a>)
<li>Mac OS X</li> <li>Mac OS X</li>
<li>Linux (maybe)</li> <li>Linux (maybe)</li>
<li>Windows (possibly)</li> <li>Windows (possibly)</li>
@ -75,7 +75,7 @@ table.examples iframe {
<pre><code>:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example <pre><code>:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example
:; go run rotate/main.go</code></pre> :; go run rotate/main.go</code></pre>
<h2>Execute the example on your browser</h2> <h2>Execute the example on a web browser</h2>
<p>If you can the example screens above, Ebiten is working on your browser! Each example above works as an independent html in an iframe. If you want to execute the examples apart from this site, execute this:</p> <p>If you can the example screens above, Ebiten is working on your browser! Each example above works as an independent html in an iframe. If you want to execute the examples apart from this site, execute this:</p>
<pre><code>:; go get github.com/gopherjs/gopherjs <pre><code>:; go get github.com/gopherjs/gopherjs
:; go run $GOPATH/src/github.com/hajimehoshi/ebiten/example/server/main.go</code></pre> :; go run $GOPATH/src/github.com/hajimehoshi/ebiten/example/server/main.go</code></pre>
@ -83,6 +83,14 @@ table.examples iframe {
<p><code>localhost:8000/?EXAMPLE_NAME</code> shows other examples (e.g. <code>localhost:8000/?rotate</code>).</p> <p><code>localhost:8000/?EXAMPLE_NAME</code> shows other examples (e.g. <code>localhost:8000/?rotate</code>).</p>
<p>Of cource, you can execute gopherjs yourself. Please see <a href="http://gopherjs.org/">GopherJS site</a> for more detail.</p> <p>Of cource, you can execute gopherjs yourself. Please see <a href="http://gopherjs.org/">GopherJS site</a> for more detail.</p>
<h2>Run your game on a web browser</h2>
<p>Compile your game with GopherJS:</p>
<pre><code>:; go get github.com/gopherjs/gopherjs
:; gopherjs build -o yourgame.js path/to/yourgame</code></pre>
<p>Then, open the below HTML on your HTTP server:</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;script src="yourgame.js"&gt;&lt;/script&gt;</code></pre>
<h2>Change Log</h2> <h2>Change Log</h2>
<h3>2015-??-??</h3> <h3>2015-??-??</h3>
<ul> <ul>

View File

@ -47,7 +47,7 @@ table.examples iframe {
<li>A simple SNES-like 2D game library in Go</li> <li>A simple SNES-like 2D game library in Go</li>
<li>Works on <li>Works on
<ul> <ul>
<li>HTML5 (powered by <a href="http://gopherjs.org/">GopherJS</a>) <li>Web browsers (powered by <a href="http://gopherjs.org/">GopherJS</a>)
<li>Mac OS X</li> <li>Mac OS X</li>
<li>Linux (maybe)</li> <li>Linux (maybe)</li>
<li>Windows (possibly)</li> <li>Windows (possibly)</li>
@ -316,13 +316,22 @@ func main() {
<pre><code>:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example <pre><code>:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example
:; go run rotate/main.go</code></pre> :; go run rotate/main.go</code></pre>
<h2>Execute the example on your browser</h2> <h2>Execute the example on a web browser</h2>
<p>If you can the example screens above, Ebiten is working on your browser! Each example above works as an independent html in an iframe. If you want to execute the examples apart from this site, execute this:</p> <p>If you can the example screens above, Ebiten is working on your browser! Each example above works as an independent html in an iframe. If you want to execute the examples apart from this site, execute this:</p>
<pre><code>:; go get github.com/gopherjs/gopherjs <pre><code>:; go get github.com/gopherjs/gopherjs
:; go run $GOPATH/src/github.com/hajimehoshi/ebiten/example/server/main.go</code></pre> :; go run $GOPATH/src/github.com/hajimehoshi/ebiten/example/server/main.go</code></pre>
<p>Then, open <code>localhost:8000</code> on your browser.</p> <p>Then, open <code>localhost:8000</code> on your browser.</p>
<p><code>localhost:8000/?EXAMPLE_NAME</code> shows other examples (e.g. <code>localhost:8000/?rotate</code>).</p> <p><code>localhost:8000/?EXAMPLE_NAME</code> shows other examples (e.g. <code>localhost:8000/?rotate</code>).</p>
<p>Of cource, you can execute gopherjs yourself. Please see <a href="http://gopherjs.org/">GopherJS site</a> for more detail.</p> <p>Of cource, you can execute gopherjs yourself. Please see <a href="http://gopherjs.org/">GopherJS site</a> for more detail.</p>
<h2>Run your game on a web browser</h2>
<p>Compile your game with GopherJS:</p>
<pre><code>:; go get github.com/gopherjs/gopherjs
:; gopherjs build -o yourgame.js path/to/yourgame</code></pre>
<p>Then, open the below HTML on your HTTP server:</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;script src="yourgame.js"&gt;&lt;/script&gt;</code></pre>
<h2>Change Log</h2> <h2>Change Log</h2>
<h3>2015-??-??</h3> <h3>2015-??-??</h3>
<ul> <ul>

View File

@ -4,7 +4,7 @@
* A simple SNES-like 2D game library in Go * A simple SNES-like 2D game library in Go
* Works on * Works on
* HTML5 (powered by [GopherJS](http://gopherjs.org/)) * Web browsers (powered by [GopherJS](http://gopherjs.org/))
* Mac OS X * Mac OS X
* Linux (maybe) * Linux (maybe)
* Windows (possibly) * Windows (possibly)
@ -45,7 +45,7 @@ If you want to use GopherJS, execute this:
:; go run blocks/main.go :; go run blocks/main.go
``` ```
## Execute the example on your browser ## Execute the example on a web browser
``` ```
:; go get github.com/gopherjs/gopherjs :; go get github.com/gopherjs/gopherjs
@ -56,6 +56,22 @@ Then, open ``localhost:8000`` on your browser.
``localhost:8000/?EXAMPLE_NAME`` shows other examples (e.g. ``localhost:8000/?rotate``). ``localhost:8000/?EXAMPLE_NAME`` shows other examples (e.g. ``localhost:8000/?rotate``).
## Run your game on a web browser
Compile your game with GopherJS:
```
:; go get github.com/gopherjs/gopherjs
:; 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>
```
### Benchmark the example ### Benchmark the example
``` ```