mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
133 lines
4.7 KiB
HTML
133 lines
4.7 KiB
HTML
<!DOCTYPE html>
|
|
{{comment .License}}
|
|
<meta name="description" content="Ebiten - A simple SNES-like 2D game library in Go">
|
|
<link rel="shortcut icon" href="./favicon.png" type="image/png">
|
|
<link rel="icon" href="./favicon.png" type="image/png">
|
|
<title>Ebiten - A simple SNES-like 2D game library in Go</title>
|
|
<style>
|
|
body {
|
|
font-family: sans-serif;
|
|
}
|
|
img.example {
|
|
background-color: #000;
|
|
border-color: #999;
|
|
border-style: solid;
|
|
border-width: 1px;
|
|
image-rendering: crisp-edges;
|
|
image-rendering: pixelated;
|
|
}
|
|
pre {
|
|
background: #eee;
|
|
padding: 1em;
|
|
}
|
|
</style>
|
|
<a href="https://github.com/hajimehoshi/ebiten"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
|
|
<h1>Ebiten (海老天)</h1>
|
|
<p>Stable version: v{{.StableVersion}} / Development version: v{{.DevVersion}}</p>
|
|
<ul>
|
|
<li>A simple SNES-like 2D game library in Go</li>
|
|
<li>Works on
|
|
<ul>
|
|
<li>Web browsers (powered by <a href="http://gopherjs.org/">GopherJS</a>)
|
|
<ul>
|
|
<li>Supported browsers: Chrome and Firefox on desktops</li>
|
|
</ul>
|
|
</li>
|
|
<li>Windows</li>
|
|
<li>Mac OS X</li>
|
|
<li>Linux</li>
|
|
<li>Android (WIP)</li>
|
|
<li>iOS (WIP)</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="http://godoc.org/github.com/hajimehoshi/ebiten"><img src="https://godoc.org/github.com/hajimehoshi/ebiten?status.svg" alt="GoDoc Reference"></a></li>
|
|
<li><a href="https://github.com/hajimehoshi/ebiten/wiki">Wiki</a>
|
|
</ul>
|
|
|
|
<h2>Features</h2>
|
|
<ul>
|
|
<li>2D Graphics</li>
|
|
<li>Input (Mouse, Keyboard, Gamepad)</li>
|
|
<li>Audio (Ogg/Vorbis, WAV, and PCM)</li>
|
|
</ul>
|
|
|
|
<h2>Example</h2>
|
|
<p>
|
|
{{range .Examples -}}
|
|
<a href="examples/{{.Name}}.html"><img src="images/examples/{{.Name}}.png" width="{{.ThumbWidth}}" height="{{.ThumbHeight}}" alt="Ebiten example: {{.Name}}" class="example"></a>
|
|
{{- end}}
|
|
</p>
|
|
|
|
<h2>Install on Mac OS X or Windows</h2>
|
|
<p>Compilation requires a C compiler like GCC to compile third party libaries used by Ebiten. You would need <a href="http://www.mingw.org/">MinGW</a> on Windows, and would need Xcode on Mac OS X.</p>
|
|
<p>Let's get the Ebiten source code and compile it.</p>
|
|
<pre><code>:; go get github.com/hajimehoshi/ebiten</code></pre>
|
|
<p>If you want to run your game on a web browser, execute this:</p>
|
|
<pre><code>:; go get github.com/gopherjs/gopherjs
|
|
:; go get github.com/gopherjs/webgl</code></pre>
|
|
|
|
<h2>Install on Linux</h2>
|
|
<p>Before installing Ebiten, you might need these libraries:</p>
|
|
<ul>
|
|
<li>libglu1-mesa-dev</li>
|
|
<li>libgles2-mesa-dev</li>
|
|
<li>libxrandr-dev</li>
|
|
<li>libxcursor-dev</li>
|
|
<li>libxinerama-dev</li>
|
|
<li>libxi-dev</li>
|
|
</ul>
|
|
<p>Ebiten is tested on Ubuntu Linux x64.</p>
|
|
|
|
<h2>Execute the example</h2>
|
|
<pre><code>:; cd $GOPATH/src/github.com/hajimehoshi/ebiten/examples
|
|
:; go run rotate/main.go</code></pre>
|
|
|
|
<h2>Run your game on a desktop</h2>
|
|
<p>Just execute your Go program. That's it!</p>
|
|
|
|
<h2>Run your game on a web browser</h2>
|
|
<p>Compile your game with <a href="http://gopherjs.org/">GopherJS</a>:</p>
|
|
<pre><code>:; gopherjs build -o yourgame.js path/to/yourgame</code></pre>
|
|
<p>Then, open the below HTML on your HTTP server:</p>
|
|
<pre><code><!DOCTYPE html>
|
|
<script src="yourgame.js"></script></code></pre>
|
|
<p>NOTE: <code>file://</code> URL may not work with Ebiten. Execute your game on a HTTP server.</p>
|
|
|
|
<h2>Getting Started</h2>
|
|
|
|
<p>Let's build a simple "Hello world!" game to get started with Ebiten.
|
|
First create a new directory (<code>mkdir hello_world</code>), and change
|
|
into it (<code>cd hello_world</code>). Type the following code into
|
|
the <code>main.go</code> file:</p>
|
|
|
|
<pre><code>package main
|
|
|
|
import (
|
|
"github.com/hajimehoshi/ebiten"
|
|
"github.com/hajimehoshi/ebiten/ebitenutil"
|
|
)
|
|
|
|
func update(screen *ebiten.Image) error {
|
|
ebitenutil.DebugPrint(screen, "Hello world!")
|
|
return nil
|
|
}
|
|
|
|
func main() {
|
|
ebiten.Run(update, 320, 240, 2, "Hello world!")
|
|
}
|
|
</code></pre>
|
|
|
|
<p>Run the <code>go run</code> command to start the
|
|
game. There you have it, your first Ebiten game!</p>
|
|
|
|
<h2>Change Log</h2>
|
|
<p>See <a href="https://github.com/hajimehoshi/ebiten/releases">GitHub releases page</a>.</p>
|
|
|
|
<h2>License</h2>
|
|
<h3>Ebiten</h3>
|
|
<pre>{{.License}}</pre>
|
|
<h3>Go Gopher photograph</h3>
|
|
<p><a href="http://blog.golang.org/go-programming-language-turns-two">The original photograph of Go gophers by Chris Nokleberg</a> is licensed under the Creative Commons 3.0 Attributions license.</p>
|
|
|
|
<footer>{{.Copyright}}</footer>
|