mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Revert "internal/uidriver/glfw: Refactoring"
This reverts commit c4df397d87
.
Reason: Compile error
This commit is contained in:
parent
c4df397d87
commit
ee414ed849
@ -304,9 +304,10 @@ func (i *Input) update(window *glfw.Window, context driver.UIContext) {
|
||||
cx, cy := window.GetCursorPos()
|
||||
// TODO: This is tricky. Rename the function?
|
||||
m := i.ui.currentMonitor()
|
||||
s := i.ui.deviceScaleFactor(m)
|
||||
cx = i.ui.dipFromGLFWPixel(cx, m)
|
||||
cy = i.ui.dipFromGLFWPixel(cy, m)
|
||||
cx, cy = context.AdjustPosition(cx, cy, i.ui.deviceScaleFactor())
|
||||
cx, cy = context.AdjustPosition(cx, cy, s)
|
||||
|
||||
// AdjustPosition can return NaN at the initialization.
|
||||
if !math.IsNaN(cx) && !math.IsNaN(cy) {
|
||||
|
@ -684,20 +684,20 @@ func (u *UserInterface) SetCursorShape(shape driver.CursorShape) {
|
||||
func (u *UserInterface) DeviceScaleFactor() float64 {
|
||||
if !u.isRunning() {
|
||||
// TODO: Use the initWindowPosition. This requires to convert the units correctly (#1575).
|
||||
return u.deviceScaleFactor()
|
||||
return u.deviceScaleFactor(u.currentMonitor())
|
||||
}
|
||||
|
||||
f := 0.0
|
||||
_ = u.t.Call(func() error {
|
||||
f = u.deviceScaleFactor()
|
||||
f = u.deviceScaleFactor(u.currentMonitor())
|
||||
return nil
|
||||
})
|
||||
return f
|
||||
}
|
||||
|
||||
// deviceScaleFactor must be called from the main thread.
|
||||
func (u *UserInterface) deviceScaleFactor() float64 {
|
||||
mx, my := u.currentMonitor().GetPos()
|
||||
func (u *UserInterface) deviceScaleFactor(monitor *glfw.Monitor) float64 {
|
||||
mx, my := monitor.GetPos()
|
||||
return devicescale.GetAt(mx, my)
|
||||
}
|
||||
|
||||
@ -1213,7 +1213,7 @@ func (u *UserInterface) setWindowSizeInDIP(width, height int, fullscreen bool) {
|
||||
|
||||
u.Graphics().SetFullscreen(fullscreen)
|
||||
|
||||
scale := u.deviceScaleFactor()
|
||||
scale := u.deviceScaleFactor(u.currentMonitor())
|
||||
if u.windowWidthInDIP == width && u.windowHeightInDIP == height && u.isFullscreen() == fullscreen && u.lastDeviceScaleFactor == scale {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user