mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
doc: go generate; Add style.css
This commit is contained in:
parent
6857dfd177
commit
1cb66048ad
@ -4,23 +4,7 @@
|
|||||||
<link rel="shortcut icon" href="./favicon.png" type="image/png">
|
<link rel="shortcut icon" href="./favicon.png" type="image/png">
|
||||||
<link rel="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>
|
<title>Ebiten - A simple SNES-like 2D game library in Go</title>
|
||||||
<style>
|
<link rel="stylesheet" href="./style.css">
|
||||||
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>
|
<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>
|
<h1>Ebiten (海老天)</h1>
|
||||||
<p>Stable version: v{{.StableVersion}} / Development version: v{{.DevVersion}}</p>
|
<p>Stable version: v{{.StableVersion}} / Development version: v{{.DevVersion}}</p>
|
||||||
|
@ -23,6 +23,14 @@ Photograph by Chris Nokleberg
|
|||||||
the Creative Commons Attribution 3.0 License
|
the Creative Commons Attribution 3.0 License
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## tile.png
|
||||||
|
|
||||||
|
```
|
||||||
|
http://opengameart.org/node/8016
|
||||||
|
|
||||||
|
CC0 1.0
|
||||||
|
```
|
||||||
|
|
||||||
## Other image files
|
## Other image files
|
||||||
|
|
||||||
```
|
```
|
||||||
|
BIN
_docs/public/examples/_resources/images/tile.png
Normal file
BIN
_docs/public/examples/_resources/images/tile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 KiB |
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - alphablending</h1>
|
<h1>Ebiten example - alphablending</h1>
|
||||||
<iframe src="alphablending.content.html" width="640" height="480"></iframe>
|
<iframe src="alphablending.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image/color"
|
"image/color"
|
||||||
@ -88,7 +90,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
diff = float64(480-count) * 0.2
|
diff = float64(480-count) * 0.2
|
||||||
}
|
}
|
||||||
|
|
||||||
screen.Fill(color.NRGBA{0x00, 0x00, 0x80, 0xff})
|
if err := screen.Fill(color.NRGBA{0x00, 0x00, 0x80, 0xff}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.ColorM.Scale(1.0, 1.0, 1.0, 0.5)
|
op.ColorM.Scale(1.0, 1.0, 1.0, 0.5)
|
||||||
op.ImageParts = &imageParts{
|
op.ImageParts = &imageParts{
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - audio</h1>
|
<h1>Ebiten example - audio</h1>
|
||||||
<iframe src="audio.content.html" width="640" height="480"></iframe>
|
<iframe src="audio.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -68,13 +70,17 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
playerBarImage.Fill(&color.RGBA{0x80, 0x80, 0x80, 0xff})
|
if err := playerBarImage.Fill(&color.RGBA{0x80, 0x80, 0x80, 0xff}); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
playerCurrentImage, err = ebiten.NewImage(4, 10, ebiten.FilterNearest)
|
playerCurrentImage, err = ebiten.NewImage(4, 10, ebiten.FilterNearest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
playerCurrentImage.Fill(&color.RGBA{0xff, 0xff, 0xff, 0xff})
|
if err := playerCurrentImage.Fill(&color.RGBA{0xff, 0xff, 0xff, 0xff}); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Player struct {
|
type Player struct {
|
||||||
@ -217,7 +223,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
x, y, w, h := playerBarRect()
|
x, y, w, h := playerBarRect()
|
||||||
op.GeoM.Translate(float64(x), float64(y))
|
op.GeoM.Translate(float64(x), float64(y))
|
||||||
screen.DrawImage(playerBarImage, op)
|
if err := screen.DrawImage(playerBarImage, op); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
currentTimeStr := "00:00"
|
currentTimeStr := "00:00"
|
||||||
if musicPlayer != nil {
|
if musicPlayer != nil {
|
||||||
c := musicPlayer.audioPlayer.Current()
|
c := musicPlayer.audioPlayer.Current()
|
||||||
@ -233,7 +241,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
cy := y - (ch-h)/2
|
cy := y - (ch-h)/2
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Translate(float64(cx), float64(cy))
|
op.GeoM.Translate(float64(cx), float64(cy))
|
||||||
screen.DrawImage(playerCurrentImage, op)
|
if err := screen.DrawImage(playerCurrentImage, op); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := fmt.Sprintf(`FPS: %0.2f
|
msg := fmt.Sprintf(`FPS: %0.2f
|
||||||
@ -244,7 +254,9 @@ Press Z or X to change volume of the music
|
|||||||
if musicPlayer == nil {
|
if musicPlayer == nil {
|
||||||
msg += "\nNow Loading..."
|
msg += "\nNow Loading..."
|
||||||
}
|
}
|
||||||
ebitenutil.DebugPrint(screen, msg)
|
if err := ebitenutil.DebugPrint(screen, msg); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := audioContext.Update(); err != nil {
|
if err := audioContext.Update(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -297,7 +309,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
close(musicCh)
|
close(musicCh)
|
||||||
// TODO: Is this goroutine-safe?
|
// TODO: Is this goroutine-safe?
|
||||||
p.Play()
|
if err := p.Play(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Audio (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Audio (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - font</h1>
|
<h1>Ebiten example - font</h1>
|
||||||
<iframe src="font.content.html" width="640" height="480"></iframe>
|
<iframe src="font.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@ -76,7 +78,9 @@ func parseFont() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer func() {
|
||||||
|
_ = f.Close()
|
||||||
|
}()
|
||||||
b, err := ioutil.ReadAll(f)
|
b, err := ioutil.ReadAll(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -98,12 +102,11 @@ func parseFont() error {
|
|||||||
Hinting: font.HintingFull,
|
Hinting: font.HintingFull,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
dy := size * dpi / 72
|
y := size
|
||||||
y := dy
|
|
||||||
for _, s := range text {
|
for _, s := range text {
|
||||||
d.Dot = fixed.P(0, y)
|
d.Dot = fixed.P(0, y)
|
||||||
d.DrawString(s)
|
d.DrawString(s)
|
||||||
y += dy
|
y += size
|
||||||
}
|
}
|
||||||
return textImage.ReplacePixels(dst.Pix)
|
return textImage.ReplacePixels(dst.Pix)
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - gamepad</h1>
|
<h1>Ebiten example - gamepad</h1>
|
||||||
<iframe src="gamepad.content.html" width="640" height="480"></iframe>
|
<iframe src="gamepad.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -78,7 +80,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
Pressed Buttons: {{.Buttons}}`
|
Pressed Buttons: {{.Buttons}}`
|
||||||
str = strings.Replace(str, "{{.Axes}}", strings.Join(axes, "\n "), -1)
|
str = strings.Replace(str, "{{.Axes}}", strings.Join(axes, "\n "), -1)
|
||||||
str = strings.Replace(str, "{{.Buttons}}", strings.Join(pressedButtons, ", "), -1)
|
str = strings.Replace(str, "{{.Buttons}}", strings.Join(pressedButtons, ", "), -1)
|
||||||
ebitenutil.DebugPrint(screen, str)
|
if err := ebitenutil.DebugPrint(screen, str); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - hsv</h1>
|
<h1>Ebiten example - hsv</h1>
|
||||||
<iframe src="hsv.content.html" width="640" height="480"></iframe>
|
<iframe src="hsv.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - hue</h1>
|
<h1>Ebiten example - hue</h1>
|
||||||
<iframe src="hue.content.html" width="640" height="480"></iframe>
|
<iframe src="hue.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "image/jpeg"
|
_ "image/jpeg"
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - keyboard</h1>
|
<h1>Ebiten example - keyboard</h1>
|
||||||
<iframe src="keyboard.content.html" width="640" height="480"></iframe>
|
<iframe src="keyboard.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
@ -108,7 +110,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Translate(offsetX, offsetY)
|
op.GeoM.Translate(offsetX, offsetY)
|
||||||
op.ColorM.Scale(0.5, 0.5, 0.5, 1)
|
op.ColorM.Scale(0.5, 0.5, 0.5, 1)
|
||||||
screen.DrawImage(keyboardImage, op)
|
if err := screen.DrawImage(keyboardImage, op); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
pressed := []string{}
|
pressed := []string{}
|
||||||
for i := 0; i <= 9; i++ {
|
for i := 0; i <= 9; i++ {
|
||||||
@ -136,7 +140,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
ImageParts: pressedKeysParts(pressed),
|
ImageParts: pressedKeysParts(pressed),
|
||||||
}
|
}
|
||||||
op.GeoM.Translate(offsetX, offsetY)
|
op.GeoM.Translate(offsetX, offsetY)
|
||||||
screen.DrawImage(keyboardImage, op)
|
if err := screen.DrawImage(keyboardImage, op); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - masking</h1>
|
<h1>Ebiten example - masking</h1>
|
||||||
<iframe src="masking.content.html" width="640" height="480"></iframe>
|
<iframe src="masking.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - mosaic</h1>
|
<h1>Ebiten example - mosaic</h1>
|
||||||
<iframe src="mosaic.content.html" width="640" height="480"></iframe>
|
<iframe src="mosaic.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "image/jpeg"
|
_ "image/jpeg"
|
||||||
@ -61,10 +63,14 @@ var (
|
|||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Scale(1.0/mosaicRatio, 1.0/mosaicRatio)
|
op.GeoM.Scale(1.0/mosaicRatio, 1.0/mosaicRatio)
|
||||||
gophersRenderTarget.DrawImage(gophersImage, op)
|
if err := gophersRenderTarget.DrawImage(gophersImage, op); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
op = &ebiten.DrawImageOptions{}
|
op = &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Scale(mosaicRatio, mosaicRatio)
|
op.GeoM.Scale(mosaicRatio, mosaicRatio)
|
||||||
screen.DrawImage(gophersRenderTarget, op)
|
if err := screen.DrawImage(gophersRenderTarget, op); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - noise</h1>
|
<h1>Ebiten example - noise</h1>
|
||||||
<iframe src="noise.content.html" width="640" height="480"></iframe>
|
<iframe src="noise.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -80,8 +82,12 @@ func update(screen *ebiten.Image) error {
|
|||||||
noiseImage.Pix[4*i+2] = uint8(x >> 8)
|
noiseImage.Pix[4*i+2] = uint8(x >> 8)
|
||||||
noiseImage.Pix[4*i+3] = 0xff
|
noiseImage.Pix[4*i+3] = 0xff
|
||||||
}
|
}
|
||||||
screen.ReplacePixels(noiseImage.Pix)
|
if err := screen.ReplacePixels(noiseImage.Pix); err != nil {
|
||||||
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %f", ebiten.CurrentFPS()))
|
return err
|
||||||
|
}
|
||||||
|
if err := ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %f", ebiten.CurrentFPS())); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - paint</h1>
|
<h1>Ebiten example - paint</h1>
|
||||||
<iframe src="paint.content.html" width="640" height="480"></iframe>
|
<iframe src="paint.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -129,7 +131,9 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
canvasImage.Fill(color.White)
|
if err := canvasImage.Fill(color.White); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Paint (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Paint (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - perspective</h1>
|
<h1>Ebiten example - perspective</h1>
|
||||||
<iframe src="perspective.content.html" width="640" height="480"></iframe>
|
<iframe src="perspective.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "image/jpeg"
|
_ "image/jpeg"
|
||||||
@ -84,7 +86,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
maxWidth := float64(w) + float64(h)*0.75
|
maxWidth := float64(w) + float64(h)*0.75
|
||||||
op.GeoM.Translate(-maxWidth/2, -float64(h)/2)
|
op.GeoM.Translate(-maxWidth/2, -float64(h)/2)
|
||||||
op.GeoM.Translate(screenWidth/2, screenHeight/2)
|
op.GeoM.Translate(screenWidth/2, screenHeight/2)
|
||||||
screen.DrawImage(gophersImage, op)
|
if err := screen.DrawImage(gophersImage, op); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - piano</h1>
|
<h1>Ebiten example - piano</h1>
|
||||||
<iframe src="piano.content.html" width="640" height="480"></iframe>
|
<iframe src="piano.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -113,7 +115,9 @@ func addNote(freq float64, vol float64) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
p.Play()
|
if err := p.Play(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
length := len(pcm) * baseFreq / f
|
length := len(pcm) * baseFreq / f
|
||||||
@ -134,7 +138,9 @@ func addNote(freq float64, vol float64) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
p.Play()
|
if err := p.Play(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +191,9 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
imageEmpty.Fill(color.White)
|
if err := imageEmpty.Fill(color.White); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
imagePiano, err = ebiten.NewImage(screenWidth, screenHeight, ebiten.FilterNearest)
|
imagePiano, err = ebiten.NewImage(screenWidth, screenHeight, ebiten.FilterNearest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -201,8 +209,12 @@ func init() {
|
|||||||
op.GeoM.Scale(float64(width-1)/float64(w), float64(height)/float64(h))
|
op.GeoM.Scale(float64(width-1)/float64(w), float64(height)/float64(h))
|
||||||
op.GeoM.Translate(float64(x), float64(y))
|
op.GeoM.Translate(float64(x), float64(y))
|
||||||
op.ColorM.Scale(1, 1, 1, 1)
|
op.ColorM.Scale(1, 1, 1, 1)
|
||||||
imagePiano.DrawImage(imageEmpty, op)
|
if err := imagePiano.DrawImage(imageEmpty, op); err != nil {
|
||||||
common.ArcadeFont.DrawText(imagePiano, k, x+8, y+height-16, 1, color.Black)
|
panic(err)
|
||||||
|
}
|
||||||
|
if err := common.ArcadeFont.DrawText(imagePiano, k, x+8, y+height-16, 1, color.Black); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blackKeys := []string{"Q", "W", "", "R", "T", "", "U", "I", "O"}
|
blackKeys := []string{"Q", "W", "", "R", "T", "", "U", "I", "O"}
|
||||||
@ -217,8 +229,12 @@ func init() {
|
|||||||
op.GeoM.Scale(float64(width-1)/float64(w), float64(height)/float64(h))
|
op.GeoM.Scale(float64(width-1)/float64(w), float64(height)/float64(h))
|
||||||
op.GeoM.Translate(float64(x), float64(y))
|
op.GeoM.Translate(float64(x), float64(y))
|
||||||
op.ColorM.Scale(0, 0, 0, 1)
|
op.ColorM.Scale(0, 0, 0, 1)
|
||||||
imagePiano.DrawImage(imageEmpty, op)
|
if err := imagePiano.DrawImage(imageEmpty, op); err != nil {
|
||||||
common.ArcadeFont.DrawText(imagePiano, k, x+8, y+height-16, 1, color.White)
|
panic(err)
|
||||||
|
}
|
||||||
|
if err := common.ArcadeFont.DrawText(imagePiano, k, x+8, y+height-16, 1, color.White); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,10 +249,16 @@ func update(screen *ebiten.Image) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
screen.Fill(color.RGBA{0x80, 0x80, 0xc0, 0xff})
|
if err := screen.Fill(color.RGBA{0x80, 0x80, 0xc0, 0xff}); err != nil {
|
||||||
screen.DrawImage(imagePiano, nil)
|
return err
|
||||||
|
}
|
||||||
|
if err := screen.DrawImage(imagePiano, nil); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS()))
|
if err := ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS())); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if err := audioContext.Update(); err != nil {
|
if err := audioContext.Update(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - rotate</h1>
|
<h1>Ebiten example - rotate</h1>
|
||||||
<iframe src="rotate.content.html" width="640" height="480"></iframe>
|
<iframe src="rotate.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "image/jpeg"
|
_ "image/jpeg"
|
||||||
|
@ -36,7 +36,9 @@ pre {
|
|||||||
|
|
||||||
<h1>Ebiten example - sprites</h1>
|
<h1>Ebiten example - sprites</h1>
|
||||||
<iframe src="sprites.content.html" width="640" height="480"></iframe>
|
<iframe src="sprites.content.html" width="640" height="480"></iframe>
|
||||||
<pre><code>package main
|
<pre><code>// +build example
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -18,23 +18,7 @@ limitations under the License.
|
|||||||
<link rel="shortcut icon" href="./favicon.png" type="image/png">
|
<link rel="shortcut icon" href="./favicon.png" type="image/png">
|
||||||
<link rel="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>
|
<title>Ebiten - A simple SNES-like 2D game library in Go</title>
|
||||||
<style>
|
<link rel="stylesheet" href="./style.css">
|
||||||
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>
|
<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>
|
<h1>Ebiten (海老天)</h1>
|
||||||
<p>Stable version: v1.4.0-alpha / Development version: v1.4.0-alpha</p>
|
<p>Stable version: v1.4.0-alpha / Development version: v1.4.0-alpha</p>
|
||||||
@ -70,10 +54,12 @@ pre {
|
|||||||
<a href="examples/alphablending.html"><img src="images/examples/alphablending.png" width="320" height="240" alt="Ebiten example: alphablending" class="example"></a><a href="examples/audio.html"><img src="images/examples/audio.png" width="320" height="240" alt="Ebiten example: audio" class="example"></a><a href="examples/font.html"><img src="images/examples/font.png" width="320" height="240" alt="Ebiten example: font" class="example"></a><a href="examples/hsv.html"><img src="images/examples/hsv.png" width="320" height="240" alt="Ebiten example: hsv" class="example"></a><a href="examples/hue.html"><img src="images/examples/hue.png" width="320" height="240" alt="Ebiten example: hue" class="example"></a><a href="examples/gamepad.html"><img src="images/examples/gamepad.png" width="320" height="240" alt="Ebiten example: gamepad" class="example"></a><a href="examples/keyboard.html"><img src="images/examples/keyboard.png" width="320" height="240" alt="Ebiten example: keyboard" class="example"></a><a href="examples/masking.html"><img src="images/examples/masking.png" width="320" height="240" alt="Ebiten example: masking" class="example"></a><a href="examples/mosaic.html"><img src="images/examples/mosaic.png" width="320" height="240" alt="Ebiten example: mosaic" class="example"></a><a href="examples/noise.html"><img src="images/examples/noise.png" width="320" height="240" alt="Ebiten example: noise" class="example"></a><a href="examples/paint.html"><img src="images/examples/paint.png" width="320" height="240" alt="Ebiten example: paint" class="example"></a><a href="examples/perspective.html"><img src="images/examples/perspective.png" width="320" height="240" alt="Ebiten example: perspective" class="example"></a><a href="examples/piano.html"><img src="images/examples/piano.png" width="320" height="240" alt="Ebiten example: piano" class="example"></a><a href="examples/rotate.html"><img src="images/examples/rotate.png" width="320" height="240" alt="Ebiten example: rotate" class="example"></a><a href="examples/sprites.html"><img src="images/examples/sprites.png" width="320" height="240" alt="Ebiten example: sprites" class="example"></a><a href="examples/blocks.html"><img src="images/examples/blocks.png" width="256" height="240" alt="Ebiten example: blocks" class="example"></a>
|
<a href="examples/alphablending.html"><img src="images/examples/alphablending.png" width="320" height="240" alt="Ebiten example: alphablending" class="example"></a><a href="examples/audio.html"><img src="images/examples/audio.png" width="320" height="240" alt="Ebiten example: audio" class="example"></a><a href="examples/font.html"><img src="images/examples/font.png" width="320" height="240" alt="Ebiten example: font" class="example"></a><a href="examples/hsv.html"><img src="images/examples/hsv.png" width="320" height="240" alt="Ebiten example: hsv" class="example"></a><a href="examples/hue.html"><img src="images/examples/hue.png" width="320" height="240" alt="Ebiten example: hue" class="example"></a><a href="examples/gamepad.html"><img src="images/examples/gamepad.png" width="320" height="240" alt="Ebiten example: gamepad" class="example"></a><a href="examples/keyboard.html"><img src="images/examples/keyboard.png" width="320" height="240" alt="Ebiten example: keyboard" class="example"></a><a href="examples/masking.html"><img src="images/examples/masking.png" width="320" height="240" alt="Ebiten example: masking" class="example"></a><a href="examples/mosaic.html"><img src="images/examples/mosaic.png" width="320" height="240" alt="Ebiten example: mosaic" class="example"></a><a href="examples/noise.html"><img src="images/examples/noise.png" width="320" height="240" alt="Ebiten example: noise" class="example"></a><a href="examples/paint.html"><img src="images/examples/paint.png" width="320" height="240" alt="Ebiten example: paint" class="example"></a><a href="examples/perspective.html"><img src="images/examples/perspective.png" width="320" height="240" alt="Ebiten example: perspective" class="example"></a><a href="examples/piano.html"><img src="images/examples/piano.png" width="320" height="240" alt="Ebiten example: piano" class="example"></a><a href="examples/rotate.html"><img src="images/examples/rotate.png" width="320" height="240" alt="Ebiten example: rotate" class="example"></a><a href="examples/sprites.html"><img src="images/examples/sprites.png" width="320" height="240" alt="Ebiten example: sprites" class="example"></a><a href="examples/blocks.html"><img src="images/examples/blocks.png" width="256" height="240" alt="Ebiten example: blocks" class="example"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2>Execute the example</h2>
|
<h2>Execute the examples</h2>
|
||||||
<pre><code>:; go get github.com/hajimehoshi/ebiten
|
<pre><code>:; go get github.com/hajimehoshi/ebiten
|
||||||
:; cd $GOPATH/src/github.com/hajimehoshi/ebiten/examples
|
:; cd $GOPATH/src/github.com/hajimehoshi/ebiten/examples
|
||||||
:; go run rotate/main.go</code></pre>
|
:; go run -tags example rotate/main.go</code></pre>
|
||||||
|
|
||||||
|
<p>Note that you need to specify <code>example</code> tag.</p>
|
||||||
|
|
||||||
<h2>Getting Started</h2>
|
<h2>Getting Started</h2>
|
||||||
|
|
||||||
|
15
_docs/public/style.css
Normal file
15
_docs/public/style.css
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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;
|
||||||
|
}
|
@ -21,6 +21,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// LicenseComment returns the license string in Go comment style.
|
||||||
func LicenseComment() (string, error) {
|
func LicenseComment() (string, error) {
|
||||||
_, path, _, _ := runtime.Caller(0)
|
_, path, _, _ := runtime.Caller(0)
|
||||||
licensePath := filepath.Join(filepath.Dir(path), "..", "LICENSE")
|
licensePath := filepath.Join(filepath.Dir(path), "..", "LICENSE")
|
||||||
|
Loading…
Reference in New Issue
Block a user