Move driver getters to graphicsdriver/uidriver packages

This enables to add internal functions to these packages so that
the driver selector logics can be modified.
This commit is contained in:
Hajime Hoshi 2019-07-31 22:01:45 +09:00
parent e434869dd7
commit de915a1736
10 changed files with 58 additions and 53 deletions

View File

@ -16,6 +16,7 @@ package ebiten
import ( import (
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/uidriver"
) )
// InputChars return "printable" runes read from the keyboard at the time update is called. // InputChars return "printable" runes read from the keyboard at the time update is called.
@ -28,7 +29,7 @@ import (
// //
// InputChars is concurrent-safe. // InputChars is concurrent-safe.
func InputChars() []rune { func InputChars() []rune {
rb := uiDriver().Input().RuneBuffer() rb := uidriver.Get().Input().RuneBuffer()
return append(make([]rune, 0, len(rb)), rb...) return append(make([]rune, 0, len(rb)), rb...)
} }
@ -41,7 +42,7 @@ func InputChars() []rune {
// //
// IsKeyPressed is concurrent-safe. // IsKeyPressed is concurrent-safe.
func IsKeyPressed(key Key) bool { func IsKeyPressed(key Key) bool {
return uiDriver().Input().IsKeyPressed(driver.Key(key)) return uidriver.Get().Input().IsKeyPressed(driver.Key(key))
} }
// CursorPosition returns a position of a mouse cursor relative to the game screen (window). The cursor position is // CursorPosition returns a position of a mouse cursor relative to the game screen (window). The cursor position is
@ -49,7 +50,7 @@ func IsKeyPressed(key Key) bool {
// //
// CursorPosition is concurrent-safe. // CursorPosition is concurrent-safe.
func CursorPosition() (x, y int) { func CursorPosition() (x, y int) {
return uiDriver().Input().CursorPosition() return uidriver.Get().Input().CursorPosition()
} }
// Wheel returns the x and y offset of the mouse wheel or touchpad scroll. // Wheel returns the x and y offset of the mouse wheel or touchpad scroll.
@ -57,7 +58,7 @@ func CursorPosition() (x, y int) {
// //
// Wheel is concurrent-safe. // Wheel is concurrent-safe.
func Wheel() (xoff, yoff float64) { func Wheel() (xoff, yoff float64) {
return uiDriver().Input().Wheel() return uidriver.Get().Input().Wheel()
} }
// IsMouseButtonPressed returns a boolean indicating whether mouseButton is pressed. // IsMouseButtonPressed returns a boolean indicating whether mouseButton is pressed.
@ -67,7 +68,7 @@ func Wheel() (xoff, yoff float64) {
// Note that touch events not longer affect IsMouseButtonPressed's result as of 1.4.0-alpha. // Note that touch events not longer affect IsMouseButtonPressed's result as of 1.4.0-alpha.
// Use Touches instead. // Use Touches instead.
func IsMouseButtonPressed(mouseButton MouseButton) bool { func IsMouseButtonPressed(mouseButton MouseButton) bool {
return uiDriver().Input().IsMouseButtonPressed(driver.MouseButton(mouseButton)) return uidriver.Get().Input().IsMouseButtonPressed(driver.MouseButton(mouseButton))
} }
// GamepadIDs returns a slice indicating available gamepad IDs. // GamepadIDs returns a slice indicating available gamepad IDs.
@ -76,7 +77,7 @@ func IsMouseButtonPressed(mouseButton MouseButton) bool {
// //
// GamepadIDs always returns an empty slice on mobiles. // GamepadIDs always returns an empty slice on mobiles.
func GamepadIDs() []int { func GamepadIDs() []int {
return uiDriver().Input().GamepadIDs() return uidriver.Get().Input().GamepadIDs()
} }
// GamepadAxisNum returns the number of axes of the gamepad (id). // GamepadAxisNum returns the number of axes of the gamepad (id).
@ -85,7 +86,7 @@ func GamepadIDs() []int {
// //
// GamepadAxisNum always returns 0 on mobiles. // GamepadAxisNum always returns 0 on mobiles.
func GamepadAxisNum(id int) int { func GamepadAxisNum(id int) int {
return uiDriver().Input().GamepadAxisNum(id) return uidriver.Get().Input().GamepadAxisNum(id)
} }
// GamepadAxis returns the float value [-1.0 - 1.0] of the given gamepad (id)'s axis (axis). // GamepadAxis returns the float value [-1.0 - 1.0] of the given gamepad (id)'s axis (axis).
@ -94,7 +95,7 @@ func GamepadAxisNum(id int) int {
// //
// GamepadAxis always returns 0 on mobiles. // GamepadAxis always returns 0 on mobiles.
func GamepadAxis(id int, axis int) float64 { func GamepadAxis(id int, axis int) float64 {
return uiDriver().Input().GamepadAxis(id, axis) return uidriver.Get().Input().GamepadAxis(id, axis)
} }
// GamepadButtonNum returns the number of the buttons of the given gamepad (id). // GamepadButtonNum returns the number of the buttons of the given gamepad (id).
@ -103,7 +104,7 @@ func GamepadAxis(id int, axis int) float64 {
// //
// GamepadButtonNum always returns 0 on mobiles. // GamepadButtonNum always returns 0 on mobiles.
func GamepadButtonNum(id int) int { func GamepadButtonNum(id int) int {
return uiDriver().Input().GamepadButtonNum(id) return uidriver.Get().Input().GamepadButtonNum(id)
} }
// IsGamepadButtonPressed returns the boolean indicating the given button of the gamepad (id) is pressed or not. // IsGamepadButtonPressed returns the boolean indicating the given button of the gamepad (id) is pressed or not.
@ -115,7 +116,7 @@ func GamepadButtonNum(id int) int {
// //
// IsGamepadButtonPressed always returns false on mobiles. // IsGamepadButtonPressed always returns false on mobiles.
func IsGamepadButtonPressed(id int, button GamepadButton) bool { func IsGamepadButtonPressed(id int, button GamepadButton) bool {
return uiDriver().Input().IsGamepadButtonPressed(id, driver.GamepadButton(button)) return uidriver.Get().Input().IsGamepadButtonPressed(id, driver.GamepadButton(button))
} }
// TouchIDs returns the current touch states. // TouchIDs returns the current touch states.
@ -125,7 +126,7 @@ func IsGamepadButtonPressed(id int, button GamepadButton) bool {
// //
// TouchIDs is concurrent-safe. // TouchIDs is concurrent-safe.
func TouchIDs() []int { func TouchIDs() []int {
return uiDriver().Input().TouchIDs() return uidriver.Get().Input().TouchIDs()
} }
// TouchPosition returns the position for the touch of the specified ID. // TouchPosition returns the position for the touch of the specified ID.
@ -135,7 +136,7 @@ func TouchIDs() []int {
// TouchPosition is cuncurrent-safe. // TouchPosition is cuncurrent-safe.
func TouchPosition(id int) (int, int) { func TouchPosition(id int) (int, int) {
found := false found := false
for _, i := range uiDriver().Input().TouchIDs() { for _, i := range uidriver.Get().Input().TouchIDs() {
if id == i { if id == i {
found = true found = true
break break
@ -145,7 +146,7 @@ func TouchPosition(id int) (int, int) {
return 0, 0 return 0, 0
} }
return uiDriver().Input().TouchPosition(id) return uidriver.Get().Input().TouchPosition(id)
} }
// Touch is deprecated as of 1.7.0. Use TouchPosition instead. // Touch is deprecated as of 1.7.0. Use TouchPosition instead.

View File

@ -15,7 +15,7 @@
// +build darwin,!ios // +build darwin,!ios
// +build !js // +build !js
package ebiten package graphicsdriver
// #cgo CFLAGS: -x objective-c // #cgo CFLAGS: -x objective-c
// #cgo LDFLAGS: -framework Foundation // #cgo LDFLAGS: -framework Foundation
@ -47,7 +47,7 @@ var (
isMetalSupportedOnce sync.Once isMetalSupportedOnce sync.Once
) )
func graphicsDriver() driver.Graphics { func Get() driver.Graphics {
isMetalSupportedOnce.Do(func() { isMetalSupportedOnce.Do(func() {
// On old mac devices like iMac 2011, Metal is not supported (#779). // On old mac devices like iMac 2011, Metal is not supported (#779).
if _, err := mtl.CreateSystemDefaultDevice(); err != nil { if _, err := mtl.CreateSystemDefaultDevice(); err != nil {

View File

@ -16,13 +16,13 @@
// As the Go playground tries to compile this with CGO_ENABLED=0 and GOOS=linux, check Cgo on build tags. // As the Go playground tries to compile this with CGO_ENABLED=0 and GOOS=linux, check Cgo on build tags.
package ebiten package graphicsdriver
import ( import (
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/graphicsdriver/opengl" "github.com/hajimehoshi/ebiten/internal/graphicsdriver/opengl"
) )
func graphicsDriver() driver.Graphics { func Get() driver.Graphics {
return opengl.Get() return opengl.Get()
} }

View File

@ -20,13 +20,13 @@
// +build !linux,cgo !cgo // +build !linux,cgo !cgo
// +build !windows // +build !windows
package ebiten package graphicsdriver
import ( import (
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
) )
func graphicsDriver() driver.Graphics { func Get() driver.Graphics {
if !isPlayground { if !isPlayground {
panic("ebiten: a graphics driver is not implemented on this environment") panic("ebiten: a graphics driver is not implemented on this environment")
} }

View File

@ -17,13 +17,13 @@
// +build !ios // +build !ios
// +build !js // +build !js
package ebiten package uidriver
import ( import (
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/uidriver/glfw" "github.com/hajimehoshi/ebiten/internal/uidriver/glfw"
) )
func uiDriver() driver.UI { func Get() driver.UI {
return glfw.Get() return glfw.Get()
} }

View File

@ -14,13 +14,13 @@
// +build js // +build js
package ebiten package uidriver
import ( import (
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/uidriver/js" "github.com/hajimehoshi/ebiten/internal/uidriver/js"
) )
func uiDriver() driver.UI { func Get() driver.UI {
return js.Get() return js.Get()
} }

View File

@ -14,13 +14,13 @@
// +build android ios // +build android ios
package ebiten package uidriver
import ( import (
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/uidriver/mobile" "github.com/hajimehoshi/ebiten/internal/uidriver/mobile"
) )
func uiDriver() driver.UI { func Get() driver.UI {
return mobile.Get() return mobile.Get()
} }

View File

@ -20,13 +20,13 @@
// +build !linux,cgo !cgo // +build !linux,cgo !cgo
// +build !windows // +build !windows
package ebiten package uidriver
import ( import (
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
) )
func uiDriver() driver.UI { func Get() driver.UI {
if !isPlayground { if !isPlayground {
panic("ebiten: a UI driver is not implemented on this environment") panic("ebiten: a UI driver is not implemented on this environment")
} }

44
run.go
View File

@ -21,6 +21,8 @@ import (
"github.com/hajimehoshi/ebiten/internal/clock" "github.com/hajimehoshi/ebiten/internal/clock"
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/graphicsdriver"
"github.com/hajimehoshi/ebiten/internal/uidriver"
"github.com/hajimehoshi/ebiten/internal/web" "github.com/hajimehoshi/ebiten/internal/web"
) )
@ -142,7 +144,7 @@ func Run(f func(*Image) error, width, height int, scale float64, title string) e
defer atomic.StoreInt32(&isRunning, 0) defer atomic.StoreInt32(&isRunning, 0)
} }
if err := uiDriver().Run(width, height, scale, title, c, graphicsDriver()); err != nil { if err := uidriver.Get().Run(width, height, scale, title, c, graphicsdriver.Get()); err != nil {
if err == driver.RegularTermination { if err == driver.RegularTermination {
return nil return nil
} }
@ -164,7 +166,7 @@ func RunWithoutMainLoop(f func(*Image) error, width, height int, scale float64,
theUIContext.Store(c) theUIContext.Store(c)
atomic.StoreInt32(&isRunning, 1) atomic.StoreInt32(&isRunning, 1)
return uiDriver().RunWithoutMainLoop(width, height, scale, title, c, graphicsDriver()) return uidriver.Get().RunWithoutMainLoop(width, height, scale, title, c, graphicsdriver.Get())
} }
// ScreenSizeInFullscreen returns the size in device-independent pixels when the game is fullscreen. // ScreenSizeInFullscreen returns the size in device-independent pixels when the game is fullscreen.
@ -196,7 +198,7 @@ func RunWithoutMainLoop(f func(*Image) error, width, height int, scale float64,
// //
// ScreenSizeInFullscreen must be called on the main thread before ebiten.Run, and is concurrent-safe after ebiten.Run. // ScreenSizeInFullscreen must be called on the main thread before ebiten.Run, and is concurrent-safe after ebiten.Run.
func ScreenSizeInFullscreen() (int, int) { func ScreenSizeInFullscreen() (int, int) {
return uiDriver().ScreenSizeInFullscreen() return uidriver.Get().ScreenSizeInFullscreen()
} }
// MonitorSize is deprecated as of 1.8.0-alpha. Use ScreenSizeInFullscreen instead. // MonitorSize is deprecated as of 1.8.0-alpha. Use ScreenSizeInFullscreen instead.
@ -214,7 +216,7 @@ func SetScreenSize(width, height int) {
if width <= 0 || height <= 0 { if width <= 0 || height <= 0 {
panic("ebiten: width and height must be positive") panic("ebiten: width and height must be positive")
} }
uiDriver().SetScreenSize(width, height) uidriver.Get().SetScreenSize(width, height)
} }
// SetScreenScale changes the scale of the screen. // SetScreenScale changes the scale of the screen.
@ -230,7 +232,7 @@ func SetScreenScale(scale float64) {
if scale <= 0 { if scale <= 0 {
panic("ebiten: scale must be positive") panic("ebiten: scale must be positive")
} }
uiDriver().SetScreenScale(scale) uidriver.Get().SetScreenScale(scale)
} }
// ScreenScale returns the current screen scale. // ScreenScale returns the current screen scale.
@ -239,7 +241,7 @@ func SetScreenScale(scale float64) {
// //
// ScreenScale is concurrent-safe. // ScreenScale is concurrent-safe.
func ScreenScale() float64 { func ScreenScale() float64 {
return uiDriver().ScreenScale() return uidriver.Get().ScreenScale()
} }
// IsCursorVisible returns a boolean value indicating whether // IsCursorVisible returns a boolean value indicating whether
@ -249,7 +251,7 @@ func ScreenScale() float64 {
// //
// IsCursorVisible is concurrent-safe. // IsCursorVisible is concurrent-safe.
func IsCursorVisible() bool { func IsCursorVisible() bool {
return uiDriver().IsCursorVisible() return uidriver.Get().IsCursorVisible()
} }
// SetCursorVisible changes the state of cursor visiblity. // SetCursorVisible changes the state of cursor visiblity.
@ -258,7 +260,7 @@ func IsCursorVisible() bool {
// //
// SetCursorVisible is concurrent-safe. // SetCursorVisible is concurrent-safe.
func SetCursorVisible(visible bool) { func SetCursorVisible(visible bool) {
uiDriver().SetCursorVisible(visible) uidriver.Get().SetCursorVisible(visible)
} }
// SetCursorVisibility is deprecated as of 1.6.0-alpha. Use SetCursorVisible instead. // SetCursorVisibility is deprecated as of 1.6.0-alpha. Use SetCursorVisible instead.
@ -273,7 +275,7 @@ func SetCursorVisibility(visible bool) {
// //
// IsFullscreen is concurrent-safe. // IsFullscreen is concurrent-safe.
func IsFullscreen() bool { func IsFullscreen() bool {
return uiDriver().IsFullscreen() return uidriver.Get().IsFullscreen()
} }
// SetFullscreen changes the current mode to fullscreen or not. // SetFullscreen changes the current mode to fullscreen or not.
@ -294,7 +296,7 @@ func IsFullscreen() bool {
// //
// SetFullscreen is concurrent-safe. // SetFullscreen is concurrent-safe.
func SetFullscreen(fullscreen bool) { func SetFullscreen(fullscreen bool) {
uiDriver().SetFullscreen(fullscreen) uidriver.Get().SetFullscreen(fullscreen)
} }
// IsRunnableInBackground returns a boolean value indicating whether // IsRunnableInBackground returns a boolean value indicating whether
@ -302,7 +304,7 @@ func SetFullscreen(fullscreen bool) {
// //
// IsRunnableInBackground is concurrent-safe. // IsRunnableInBackground is concurrent-safe.
func IsRunnableInBackground() bool { func IsRunnableInBackground() bool {
return uiDriver().IsRunnableInBackground() return uidriver.Get().IsRunnableInBackground()
} }
// SetWindowDecorated sets the state if the window is decorated. // SetWindowDecorated sets the state if the window is decorated.
@ -316,14 +318,14 @@ func IsRunnableInBackground() bool {
// //
// SetWindowDecorated is concurrent-safe. // SetWindowDecorated is concurrent-safe.
func SetWindowDecorated(decorated bool) { func SetWindowDecorated(decorated bool) {
uiDriver().SetWindowDecorated(decorated) uidriver.Get().SetWindowDecorated(decorated)
} }
// IsWindowDecorated reports whether the window is decorated. // IsWindowDecorated reports whether the window is decorated.
// //
// IsWindowDecorated is concurrent-safe. // IsWindowDecorated is concurrent-safe.
func IsWindowDecorated() bool { func IsWindowDecorated() bool {
return uiDriver().IsWindowDecorated() return uidriver.Get().IsWindowDecorated()
} }
// setWindowResizable is unexported until specification is determined (#320) // setWindowResizable is unexported until specification is determined (#320)
@ -341,14 +343,14 @@ func IsWindowDecorated() bool {
// //
// setWindowResizable is concurrent-safe. // setWindowResizable is concurrent-safe.
func setWindowResizable(resizable bool) { func setWindowResizable(resizable bool) {
uiDriver().SetWindowResizable(resizable) uidriver.Get().SetWindowResizable(resizable)
} }
// IsWindowResizable reports whether the window is resizable. // IsWindowResizable reports whether the window is resizable.
// //
// IsWindowResizable is concurrent-safe. // IsWindowResizable is concurrent-safe.
func IsWindowResizable() bool { func IsWindowResizable() bool {
return uiDriver().IsWindowResizable() return uidriver.Get().IsWindowResizable()
} }
// SetRunnableInBackground sets the state if the game runs even in background. // SetRunnableInBackground sets the state if the game runs even in background.
@ -363,7 +365,7 @@ func IsWindowResizable() bool {
// //
// SetRunnableInBackground is concurrent-safe. // SetRunnableInBackground is concurrent-safe.
func SetRunnableInBackground(runnableInBackground bool) { func SetRunnableInBackground(runnableInBackground bool) {
uiDriver().SetRunnableInBackground(runnableInBackground) uidriver.Get().SetRunnableInBackground(runnableInBackground)
} }
// SetWindowTitle sets the title of the window. // SetWindowTitle sets the title of the window.
@ -372,7 +374,7 @@ func SetRunnableInBackground(runnableInBackground bool) {
// //
// SetWindowTitle is concurrent-safe. // SetWindowTitle is concurrent-safe.
func SetWindowTitle(title string) { func SetWindowTitle(title string) {
uiDriver().SetWindowTitle(title) uidriver.Get().SetWindowTitle(title)
} }
// SetWindowIcon sets the icon of the game window. // SetWindowIcon sets the icon of the game window.
@ -396,7 +398,7 @@ func SetWindowTitle(title string) {
// //
// SetWindowIcon is concurrent-safe. // SetWindowIcon is concurrent-safe.
func SetWindowIcon(iconImages []image.Image) { func SetWindowIcon(iconImages []image.Image) {
uiDriver().SetWindowIcon(iconImages) uidriver.Get().SetWindowIcon(iconImages)
} }
// DeviceScaleFactor returns a device scale factor value of the current monitor which the window belongs to. // DeviceScaleFactor returns a device scale factor value of the current monitor which the window belongs to.
@ -409,7 +411,7 @@ func SetWindowIcon(iconImages []image.Image) {
// //
// DeviceScaleFactor must be called on the main thread before ebiten.Run, and is concurrent-safe after ebiten.Run. // DeviceScaleFactor must be called on the main thread before ebiten.Run, and is concurrent-safe after ebiten.Run.
func DeviceScaleFactor() float64 { func DeviceScaleFactor() float64 {
return uiDriver().DeviceScaleFactor() return uidriver.Get().DeviceScaleFactor()
} }
// IsVsyncEnabled returns a boolean value indicating whether // IsVsyncEnabled returns a boolean value indicating whether
@ -417,7 +419,7 @@ func DeviceScaleFactor() float64 {
// //
// IsVsyncEnabled is concurrent-safe. // IsVsyncEnabled is concurrent-safe.
func IsVsyncEnabled() bool { func IsVsyncEnabled() bool {
return uiDriver().IsVsyncEnabled() return uidriver.Get().IsVsyncEnabled()
} }
// SetVsyncEnabled sets a boolean value indicating whether // SetVsyncEnabled sets a boolean value indicating whether
@ -435,7 +437,7 @@ func IsVsyncEnabled() bool {
// //
// SetVsyncEnabled is concurrent-safe. // SetVsyncEnabled is concurrent-safe.
func SetVsyncEnabled(enabled bool) { func SetVsyncEnabled(enabled bool) {
uiDriver().SetVsyncEnabled(enabled) uidriver.Get().SetVsyncEnabled(enabled)
} }
// MaxTPS returns the current maximum TPS. // MaxTPS returns the current maximum TPS.

View File

@ -21,13 +21,15 @@ import (
"github.com/hajimehoshi/ebiten/internal/clock" "github.com/hajimehoshi/ebiten/internal/clock"
"github.com/hajimehoshi/ebiten/internal/driver" "github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/graphicscommand" "github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/graphicsdriver"
"github.com/hajimehoshi/ebiten/internal/hooks" "github.com/hajimehoshi/ebiten/internal/hooks"
"github.com/hajimehoshi/ebiten/internal/shareable" "github.com/hajimehoshi/ebiten/internal/shareable"
"github.com/hajimehoshi/ebiten/internal/uidriver"
) )
func init() { func init() {
shareable.SetGraphicsDriver(graphicsDriver()) shareable.SetGraphicsDriver(graphicsdriver.Get())
graphicscommand.SetGraphicsDriver(graphicsDriver()) graphicscommand.SetGraphicsDriver(graphicsdriver.Get())
} }
func newUIContext(f func(*Image) error) *uiContext { func newUIContext(f func(*Image) error) *uiContext {
@ -63,7 +65,7 @@ func (c *uiContext) SetSize(screenWidth, screenHeight int, screenScale float64)
// Round up the screensize not to cause glitches e.g. on Xperia (#622) // Round up the screensize not to cause glitches e.g. on Xperia (#622)
w := int(math.Ceil(float64(screenWidth) * screenScale)) w := int(math.Ceil(float64(screenWidth) * screenScale))
h := int(math.Ceil(float64(screenHeight) * screenScale)) h := int(math.Ceil(float64(screenHeight) * screenScale))
px0, py0, px1, py1 := uiDriver().ScreenPadding() px0, py0, px1, py1 := uidriver.Get().ScreenPadding()
c.screen = newImageWithScreenFramebuffer(w+int(math.Ceil(px0+px1)), h+int(math.Ceil(py0+py1))) c.screen = newImageWithScreenFramebuffer(w+int(math.Ceil(px0+px1)), h+int(math.Ceil(py0+py1)))
c.screenWidth = w c.screenWidth = w
c.screenHeight = h c.screenHeight = h
@ -106,7 +108,7 @@ func (c *uiContext) Update(afterFrameUpdate func()) error {
return err return err
} }
uiDriver().Input().ResetForFrame() uidriver.Get().Input().ResetForFrame()
afterFrameUpdate() afterFrameUpdate()
} }
@ -115,7 +117,7 @@ func (c *uiContext) Update(afterFrameUpdate func()) error {
op := &DrawImageOptions{} op := &DrawImageOptions{}
switch vd := graphicsDriver().VDirection(); vd { switch vd := graphicsdriver.Get().VDirection(); vd {
case driver.VDownward: case driver.VDownward:
// c.screen is special: its Y axis is down to up, // c.screen is special: its Y axis is down to up,
// and the origin point is lower left. // and the origin point is lower left.