mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
Compare commits
3 Commits
27644555f8
...
fc3174db6c
Author | SHA1 | Date | |
---|---|---|---|
|
fc3174db6c | ||
|
9037da3cf0 | ||
|
fd49f22a6c |
@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build android
|
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -25,15 +23,8 @@ import (
|
|||||||
//go:embed gamecontrollerdb_android.txt
|
//go:embed gamecontrollerdb_android.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
|
||||||
var glfwControllerBytes []byte
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
37
internal/gamepaddb/db_glfw.go
Normal file
37
internal/gamepaddb/db_glfw.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2024 The Ebitengine Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
//go:build !android && !ios && !js && !microsoftgdk && !nintendosdk && !playstation5
|
||||||
|
|
||||||
|
package gamepaddb
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
)
|
||||||
|
|
||||||
|
var additionalGLFWGamepads = []byte(`
|
||||||
|
78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||||
|
78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||||
|
78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||||
|
78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||||
|
78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||||
|
78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||||
|
78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
|
||||||
|
`)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if err := Update(additionalGLFWGamepads); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build ios
|
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -25,15 +23,8 @@ import (
|
|||||||
//go:embed gamecontrollerdb_ios.txt
|
//go:embed gamecontrollerdb_ios.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
|
||||||
var glfwControllerBytes []byte
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,8 @@ import (
|
|||||||
//go:embed gamecontrollerdb_linbsd.txt
|
//go:embed gamecontrollerdb_linbsd.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
|
||||||
var glfwControllerBytes []byte
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build darwin && !ios
|
//go:build !ios
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
@ -25,15 +25,8 @@ import (
|
|||||||
//go:embed gamecontrollerdb_macos_darwin.txt
|
//go:embed gamecontrollerdb_macos_darwin.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
|
||||||
var glfwControllerBytes []byte
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
// Code generated by gen.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build windows && !microsoftgdk
|
//go:build !microsoftgdk
|
||||||
|
|
||||||
package gamepaddb
|
package gamepaddb
|
||||||
|
|
||||||
@ -25,15 +25,8 @@ import (
|
|||||||
//go:embed gamecontrollerdb_windows.txt
|
//go:embed gamecontrollerdb_windows.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
|
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
|
||||||
var glfwControllerBytes []byte
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -65,17 +65,11 @@ import (
|
|||||||
|
|
||||||
//go:embed gamecontrollerdb_{{.FileNameSuffix}}.txt
|
//go:embed gamecontrollerdb_{{.FileNameSuffix}}.txt
|
||||||
var controllerBytes []byte
|
var controllerBytes []byte
|
||||||
//go:embed gamecontrollerdb_glfw.txt
|
|
||||||
var glfwControllerBytes []byte
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if err := Update(controllerBytes); err != nil {
|
if err := Update(controllerBytes); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Update(glfwControllerBytes); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}`
|
}`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -96,23 +90,21 @@ func run() error {
|
|||||||
platforms := map[string]gamePadPlatform{
|
platforms := map[string]gamePadPlatform{
|
||||||
"Windows": {
|
"Windows": {
|
||||||
filenameSuffix: "windows",
|
filenameSuffix: "windows",
|
||||||
buildConstraints: "//go:build windows && !microsoftgdk",
|
buildConstraints: "//go:build !microsoftgdk",
|
||||||
},
|
},
|
||||||
"Mac OS X": {
|
"Mac OS X": {
|
||||||
filenameSuffix: "macos_darwin",
|
filenameSuffix: "macos_darwin",
|
||||||
buildConstraints: "//go:build darwin && !ios",
|
buildConstraints: "//go:build !ios",
|
||||||
},
|
},
|
||||||
"Linux": {
|
"Linux": {
|
||||||
filenameSuffix: "linbsd",
|
filenameSuffix: "linbsd",
|
||||||
buildConstraints: "//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5",
|
buildConstraints: "//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5",
|
||||||
},
|
},
|
||||||
"iOS": {
|
"iOS": {
|
||||||
filenameSuffix: "ios",
|
filenameSuffix: "ios",
|
||||||
buildConstraints: "//go:build ios",
|
|
||||||
},
|
},
|
||||||
"Android": {
|
"Android": {
|
||||||
filenameSuffix: "android",
|
filenameSuffix: "android",
|
||||||
buildConstraints: "//go:build android",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,19 +160,21 @@ func splitControllersByPlatform(controllerDB []byte) (map[string]string, error)
|
|||||||
s := bufio.NewScanner(bytes.NewReader(controllerDB))
|
s := bufio.NewScanner(bytes.NewReader(controllerDB))
|
||||||
dbs := map[string]string{}
|
dbs := map[string]string{}
|
||||||
|
|
||||||
var currentPlatform string
|
|
||||||
for s.Scan() {
|
for s.Scan() {
|
||||||
line := s.Text()
|
line := s.Text()
|
||||||
if len(line) == 0 {
|
if strings.HasPrefix(line, "#") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if line[0] == '#' {
|
parts := strings.Split(line, ",")
|
||||||
currentPlatform = strings.Replace(line, "# ", "", 1)
|
var platform string
|
||||||
continue
|
for _, part := range parts {
|
||||||
|
if strings.HasPrefix(part, "platform:") {
|
||||||
|
platform = strings.Replace(part, "platform:", "", 1)
|
||||||
|
dbs[platform] += line + "\n"
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbs[currentPlatform] += line + "\n"
|
|
||||||
}
|
}
|
||||||
if err := s.Err(); err != nil {
|
if err := s.Err(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user