From 630789757fadd89040022553521efdc31da72cc6 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 1 Oct 2023 23:14:47 +0900 Subject: [PATCH] all: add files for PlayStation 5 The implementation is WIP. Updates #2799 --- .github/workflows/test.yml | 5 + doc.go | 11 +- examples/flappy/main_c.go | 4 +- genkeys.go | 2 +- graphics.go | 4 + internal/gamepad/api_linux.go | 2 +- internal/gamepad/gamepad_linux.go | 2 +- internal/gamepad/gamepad_playstation5.go | 32 ++++ .../opengl/gl/procaddr_linbsd.go | 2 +- .../graphicsdriver/opengl/gl/procaddr_null.go | 29 ++++ .../graphicsdriver/opengl/graphics_glfw.go | 2 +- internal/ui/graphics.go | 18 +- internal/ui/input_glfw.go | 2 +- internal/ui/input_playstation5.go | 26 +++ internal/ui/keys_glfw.go | 2 +- internal/ui/monitor_glfw.go | 2 +- internal/ui/run_glfw_notsinglethread.go | 2 +- internal/ui/run_glfw_singlethread.go | 2 +- internal/ui/ui_android.go | 4 + internal/ui/ui_darwin.go | 4 + internal/ui/ui_glfw.go | 2 +- internal/ui/ui_ios.go | 4 + internal/ui/ui_js.go | 4 + internal/ui/ui_linbsd.go | 6 +- internal/ui/ui_nintendosdk.go | 24 +-- internal/ui/ui_playstation5.go | 162 ++++++++++++++++++ internal/ui/ui_windows.go | 4 + internal/ui/window_glfw.go | 2 +- internal/vibrate/vibrate_null.go | 2 +- 29 files changed, 334 insertions(+), 33 deletions(-) create mode 100644 internal/gamepad/gamepad_playstation5.go create mode 100644 internal/graphicsdriver/opengl/gl/procaddr_null.go create mode 100644 internal/ui/input_playstation5.go create mode 100644 internal/ui/ui_playstation5.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed0de1ab9..b031b7911 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -112,6 +112,11 @@ jobs: run: | go build -tags=nintendosdk -v ./... + - name: go build (PlayStation 5) + if: runner.os == 'Linux' + run: | + go build -tags=playstation5 -v ./... + - name: go mod vendor run: | mkdir /tmp/vendoring diff --git a/doc.go b/doc.go index f3824557a..7ceec1222 100644 --- a/doc.go +++ b/doc.go @@ -70,10 +70,11 @@ // This environment variable works when RunGame is called or RunGameWithOptions is called with GraphicsLibraryAuto. // This can take one of the following value: // -// "auto": Ebitengine chooses the graphics library automatically. This is the default value. -// "opengl": OpenGL, OpenGL ES, or WebGL. -// "directx": DirectX. This works only on Windows. -// "metal": Metal. This works only on macOS or iOS. +// "auto": Ebitengine chooses the graphics library automatically. This is the default value. +// "opengl": OpenGL, OpenGL ES, or WebGL. +// "directx": DirectX. This works only on Windows. +// "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. // 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). // // `nintendosdkprofile` enables a profiler for NintendoSDK. +// +// `playstation5` is for PlayStation 5. package ebiten diff --git a/examples/flappy/main_c.go b/examples/flappy/main_c.go index 79d5e570d..32ac3351d 100644 --- a/examples/flappy/main_c.go +++ b/examples/flappy/main_c.go @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // 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. // Actually this example works without this file in usual cases. diff --git a/genkeys.go b/genkeys.go index 3fa34ba09..a837c86e9 100644 --- a/genkeys.go +++ b/genkeys.go @@ -878,7 +878,7 @@ func main() { case filepath.Join("internal", "ui", "keys_mobile.go"): buildTag = "//go:build android || ios" 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. if err := tmpl.Execute(f, struct { diff --git a/graphics.go b/graphics.go index 30dd9b865..de18ca376 100644 --- a/graphics.go +++ b/graphics.go @@ -34,6 +34,7 @@ const ( type GraphicsLibrary int const ( + // GraphicsLibraryAuto represents the automatic choose of graphics library by Ebitengine. GraphicsLibraryAuto GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryAuto) // 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 GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryMetal) + + // GraphicsLibraryMetal represents the graphics library PlayStation 5. + GraphicsLibraryPlayStation5 GraphicsLibrary = GraphicsLibrary(ui.GraphicsLibraryPlayStation5) ) // String returns a string representing the graphics library. diff --git a/internal/gamepad/api_linux.go b/internal/gamepad/api_linux.go index 9ac2f9263..25cfd4fcc 100644 --- a/internal/gamepad/api_linux.go +++ b/internal/gamepad/api_linux.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !nintendosdk +//go:build !android && !nintendosdk && !playstation5 package gamepad diff --git a/internal/gamepad/gamepad_linux.go b/internal/gamepad/gamepad_linux.go index 50932f7c5..0134f7c7e 100644 --- a/internal/gamepad/gamepad_linux.go +++ b/internal/gamepad/gamepad_linux.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !nintendosdk +//go:build !android && !nintendosdk && !playstation5 package gamepad diff --git a/internal/gamepad/gamepad_playstation5.go b/internal/gamepad/gamepad_playstation5.go new file mode 100644 index 000000000..ddb753d0a --- /dev/null +++ b/internal/gamepad/gamepad_playstation5.go @@ -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 +} diff --git a/internal/graphicsdriver/opengl/gl/procaddr_linbsd.go b/internal/graphicsdriver/opengl/gl/procaddr_linbsd.go index 232a35348..3047376c6 100644 --- a/internal/graphicsdriver/opengl/gl/procaddr_linbsd.go +++ b/internal/graphicsdriver/opengl/gl/procaddr_linbsd.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build (freebsd || linux || netbsd || openbsd) && !nintendosdk +//go:build (freebsd || linux || netbsd || openbsd) && !nintendosdk && !playstation5 package gl diff --git a/internal/graphicsdriver/opengl/gl/procaddr_null.go b/internal/graphicsdriver/opengl/gl/procaddr_null.go new file mode 100644 index 000000000..0ba018d6f --- /dev/null +++ b/internal/graphicsdriver/opengl/gl/procaddr_null.go @@ -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") +} diff --git a/internal/graphicsdriver/opengl/graphics_glfw.go b/internal/graphicsdriver/opengl/graphics_glfw.go index af3258de0..876ddfd46 100644 --- a/internal/graphicsdriver/opengl/graphics_glfw.go +++ b/internal/graphicsdriver/opengl/graphics_glfw.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !ios && !js && !nintendosdk +//go:build !android && !ios && !js && !nintendosdk && !playstation5 package opengl diff --git a/internal/ui/graphics.go b/internal/ui/graphics.go index 1f24ea83e..a76202ec4 100644 --- a/internal/ui/graphics.go +++ b/internal/ui/graphics.go @@ -26,6 +26,7 @@ type graphicsDriverCreator interface { newOpenGL() (graphicsdriver.Graphics, error) newDirectX() (graphicsdriver.Graphics, error) newMetal() (graphicsdriver.Graphics, error) + newPlayStation5() (graphicsdriver.Graphics, error) } func newGraphicsDriver(creator graphicsDriverCreator, graphicsLibrary GraphicsLibrary) (graphicsdriver.Graphics, GraphicsLibrary, error) { @@ -47,6 +48,8 @@ func newGraphicsDriver(creator graphicsDriverCreator, graphicsLibrary GraphicsLi graphicsLibrary = GraphicsLibraryDirectX case "metal": graphicsLibrary = GraphicsLibraryMetal + case "playstation5": + graphicsLibrary = GraphicsLibraryPlayStation5 default: 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 g, GraphicsLibraryMetal, nil + case GraphicsLibraryPlayStation5: + g, err := creator.newPlayStation5() + if err != nil { + return nil, 0, err + } + return g, GraphicsLibraryPlayStation5, nil default: return nil, 0, fmt.Errorf("ui: an unsupported graphics library is specified: %d", graphicsLibrary) } @@ -93,24 +102,27 @@ type GraphicsLibrary int const ( GraphicsLibraryAuto GraphicsLibrary = iota + GraphicsLibraryUnknown GraphicsLibraryOpenGL GraphicsLibraryDirectX GraphicsLibraryMetal - GraphicsLibraryUnknown + GraphicsLibraryPlayStation5 ) func (g GraphicsLibrary) String() string { switch g { case GraphicsLibraryAuto: return "Auto" + case GraphicsLibraryUnknown: + return "Unknown" case GraphicsLibraryOpenGL: return "OpenGL" case GraphicsLibraryDirectX: return "DirectX" case GraphicsLibraryMetal: return "Metal" - case GraphicsLibraryUnknown: - return "Unknown" + case GraphicsLibraryPlayStation5: + return "PlayStation 5" default: return fmt.Sprintf("GraphicsLibrary(%d)", g) } diff --git a/internal/ui/input_glfw.go b/internal/ui/input_glfw.go index 5d7abecee..feee4a7eb 100644 --- a/internal/ui/input_glfw.go +++ b/internal/ui/input_glfw.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !ios && !js && !nintendosdk +//go:build !android && !ios && !js && !nintendosdk && !playstation5 package ui diff --git a/internal/ui/input_playstation5.go b/internal/ui/input_playstation5.go new file mode 100644 index 000000000..89cd2975d --- /dev/null +++ b/internal/ui/input_playstation5.go @@ -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 "" +} diff --git a/internal/ui/keys_glfw.go b/internal/ui/keys_glfw.go index 04e424002..96a273cf6 100644 --- a/internal/ui/keys_glfw.go +++ b/internal/ui/keys_glfw.go @@ -14,7 +14,7 @@ // 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 diff --git a/internal/ui/monitor_glfw.go b/internal/ui/monitor_glfw.go index db5b6786c..6509d3d89 100644 --- a/internal/ui/monitor_glfw.go +++ b/internal/ui/monitor_glfw.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !ios && !js && !nintendosdk +//go:build !android && !ios && !js && !nintendosdk && !playstation5 package ui diff --git a/internal/ui/run_glfw_notsinglethread.go b/internal/ui/run_glfw_notsinglethread.go index 83aa2f248..ea18337c0 100644 --- a/internal/ui/run_glfw_notsinglethread.go +++ b/internal/ui/run_glfw_notsinglethread.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !ios && !js && !nintendosdk && !ebitenginesinglethread && !ebitensinglethread +//go:build !android && !ios && !js && !nintendosdk && !playstation5 && !ebitenginesinglethread && !ebitensinglethread package ui diff --git a/internal/ui/run_glfw_singlethread.go b/internal/ui/run_glfw_singlethread.go index f2b683d96..a55ca2022 100644 --- a/internal/ui/run_glfw_singlethread.go +++ b/internal/ui/run_glfw_singlethread.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !ios && !js && !nintendosdk && (ebitenginesinglethread || ebitensinglethread) +//go:build !android && !ios && !js && !nintendosdk && !playstation5 && (ebitenginesinglethread || ebitensinglethread) package ui diff --git a/internal/ui/ui_android.go b/internal/ui/ui_android.go index 2a69cd889..aee79866a 100644 --- a/internal/ui/ui_android.go +++ b/internal/ui/ui_android.go @@ -116,6 +116,10 @@ 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: PlayStation 5 is not supported in this environment") +} + func deviceScaleFactorImpl() float64 { var s float64 if err := app.RunOnJVM(func(vm, env, ctx uintptr) error { diff --git a/internal/ui/ui_darwin.go b/internal/ui/ui_darwin.go index 0525b3684..cae128b77 100644 --- a/internal/ui/ui_darwin.go +++ b/internal/ui/ui_darwin.go @@ -193,6 +193,10 @@ func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) { 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. func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) { vm, err := m.GetVideoMode() diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index ad85f6380..5f558666a 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !ios && !js && !nintendosdk +//go:build !android && !ios && !js && !nintendosdk && !playstation5 package ui diff --git a/internal/ui/ui_ios.go b/internal/ui/ui_ios.go index 9726f18a3..399ac3e3d 100644 --- a/internal/ui/ui_ios.go +++ b/internal/ui/ui_ios.go @@ -66,6 +66,10 @@ func (g *graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) 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 { select { case err := <-u.errCh: diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index 073cc3533..678bbbe25 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -50,6 +50,10 @@ 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: PlayStation 5 is not supported in this environment") +} + var ( stringNone = js.ValueOf("none") stringTransparent = js.ValueOf("transparent") diff --git a/internal/ui/ui_linbsd.go b/internal/ui/ui_linbsd.go index ba97c82c2..bd07899d7 100644 --- a/internal/ui/ui_linbsd.go +++ b/internal/ui/ui_linbsd.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk +//go:build (freebsd || (linux && !android) || netbsd || openbsd) && !nintendosdk && !playstation5 package ui @@ -55,6 +55,10 @@ 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: PlayStation 5 is not supported in this environment") +} + // glfwMonitorSizeInGLFWPixels must be called from the main thread. func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) { vm, err := m.GetVideoMode() diff --git a/internal/ui/ui_nintendosdk.go b/internal/ui/ui_nintendosdk.go index f80800e33..8677ecf83 100644 --- a/internal/ui/ui_nintendosdk.go +++ b/internal/ui/ui_nintendosdk.go @@ -54,6 +54,10 @@ 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: PlayStation 5 is not supported in this environment") +} + const deviceScaleFactor = 1 func init() { @@ -198,6 +202,16 @@ 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{} @@ -219,16 +233,6 @@ func (u *UserInterface) Monitor() *Monitor { return theMonitor } -func (u *UserInterface) beginFrame() { -} - -func (u *UserInterface) endFrame() { -} - -func (u *UserInterface) updateIconIfNeeded() error { - return nil -} - func IsScreenTransparentAvailable() bool { return false } diff --git a/internal/ui/ui_playstation5.go b/internal/ui/ui_playstation5.go new file mode 100644 index 000000000..4926b8912 --- /dev/null +++ b/internal/ui/ui_playstation5.go @@ -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 +} diff --git a/internal/ui/ui_windows.go b/internal/ui/ui_windows.go index 56aa24b48..1987eb8a7 100644 --- a/internal/ui/ui_windows.go +++ b/internal/ui/ui_windows.go @@ -89,6 +89,10 @@ 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: PlayStation 5 is not supported in this environment") +} + // glfwMonitorSizeInGLFWPixels must be called from the main thread. func glfwMonitorSizeInGLFWPixels(m *glfw.Monitor) (int, int, error) { vm, err := m.GetVideoMode() diff --git a/internal/ui/window_glfw.go b/internal/ui/window_glfw.go index e8ae748c0..f3883bc35 100644 --- a/internal/ui/window_glfw.go +++ b/internal/ui/window_glfw.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !android && !ios && !js && !nintendosdk +//go:build !android && !ios && !js && !nintendosdk && !playstation5 package ui diff --git a/internal/vibrate/vibrate_null.go b/internal/vibrate/vibrate_null.go index 0c333f99d..48827ae8a 100644 --- a/internal/vibrate/vibrate_null.go +++ b/internal/vibrate/vibrate_null.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build (!android && !ios && !js) || nintendosdk +//go:build (!android && !ios && !js) || nintendosdk || playstation5 package vibrate