mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
ebiten: rename Ebiten -> Ebitengine
This commit is contained in:
parent
44c90b42d4
commit
cdbe83177e
84
genkeys.go
84
genkeys.go
@ -33,13 +33,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
glfwKeyNameToGLFWKey map[string]glfw.Key
|
glfwKeyNameToGLFWKey map[string]glfw.Key
|
||||||
uiKeyNameToGLFWKeyName map[string]string
|
uiKeyNameToGLFWKeyName map[string]string
|
||||||
androidKeyToUIKeyName map[int]string
|
androidKeyToUIKeyName map[int]string
|
||||||
gbuildKeyToUIKeyName map[key.Code]string
|
gbuildKeyToUIKeyName map[key.Code]string
|
||||||
uiKeyNameToJSKey map[string]string
|
uiKeyNameToJSKey map[string]string
|
||||||
edgeKeyCodeToName map[int]string
|
edgeKeyCodeToName map[int]string
|
||||||
oldEbitenKeyNameToUIKeyName map[string]string
|
oldEbitengineKeyNameToUIKeyName map[string]string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -351,7 +351,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Keys for backward compatibility
|
// Keys for backward compatibility
|
||||||
oldEbitenKeyNameToUIKeyName = map[string]string{
|
oldEbitengineKeyNameToUIKeyName = map[string]string{
|
||||||
"0": "Digit0",
|
"0": "Digit0",
|
||||||
"1": "Digit1",
|
"1": "Digit1",
|
||||||
"2": "Digit2",
|
"2": "Digit2",
|
||||||
@ -482,7 +482,7 @@ type Key int
|
|||||||
|
|
||||||
// Keys.
|
// Keys.
|
||||||
const (
|
const (
|
||||||
{{range $index, $name := .EbitenKeyNamesWithoutMods}}Key{{$name}} Key = Key(ui.Key{{$name}})
|
{{range $index, $name := .EbitengineKeyNamesWithoutMods}}Key{{$name}} Key = Key(ui.Key{{$name}})
|
||||||
{{end}} KeyAlt Key = Key(ui.KeyReserved0)
|
{{end}} KeyAlt Key = Key(ui.KeyReserved0)
|
||||||
KeyControl Key = Key(ui.KeyReserved1)
|
KeyControl Key = Key(ui.KeyReserved1)
|
||||||
KeyShift Key = Key(ui.KeyReserved2)
|
KeyShift Key = Key(ui.KeyReserved2)
|
||||||
@ -491,13 +491,13 @@ const (
|
|||||||
|
|
||||||
// Keys for backward compatibility.
|
// Keys for backward compatibility.
|
||||||
// Deprecated: as of v2.1.
|
// Deprecated: as of v2.1.
|
||||||
{{range $old, $new := .OldEbitenKeyNameToUIKeyName}}Key{{$old}} Key = Key(ui.Key{{$new}})
|
{{range $old, $new := .OldEbitengineKeyNameToUIKeyName}}Key{{$old}} Key = Key(ui.Key{{$new}})
|
||||||
{{end}}
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (k Key) isValid() bool {
|
func (k Key) isValid() bool {
|
||||||
switch k {
|
switch k {
|
||||||
{{range $name := .EbitenKeyNamesWithoutOld}}case Key{{$name}}:
|
{{range $name := .EbitengineKeyNamesWithoutOld}}case Key{{$name}}:
|
||||||
return true
|
return true
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
default:
|
||||||
@ -510,7 +510,7 @@ func (k Key) isValid() bool {
|
|||||||
// If k is an undefined key, String returns an empty string.
|
// If k is an undefined key, String returns an empty string.
|
||||||
func (k Key) String() string {
|
func (k Key) String() string {
|
||||||
switch k {
|
switch k {
|
||||||
{{range $name := .EbitenKeyNamesWithoutOld}}case Key{{$name}}:
|
{{range $name := .EbitengineKeyNamesWithoutOld}}case Key{{$name}}:
|
||||||
return {{$name | printf "%q"}}
|
return {{$name | printf "%q"}}
|
||||||
{{end}}}
|
{{end}}}
|
||||||
return ""
|
return ""
|
||||||
@ -518,7 +518,7 @@ func (k Key) String() string {
|
|||||||
|
|
||||||
func keyNameToKeyCode(name string) (Key, bool) {
|
func keyNameToKeyCode(name string) (Key, bool) {
|
||||||
switch strings.ToLower(name) {
|
switch strings.ToLower(name) {
|
||||||
{{range $name := .EbitenKeyNames}}case {{$name | printf "%q" | ToLower}}:
|
{{range $name := .EbitengineKeyNames}}case {{$name | printf "%q" | ToLower}}:
|
||||||
return Key{{$name}}, true
|
return Key{{$name}}, true
|
||||||
{{end}}}
|
{{end}}}
|
||||||
return 0, false
|
return 0, false
|
||||||
@ -778,7 +778,7 @@ func main() {
|
|||||||
ebitenKeyNamesWithoutOld = append(ebitenKeyNamesWithoutOld, name)
|
ebitenKeyNamesWithoutOld = append(ebitenKeyNamesWithoutOld, name)
|
||||||
ebitenKeyNamesWithoutMods = append(ebitenKeyNamesWithoutMods, name)
|
ebitenKeyNamesWithoutMods = append(ebitenKeyNamesWithoutMods, name)
|
||||||
}
|
}
|
||||||
for old := range oldEbitenKeyNameToUIKeyName {
|
for old := range oldEbitengineKeyNameToUIKeyName {
|
||||||
ebitenKeyNames = append(ebitenKeyNames, old)
|
ebitenKeyNames = append(ebitenKeyNames, old)
|
||||||
}
|
}
|
||||||
// Keys for modifiers
|
// Keys for modifiers
|
||||||
@ -834,35 +834,35 @@ func main() {
|
|||||||
}
|
}
|
||||||
// NOTE: According to godoc, maps are automatically sorted by key.
|
// NOTE: According to godoc, maps are automatically sorted by key.
|
||||||
if err := tmpl.Execute(f, struct {
|
if err := tmpl.Execute(f, struct {
|
||||||
License string
|
License string
|
||||||
DoNotEdit string
|
DoNotEdit string
|
||||||
BuildTag string
|
BuildTag string
|
||||||
UIKeyNameToJSKey map[string]string
|
UIKeyNameToJSKey map[string]string
|
||||||
EdgeKeyCodeToName map[int]string
|
EdgeKeyCodeToName map[int]string
|
||||||
EbitenKeyNames []string
|
EbitengineKeyNames []string
|
||||||
EbitenKeyNamesWithoutOld []string
|
EbitengineKeyNamesWithoutOld []string
|
||||||
EbitenKeyNamesWithoutMods []string
|
EbitengineKeyNamesWithoutMods []string
|
||||||
GLFWKeyNameToGLFWKey map[string]glfw.Key
|
GLFWKeyNameToGLFWKey map[string]glfw.Key
|
||||||
UIKeyNames []string
|
UIKeyNames []string
|
||||||
UIKeyNameToGLFWKeyName map[string]string
|
UIKeyNameToGLFWKeyName map[string]string
|
||||||
AndroidKeyToUIKeyName map[int]string
|
AndroidKeyToUIKeyName map[int]string
|
||||||
GBuildKeyToUIKeyName map[key.Code]string
|
GBuildKeyToUIKeyName map[key.Code]string
|
||||||
OldEbitenKeyNameToUIKeyName map[string]string
|
OldEbitengineKeyNameToUIKeyName map[string]string
|
||||||
}{
|
}{
|
||||||
License: license,
|
License: license,
|
||||||
DoNotEdit: doNotEdit,
|
DoNotEdit: doNotEdit,
|
||||||
BuildTag: buildTag,
|
BuildTag: buildTag,
|
||||||
UIKeyNameToJSKey: uiKeyNameToJSKey,
|
UIKeyNameToJSKey: uiKeyNameToJSKey,
|
||||||
EdgeKeyCodeToName: edgeKeyCodeToName,
|
EdgeKeyCodeToName: edgeKeyCodeToName,
|
||||||
EbitenKeyNames: ebitenKeyNames,
|
EbitengineKeyNames: ebitenKeyNames,
|
||||||
EbitenKeyNamesWithoutOld: ebitenKeyNamesWithoutOld,
|
EbitengineKeyNamesWithoutOld: ebitenKeyNamesWithoutOld,
|
||||||
EbitenKeyNamesWithoutMods: ebitenKeyNamesWithoutMods,
|
EbitengineKeyNamesWithoutMods: ebitenKeyNamesWithoutMods,
|
||||||
GLFWKeyNameToGLFWKey: glfwKeyNameToGLFWKey,
|
GLFWKeyNameToGLFWKey: glfwKeyNameToGLFWKey,
|
||||||
UIKeyNames: uiKeyNames,
|
UIKeyNames: uiKeyNames,
|
||||||
UIKeyNameToGLFWKeyName: uiKeyNameToGLFWKeyName,
|
UIKeyNameToGLFWKeyName: uiKeyNameToGLFWKeyName,
|
||||||
AndroidKeyToUIKeyName: androidKeyToUIKeyName,
|
AndroidKeyToUIKeyName: androidKeyToUIKeyName,
|
||||||
GBuildKeyToUIKeyName: gbuildKeyToUIKeyName,
|
GBuildKeyToUIKeyName: gbuildKeyToUIKeyName,
|
||||||
OldEbitenKeyNameToUIKeyName: oldEbitenKeyNameToUIKeyName,
|
OldEbitengineKeyNameToUIKeyName: oldEbitengineKeyNameToUIKeyName,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user