mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +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()
|
cx, cy := window.GetCursorPos()
|
||||||
// TODO: This is tricky. Rename the function?
|
// TODO: This is tricky. Rename the function?
|
||||||
m := i.ui.currentMonitor()
|
m := i.ui.currentMonitor()
|
||||||
|
s := i.ui.deviceScaleFactor(m)
|
||||||
cx = i.ui.dipFromGLFWPixel(cx, m)
|
cx = i.ui.dipFromGLFWPixel(cx, m)
|
||||||
cy = i.ui.dipFromGLFWPixel(cy, 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.
|
// AdjustPosition can return NaN at the initialization.
|
||||||
if !math.IsNaN(cx) && !math.IsNaN(cy) {
|
if !math.IsNaN(cx) && !math.IsNaN(cy) {
|
||||||
|
@ -684,20 +684,20 @@ func (u *UserInterface) SetCursorShape(shape driver.CursorShape) {
|
|||||||
func (u *UserInterface) DeviceScaleFactor() float64 {
|
func (u *UserInterface) DeviceScaleFactor() float64 {
|
||||||
if !u.isRunning() {
|
if !u.isRunning() {
|
||||||
// TODO: Use the initWindowPosition. This requires to convert the units correctly (#1575).
|
// TODO: Use the initWindowPosition. This requires to convert the units correctly (#1575).
|
||||||
return u.deviceScaleFactor()
|
return u.deviceScaleFactor(u.currentMonitor())
|
||||||
}
|
}
|
||||||
|
|
||||||
f := 0.0
|
f := 0.0
|
||||||
_ = u.t.Call(func() error {
|
_ = u.t.Call(func() error {
|
||||||
f = u.deviceScaleFactor()
|
f = u.deviceScaleFactor(u.currentMonitor())
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
// deviceScaleFactor must be called from the main thread.
|
// deviceScaleFactor must be called from the main thread.
|
||||||
func (u *UserInterface) deviceScaleFactor() float64 {
|
func (u *UserInterface) deviceScaleFactor(monitor *glfw.Monitor) float64 {
|
||||||
mx, my := u.currentMonitor().GetPos()
|
mx, my := monitor.GetPos()
|
||||||
return devicescale.GetAt(mx, my)
|
return devicescale.GetAt(mx, my)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1213,7 +1213,7 @@ func (u *UserInterface) setWindowSizeInDIP(width, height int, fullscreen bool) {
|
|||||||
|
|
||||||
u.Graphics().SetFullscreen(fullscreen)
|
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 {
|
if u.windowWidthInDIP == width && u.windowHeightInDIP == height && u.isFullscreen() == fullscreen && u.lastDeviceScaleFactor == scale {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user