mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-23 17:32:02 +01:00
all: add files for PlayStation 5
The implementation is WIP. Updates #2799
This commit is contained in:
parent
bdd68ca01a
commit
630789757f
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
@ -112,6 +112,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
go build -tags=nintendosdk -v ./...
|
go build -tags=nintendosdk -v ./...
|
||||||
|
|
||||||
|
- name: go build (PlayStation 5)
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
go build -tags=playstation5 -v ./...
|
||||||
|
|
||||||
- name: go mod vendor
|
- name: go mod vendor
|
||||||
run: |
|
run: |
|
||||||
mkdir /tmp/vendoring
|
mkdir /tmp/vendoring
|
||||||
|
11
doc.go
11
doc.go
@ -70,10 +70,11 @@
|
|||||||
// This environment variable works when RunGame is called or RunGameWithOptions is called with GraphicsLibraryAuto.
|
// This environment variable works when RunGame is called or RunGameWithOptions is called with GraphicsLibraryAuto.
|
||||||
// This can take one of the following value:
|
// This can take one of the following value:
|
||||||
//
|
//
|
||||||
// "auto": Ebitengine chooses the graphics library automatically. This is the default value.
|
// "auto": Ebitengine chooses the graphics library automatically. This is the default value.
|
||||||
// "opengl": OpenGL, OpenGL ES, or WebGL.
|
// "opengl": OpenGL, OpenGL ES, or WebGL.
|
||||||
// "directx": DirectX. This works only on Windows.
|
// "directx": DirectX. This works only on Windows.
|
||||||
// "metal": Metal. This works only on macOS or iOS.
|
// "metal": Metal. This works only on macOS or iOS.
|
||||||
|
// "playstation5": PlayStation 5. This works only on PlayStation 5.
|
||||||
//
|
//
|
||||||
// `EBITENGINE_DIRECTX` environment variable specifies various parameters for DirectX.
|
// `EBITENGINE_DIRECTX` environment variable specifies various parameters for DirectX.
|
||||||
// You can specify multiple values separated by a comma. The default value is empty (i.e. no parameters).
|
// You can specify multiple values separated by a comma. The default value is empty (i.e. no parameters).
|
||||||
@ -115,4 +116,6 @@
|
|||||||
// `nintendosdk` is for NintendoSDK (e.g. Nintendo Switch).
|
// `nintendosdk` is for NintendoSDK (e.g. Nintendo Switch).
|
||||||
//
|
//
|
||||||
// `nintendosdkprofile` enables a profiler for NintendoSDK.
|
// `nintendosdkprofile` enables a profiler for NintendoSDK.
|
||||||
|
//
|
||||||
|
// `playstation5` is for PlayStation 5.
|
||||||
package ebiten
|
package ebiten
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build microsoftgdk || nintendosdk
|
//go:build microsoftgdk || nintendosdk || playstation5
|
||||||
|
|
||||||
// This file is for some special environments using 'microsoftgdk' or 'nintendosdk'.
|
// This file is for some special environments.
|
||||||
// You usually don't have to care about this file.
|
// You usually don't have to care about this file.
|
||||||
// Actually this example works without this file in usual cases.
|
// Actually this example works without this file in usual cases.
|
||||||
|
|
||||||
|
@ -878,7 +878,7 @@ func main() {
|
|||||||
case filepath.Join("internal", "ui", "keys_mobile.go"):
|
case filepath.Join("internal", "ui", "keys_mobile.go"):
|
||||||
buildTag = "//go:build android || ios"
|
buildTag = "//go:build android || ios"
|
||||||
case filepath.Join("internal", "ui", "keys_glfw.go"):
|
case filepath.Join("internal", "ui", "keys_glfw.go"):
|
||||||
buildTag = "//go:build !android && !ios && !js && !nintendosdk"
|
buildTag = "//go:build !android && !ios && !js && !nintendosdk && !playstation5"
|
||||||
}
|
}
|
||||||
// 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 {
|
||||||
|
@ -34,6 +34,7 @@ const (
|
|||||||
type GraphicsLibrary int
|
type GraphicsLibrary int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// GraphicsLibraryAuto represents the automatic choose of graphics library by Ebitengine.
|
||||||
GraphicsLibraryAuto GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryAuto)
|
GraphicsLibraryAuto GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryAuto)
|
||||||
|
|
||||||
// GraphicsLibraryUnknown represents the state at which graphics library cannot be determined,
|
// GraphicsLibraryUnknown represents the state at which graphics library cannot be determined,
|
||||||
@ -48,6 +49,9 @@ const (
|
|||||||
|
|
||||||
// GraphicsLibraryMetal represents the graphics library Apple's Metal.
|
// GraphicsLibraryMetal represents the graphics library Apple's Metal.
|
||||||
GraphicsLibraryMetal GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryMetal)
|
GraphicsLibraryMetal GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryMetal)
|
||||||
|
|
||||||
|
// GraphicsLibraryMetal represents the graphics library PlayStation 5.
|
||||||
|
GraphicsLibraryPlayStation5 GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryPlayStation5)
|
||||||
)
|
)
|
||||||
|
|
||||||
// String returns a string representing the graphics library.
|
// String returns a string representing the graphics library.
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !nintendosdk
|
//go:build !android && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package gamepad
|
package gamepad
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !nintendosdk
|
//go:build !android && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package gamepad
|
package gamepad
|
||||||
|
|
||||||
|
32
internal/gamepad/gamepad_playstation5.go
Normal file
32
internal/gamepad/gamepad_playstation5.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2023 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 playstation5
|
||||||
|
|
||||||
|
package gamepad
|
||||||
|
|
||||||
|
type nativeGamepadsImpl struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func newNativeGamepadsImpl() nativeGamepads {
|
||||||
|
return &nativeGamepadsImpl{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *nativeGamepadsImpl) init(gamepads *gamepads) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *nativeGamepadsImpl) update(gamepads *gamepads) error {
|
||||||
|
return nil
|
||||||
|
}
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build (freebsd || linux || netbsd || openbsd) && !nintendosdk
|
//go:build (freebsd || linux || netbsd || openbsd) && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package gl
|
package gl
|
||||||
|
|
||||||
|
29
internal/graphicsdriver/opengl/gl/procaddr_null.go
Normal file
29
internal/graphicsdriver/opengl/gl/procaddr_null.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright 2023 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 playstation5
|
||||||
|
|
||||||
|
package gl
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *defaultContext) init() error {
|
||||||
|
return errors.New("gl: defaultContext is not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *defaultContext) getProcAddress(name string) (uintptr, error) {
|
||||||
|
return 0, errors.New("gl: defaultContext is not implemented")
|
||||||
|
}
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package opengl
|
package opengl
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ type graphicsDriverCreator interface {
|
|||||||
newOpenGL() (graphicsdriver.Graphics, error)
|
newOpenGL() (graphicsdriver.Graphics, error)
|
||||||
newDirectX() (graphicsdriver.Graphics, error)
|
newDirectX() (graphicsdriver.Graphics, error)
|
||||||
newMetal() (graphicsdriver.Graphics, error)
|
newMetal() (graphicsdriver.Graphics, error)
|
||||||
|
newPlayStation5() (graphicsdriver.Graphics, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newGraphicsDriver(creator graphicsDriverCreator, graphicsLibrary GraphicsLibrary) (graphicsdriver.Graphics, GraphicsLibrary, error) {
|
func newGraphicsDriver(creator graphicsDriverCreator, graphicsLibrary GraphicsLibrary) (graphicsdriver.Graphics, GraphicsLibrary, error) {
|
||||||
@ -47,6 +48,8 @@ func newGraphicsDriver(creator graphicsDriverCreator, graphicsLibrary GraphicsLi
|
|||||||
graphicsLibrary = GraphicsLibraryDirectX
|
graphicsLibrary = GraphicsLibraryDirectX
|
||||||
case "metal":
|
case "metal":
|
||||||
graphicsLibrary = GraphicsLibraryMetal
|
graphicsLibrary = GraphicsLibraryMetal
|
||||||
|
case "playstation5":
|
||||||
|
graphicsLibrary = GraphicsLibraryPlayStation5
|
||||||
default:
|
default:
|
||||||
return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified by the environment variable: %s", env)
|
return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified by the environment variable: %s", env)
|
||||||
}
|
}
|
||||||
@ -80,6 +83,12 @@ func newGraphicsDriver(creator graphicsDriverCreator, graphicsLibrary GraphicsLi
|
|||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
return g, GraphicsLibraryMetal, nil
|
return g, GraphicsLibraryMetal, nil
|
||||||
|
case GraphicsLibraryPlayStation5:
|
||||||
|
g, err := creator.newPlayStation5()
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return g, GraphicsLibraryPlayStation5, nil
|
||||||
default:
|
default:
|
||||||
return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified: %d", graphicsLibrary)
|
return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified: %d", graphicsLibrary)
|
||||||
}
|
}
|
||||||
@ -93,24 +102,27 @@ type GraphicsLibrary int
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
GraphicsLibraryAuto GraphicsLibrary = iota
|
GraphicsLibraryAuto GraphicsLibrary = iota
|
||||||
|
GraphicsLibraryUnknown
|
||||||
GraphicsLibraryOpenGL
|
GraphicsLibraryOpenGL
|
||||||
GraphicsLibraryDirectX
|
GraphicsLibraryDirectX
|
||||||
GraphicsLibraryMetal
|
GraphicsLibraryMetal
|
||||||
GraphicsLibraryUnknown
|
GraphicsLibraryPlayStation5
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g GraphicsLibrary) String() string {
|
func (g GraphicsLibrary) String() string {
|
||||||
switch g {
|
switch g {
|
||||||
case GraphicsLibraryAuto:
|
case GraphicsLibraryAuto:
|
||||||
return "Auto"
|
return "Auto"
|
||||||
|
case GraphicsLibraryUnknown:
|
||||||
|
return "Unknown"
|
||||||
case GraphicsLibraryOpenGL:
|
case GraphicsLibraryOpenGL:
|
||||||
return "OpenGL"
|
return "OpenGL"
|
||||||
case GraphicsLibraryDirectX:
|
case GraphicsLibraryDirectX:
|
||||||
return "DirectX"
|
return "DirectX"
|
||||||
case GraphicsLibraryMetal:
|
case GraphicsLibraryMetal:
|
||||||
return "Metal"
|
return "Metal"
|
||||||
case GraphicsLibraryUnknown:
|
case GraphicsLibraryPlayStation5:
|
||||||
return "Unknown"
|
return "PlayStation 5"
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("GraphicsLibrary(%d)", g)
|
return fmt.Sprintf("GraphicsLibrary(%d)", g)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
26
internal/ui/input_playstation5.go
Normal file
26
internal/ui/input_playstation5.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2023 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 playstation5
|
||||||
|
|
||||||
|
package ui
|
||||||
|
|
||||||
|
func (u *UserInterface) updateInputState() error {
|
||||||
|
// TODO: Implement this
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) KeyName(key Key) string {
|
||||||
|
return ""
|
||||||
|
}
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
// Code generated by genkeys.go using 'go generate'. DO NOT EDIT.
|
// Code generated by genkeys.go using 'go generate'. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk && !ebitenginesinglethread && !ebitensinglethread
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5 && !ebitenginesinglethread && !ebitensinglethread
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk && (ebitenginesinglethread || ebitensinglethread)
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5 && (ebitenginesinglethread || ebitensinglethread)
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
@ -116,6 +116,10 @@ func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
|
|||||||
return nil, errors.New("ui: Metal is not supported in this environment")
|
return nil, errors.New("ui: Metal is not supported in this environment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: PlayStation 5 is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
func deviceScaleFactorImpl() float64 {
|
func deviceScaleFactorImpl() float64 {
|
||||||
var s float64
|
var s float64
|
||||||
if err := app.RunOnJVM(func(vm, env, ctx uintptr) error {
|
if err := app.RunOnJVM(func(vm, env, ctx uintptr) error {
|
||||||
|
@ -193,6 +193,10 @@ func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
|
|||||||
return metal.NewGraphics()
|
return metal.NewGraphics()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: PlayStation 5 is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
// glfwMonitorSizeInGLFWPixels must be called from the main thread.
|
// glfwMonitorSizeInGLFWPixels must be called from the main thread.
|
||||||
func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) {
|
func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) {
|
||||||
vm, err := m.GetVideoMode()
|
vm, err := m.GetVideoMode()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
@ -66,6 +66,10 @@ func (g *graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error)
|
|||||||
return metal.NewGraphics()
|
return metal.NewGraphics()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: PlayStation 5 is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
func (u *UserInterface) SetUIView(uiview uintptr) error {
|
func (u *UserInterface) SetUIView(uiview uintptr) error {
|
||||||
select {
|
select {
|
||||||
case err := <-u.errCh:
|
case err := <-u.errCh:
|
||||||
|
@ -50,6 +50,10 @@ func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
|
|||||||
return nil, errors.New("ui: Metal is not supported in this environment")
|
return nil, errors.New("ui: Metal is not supported in this environment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: PlayStation 5 is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
stringNone = js.ValueOf("none")
|
stringNone = js.ValueOf("none")
|
||||||
stringTransparent = js.ValueOf("transparent")
|
stringTransparent = js.ValueOf("transparent")
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk
|
//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
@ -55,6 +55,10 @@ func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
|
|||||||
return nil, errors.New("ui: Metal is not supported in this environment")
|
return nil, errors.New("ui: Metal is not supported in this environment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: PlayStation 5 is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
// glfwMonitorSizeInGLFWPixels must be called from the main thread.
|
// glfwMonitorSizeInGLFWPixels must be called from the main thread.
|
||||||
func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) {
|
func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) {
|
||||||
vm, err := m.GetVideoMode()
|
vm, err := m.GetVideoMode()
|
||||||
|
@ -54,6 +54,10 @@ func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
|
|||||||
return nil, errors.New("ui: Metal is not supported in this environment")
|
return nil, errors.New("ui: Metal is not supported in this environment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: PlayStation 5 is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
const deviceScaleFactor = 1
|
const deviceScaleFactor = 1
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -198,6 +202,16 @@ func (*UserInterface) Window() Window {
|
|||||||
return &nullWindow{}
|
return &nullWindow{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) beginFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) endFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) updateIconIfNeeded() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Monitor struct{}
|
type Monitor struct{}
|
||||||
|
|
||||||
var theMonitor = &Monitor{}
|
var theMonitor = &Monitor{}
|
||||||
@ -219,16 +233,6 @@ func (u *UserInterface) Monitor() *Monitor {
|
|||||||
return theMonitor
|
return theMonitor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) beginFrame() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UserInterface) endFrame() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UserInterface) updateIconIfNeeded() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func IsScreenTransparentAvailable() bool {
|
func IsScreenTransparentAvailable() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
162
internal/ui/ui_playstation5.go
Normal file
162
internal/ui/ui_playstation5.go
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
// Copyright 2023 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 playstation5
|
||||||
|
|
||||||
|
package ui
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"image"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
||||||
|
)
|
||||||
|
|
||||||
|
type graphicsDriverCreatorImpl struct{}
|
||||||
|
|
||||||
|
func (g *graphicsDriverCreatorImpl) newAuto() (graphicsdriver.Graphics, GraphicsLibrary, error) {
|
||||||
|
graphics, err := g.newPlayStation5()
|
||||||
|
return graphics, GraphicsLibraryPlayStation5, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newOpenGL() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: OpenGL is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newDirectX() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: DirectX is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: Metal is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: not implemented yet")
|
||||||
|
}
|
||||||
|
|
||||||
|
const deviceScaleFactor = 1
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
}
|
||||||
|
|
||||||
|
type userInterfaceImpl struct {
|
||||||
|
graphicsDriver graphicsdriver.Graphics
|
||||||
|
|
||||||
|
context *context
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) init() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) Run(game Game, options *RunOptions) error {
|
||||||
|
// TODO: Implement this.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) DeviceScaleFactor() float64 {
|
||||||
|
return deviceScaleFactor
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) IsFocused() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) ScreenSizeInFullscreen() (int, int) {
|
||||||
|
return 0, 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) readInputState(inputState *InputState) {
|
||||||
|
// TODO: Implement this.
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) CursorMode() CursorMode {
|
||||||
|
return CursorModeHidden
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) SetCursorMode(mode CursorMode) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) CursorShape() CursorShape {
|
||||||
|
return CursorShapeDefault
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) SetCursorShape(shape CursorShape) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) IsFullscreen() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) SetFullscreen(fullscreen bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) IsRunnableOnUnfocused() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) SetRunnableOnUnfocused(runnableOnUnfocused bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) FPSMode() FPSModeType {
|
||||||
|
return FPSModeVsyncOn
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) SetFPSMode(mode FPSModeType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) ScheduleFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserInterface) Window() Window {
|
||||||
|
return &nullWindow{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) beginFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) endFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) updateIconIfNeeded() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Monitor struct{}
|
||||||
|
|
||||||
|
var theMonitor = &Monitor{}
|
||||||
|
|
||||||
|
func (m *Monitor) Bounds() image.Rectangle {
|
||||||
|
// TODO: This should return the available viewport dimensions.
|
||||||
|
return image.Rectangle{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Monitor) Name() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) AppendMonitors(mons []*Monitor) []*Monitor {
|
||||||
|
return append(mons, theMonitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) Monitor() *Monitor {
|
||||||
|
return theMonitor
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsScreenTransparentAvailable() bool {
|
||||||
|
return false
|
||||||
|
}
|
@ -89,6 +89,10 @@ func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
|
|||||||
return nil, errors.New("ui: Metal is not supported in this environment")
|
return nil, errors.New("ui: Metal is not supported in this environment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, error) {
|
||||||
|
return nil, errors.New("ui: PlayStation 5 is not supported in this environment")
|
||||||
|
}
|
||||||
|
|
||||||
// glfwMonitorSizeInGLFWPixels must be called from the main thread.
|
// glfwMonitorSizeInGLFWPixels must be called from the main thread.
|
||||||
func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) {
|
func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) {
|
||||||
vm, err := m.GetVideoMode()
|
vm, err := m.GetVideoMode()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !android && !ios && !js && !nintendosdk
|
//go:build !android && !ios && !js && !nintendosdk && !playstation5
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build (!android && !ios && !js) || nintendosdk
|
//go:build (!android && !ios && !js) || nintendosdk || playstation5
|
||||||
|
|
||||||
package vibrate
|
package vibrate
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user