From c4ce1b3503baaa906525c72fae4af89a9bbfc21b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 29 Oct 2023 19:12:55 +0900 Subject: [PATCH] internal/ui: start implementing UserInterface for PS5 Updates #2799 --- internal/ui/ui_playstation5.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/internal/ui/ui_playstation5.go b/internal/ui/ui_playstation5.go index 4a2a6d802..47efaa6b4 100644 --- a/internal/ui/ui_playstation5.go +++ b/internal/ui/ui_playstation5.go @@ -47,7 +47,12 @@ func (*graphicsDriverCreatorImpl) newPlayStation5() (graphicsdriver.Graphics, er return nil, errors.New("ui: not implemented yet") } -const deviceScaleFactor = 1 +const ( + // TODO: Get this value from the SDK. + screenWidth = 3840 + screenHeight = 2160 + deviceScaleFactor = 1 +) func init() { runtime.LockOSThread() @@ -68,11 +73,22 @@ func (u *UserInterface) Run(game Game, options *RunOptions) error { } func (u *UserInterface) initOnMainThread(options *RunOptions) error { + g, lib, err := newGraphicsDriver(&graphicsDriverCreatorImpl{}, options.GraphicsLibrary) + if err != nil { + return err + } + u.graphicsDriver = g + u.setGraphicsLibrary(lib) + return nil } func (u *UserInterface) loopGame() error { - // TODO: Implement this + for { + if err := u.context.updateFrame(u.graphicsDriver, screenWidth, screenHeight, deviceScaleFactor, u, nil); err != nil { + return err + } + } return nil }