mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08: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)
|
u.window.SetPos(x, y)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
u.setWindowToDriver()
|
|
||||||
|
var w uintptr
|
||||||
|
_ = mainthread.Run(func() error {
|
||||||
|
w = u.nativeWindow()
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
graphicscommand.Driver().SetWindow(w)
|
||||||
return u.loop(g)
|
return u.loop(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,6 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/go-gl/glfw/v3.2/glfw"
|
"github.com/go-gl/glfw/v3.2/glfw"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func glfwScale() float64 {
|
func glfwScale() float64 {
|
||||||
@ -73,6 +71,6 @@ func (u *userInterface) currentMonitorFromPosition() *glfw.Monitor {
|
|||||||
return glfw.GetPrimaryMonitor()
|
return glfw.GetPrimaryMonitor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) setWindowToDriver() {
|
func (u *userInterface) nativeWindow() uintptr {
|
||||||
graphicscommand.Driver().SetWindow(u.window.GetCocoaWindow())
|
return u.window.GetCocoaWindow()
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ func (u *userInterface) currentMonitorFromPosition() *glfw.Monitor {
|
|||||||
return glfw.GetPrimaryMonitor()
|
return glfw.GetPrimaryMonitor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) setWindowToDriver() {
|
func (u *userInterface) nativeWindow() uintptr {
|
||||||
// Do nothing
|
// TODO: Implement this.
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,6 @@ func (u *userInterface) currentMonitorFromPosition() *glfw.Monitor {
|
|||||||
return glfw.GetPrimaryMonitor()
|
return glfw.GetPrimaryMonitor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) setWindowToDriver() {
|
func (u *userInterface) nativeWindow() uintptr {
|
||||||
// Do nothing
|
return uintptr(unsafe.Pointer(u.window.GetWin32Window()))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user