mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Don't use internal in example/keyboard/keyboard
This commit is contained in:
parent
714930eaf7
commit
d7a95f3142
@ -19,16 +19,31 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
"github.com/hajimehoshi/ebiten/example/common"
|
"github.com/hajimehoshi/ebiten/example/common"
|
||||||
"github.com/hajimehoshi/ebiten/internal"
|
|
||||||
"image"
|
"image"
|
||||||
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func licenseComment() (string, error) {
|
||||||
|
_, path, _, _ := runtime.Caller(0)
|
||||||
|
licensePath := filepath.Join(filepath.Dir(path), "..", "..", "..", "license.txt")
|
||||||
|
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"},
|
||||||
@ -143,7 +158,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 := internal.LicenseComment()
|
license, err := licenseComment()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user