mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
ui: Refactoring
This commit is contained in:
parent
b349efaa0a
commit
83787123ac
@ -596,7 +596,13 @@ func Run(width, height int, scale float64, title string, g GraphicsContext, main
|
||||
u.window.SetPos(x, y)
|
||||
return nil
|
||||
})
|
||||
u.setWindowToDriver()
|
||||
|
||||
var w uintptr
|
||||
_ = mainthread.Run(func() error {
|
||||
w = u.nativeWindow()
|
||||
return nil
|
||||
})
|
||||
graphicscommand.Driver().SetWindow(w)
|
||||
return u.loop(g)
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,6 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
|
||||
)
|
||||
|
||||
func glfwScale() float64 {
|
||||
@ -73,6 +71,6 @@ func (u *userInterface) currentMonitorFromPosition() *glfw.Monitor {
|
||||
return glfw.GetPrimaryMonitor()
|
||||
}
|
||||
|
||||
func (u *userInterface) setWindowToDriver() {
|
||||
graphicscommand.Driver().SetWindow(u.window.GetCocoaWindow())
|
||||
func (u *userInterface) nativeWindow() uintptr {
|
||||
return u.window.GetCocoaWindow()
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ func (u *userInterface) currentMonitorFromPosition() *glfw.Monitor {
|
||||
return glfw.GetPrimaryMonitor()
|
||||
}
|
||||
|
||||
func (u *userInterface) setWindowToDriver() {
|
||||
// Do nothing
|
||||
func (u *userInterface) nativeWindow() uintptr {
|
||||
// TODO: Implement this.
|
||||
return 0
|
||||
}
|
||||
|
@ -165,6 +165,6 @@ func (u *userInterface) currentMonitorFromPosition() *glfw.Monitor {
|
||||
return glfw.GetPrimaryMonitor()
|
||||
}
|
||||
|
||||
func (u *userInterface) setWindowToDriver() {
|
||||
// Do nothing
|
||||
func (u *userInterface) nativeWindow() uintptr {
|
||||
return uintptr(unsafe.Pointer(u.window.GetWin32Window()))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user