mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
examples/keyboard: Fix gen.go to use LicenseComment
This commit is contained in:
parent
3264532004
commit
d66586c890
@ -21,29 +21,14 @@ import (
|
|||||||
"image/color"
|
"image/color"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
"image/png"
|
"image/png"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/examples/common"
|
"github.com/hajimehoshi/ebiten/examples/common"
|
||||||
|
"github.com/hajimehoshi/ebiten/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func licenseComment() (string, error) {
|
|
||||||
_, path, _, _ := runtime.Caller(0)
|
|
||||||
licensePath := filepath.Join(filepath.Dir(path), "..", "..", "..", "LICENSE")
|
|
||||||
l, err := ioutil.ReadFile(licensePath)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
lines := strings.Split(string(l), "\n")
|
|
||||||
license := "// " + strings.Join(lines[:len(lines)-1], "\n// ")
|
|
||||||
return license, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var keyboardKeys = [][]string{
|
var keyboardKeys = [][]string{
|
||||||
{"Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ", " ", " ", "Del"},
|
{"Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ", " ", " ", "Del"},
|
||||||
{"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", " ", " ", "BS"},
|
{"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", " ", " ", "BS"},
|
||||||
@ -189,7 +174,7 @@ func KeyRect(name string) (image.Rectangle, bool) {
|
|||||||
}`
|
}`
|
||||||
|
|
||||||
func outputKeyRectsGo(k map[string]image.Rectangle) error {
|
func outputKeyRectsGo(k map[string]image.Rectangle) error {
|
||||||
license, err := licenseComment()
|
license, err := internal.LicenseComment()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user