mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
parent
5404e4d68a
commit
6e6145541d
@ -18,13 +18,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/png"
|
"image/png"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
@ -234,18 +232,13 @@ func outputKeyboardImage() (map[ebiten.Key]image.Rectangle, error) {
|
|||||||
y += height
|
y += height
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
out, err := os.Create(filepath.Join("..", "..", "resources", "images", "keyboard", "keyboard.png"))
|
||||||
if err := png.Encode(&buf, img); err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
defer out.Close()
|
||||||
|
|
||||||
cmd := exec.Command("go", "run", "github.com/hajimehoshi/file2byteslice/cmd/file2byteslice@v1.0.0",
|
if err := png.Encode(out, img); err != nil {
|
||||||
"-output", "../../resources/images/keyboard/keyboard.go",
|
|
||||||
"-package", "keyboard",
|
|
||||||
"-var", "Keyboard_png")
|
|
||||||
cmd.Stdin = &buf
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
BIN
examples/resources/images/keyboard/keyboard.png
Normal file
BIN
examples/resources/images/keyboard/keyboard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Loading…
Reference in New Issue
Block a user