mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 19:22:49 +01:00
internal/uidriver/glfw: bug fix: needed to adjuts the units between the framebuffer and the window
Updates #1960 Closes #1975
This commit is contained in:
parent
f76d1c8d50
commit
5ee493e85a
@ -827,7 +827,12 @@ event:
|
|||||||
// manager), glfw sends a framebuffer size callback which we need to handle (#1960).
|
// manager), glfw sends a framebuffer size callback which we need to handle (#1960).
|
||||||
// This event is the only way to handle the size change at least on i3 window manager.
|
// This event is the only way to handle the size change at least on i3 window manager.
|
||||||
u.defaultFramebufferSizeCallback = glfw.ToFramebufferSizeCallback(func(_ *glfw.Window, w, h int) {
|
u.defaultFramebufferSizeCallback = glfw.ToFramebufferSizeCallback(func(_ *glfw.Window, w, h int) {
|
||||||
u.setWindowSizeInDIP(w, h, u.isFullscreen())
|
// The framebuffer size is always scaled by the device scale factor (#1975).
|
||||||
|
// See also the implementation in uiContext.updateOffscreen.
|
||||||
|
s := u.deviceScaleFactor(u.currentMonitor())
|
||||||
|
ww := int(float64(w) / s)
|
||||||
|
wh := int(float64(h) / s)
|
||||||
|
u.setWindowSizeInDIP(ww, wh, u.isFullscreen())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
window.SetFramebufferSizeCallback(u.defaultFramebufferSizeCallback)
|
window.SetFramebufferSizeCallback(u.defaultFramebufferSizeCallback)
|
||||||
|
Loading…
Reference in New Issue
Block a user