diff --git a/_docs/gen.go b/_docs/gen.go
index cb4dce75f..f39f6424d 100644
--- a/_docs/gen.go
+++ b/_docs/gen.go
@@ -58,13 +58,30 @@ type example struct {
Name string
}
+func (e *example) Width() int {
+ if e.Name == "blocks" {
+ return 256
+ }
+ return 320
+}
+
+func (e *example) Height() int {
+ if e.Name == "blocks" {
+ return 240
+ }
+ return 240
+}
+
func (e *example) Source() string {
+ if e.Name == "blocks" {
+ return "// Please read example/blocks/main.go and example/blocks/blocks/*.go"
+ }
+
path := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "hajimehoshi", "ebiten", "example", e.Name, "main.go")
b, err := ioutil.ReadFile(path)
if err != nil {
panic(err)
}
-
str := regexp.MustCompile("(?s)^.*?\n\n").ReplaceAllString(string(b), "")
return str
}
@@ -86,6 +103,7 @@ func main() {
log.Fatal(err)
}
examples := []example{
+ {Name: "blocks"},
{Name: "hue"},
{Name: "mosaic"},
{Name: "perspective"},
diff --git a/_docs/index_tmpl.html b/_docs/index_tmpl.html
index 2983132ea..992f03080 100644
--- a/_docs/index_tmpl.html
+++ b/_docs/index_tmpl.html
@@ -48,7 +48,7 @@ table.examples td.code pre {
// {{.Name}}
{{.Source}}
|
- |
+ |
{{end}}
diff --git a/_docs/public/blocks.gif b/_docs/public/blocks.gif
new file mode 100644
index 000000000..2dd8a8637
Binary files /dev/null and b/_docs/public/blocks.gif differ
diff --git a/_docs/public/index.html b/_docs/public/index.html
index 357ae2e77..e7eb3604f 100644
--- a/_docs/public/index.html
+++ b/_docs/public/index.html
@@ -56,6 +56,13 @@ table.examples td.code pre {
Example
+
+ // blocks
+
+// Please read example/blocks/main.go and example/blocks/blocks/*.go
|
+ |
+
+
// hue
diff --git a/example/blocks/main.go b/example/blocks/main.go
index 13b8f7cee..2b44592c1 100644
--- a/example/blocks/main.go
+++ b/example/blocks/main.go
@@ -42,7 +42,7 @@ func main() {
}
game := blocks.NewGame()
- update := game.Update
+ update = ebitenutil.RecordScreenAsGIF(update, f, 360)
if err := ebiten.Run(update, blocks.ScreenWidth, blocks.ScreenHeight, 2, "Blocks (Ebiten Demo)"); err != nil {
log.Fatal(err)
}
diff --git a/readme.md b/readme.md
index cc46758d6..78c01f01c 100644
--- a/readme.md
+++ b/readme.md
@@ -16,6 +16,7 @@
## Example
+* example/blocks - Puzzle game you know
* example/hue - Changes the hue of an image
* example/mosaic - Mosaics an image
* example/perspective - See an image in a perspective view
|