mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
parent
b2f3d39acf
commit
25405783a7
@ -561,8 +561,7 @@ func (u *userInterfaceImpl) SetFullscreen(fullscreen bool) {
|
|||||||
if u.isFullscreen() == fullscreen {
|
if u.isFullscreen() == fullscreen {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w, h := u.origWindowSizeInDIP()
|
u.setWindowSizeInDIP(u.origWindowWidthInDIP, u.origWindowHeightInDIP, fullscreen)
|
||||||
u.setWindowSizeInDIP(w, h, fullscreen)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,8 +979,7 @@ func (u *userInterfaceImpl) init() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterfaceImpl) updateSize() {
|
func (u *userInterfaceImpl) updateSize() {
|
||||||
ww, wh := u.origWindowSizeInDIP()
|
u.setWindowSizeInDIP(u.origWindowWidthInDIP, u.origWindowHeightInDIP, u.isFullscreen())
|
||||||
u.setWindowSizeInDIP(ww, wh, u.isFullscreen())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterfaceImpl) outsideSize() (float64, float64) {
|
func (u *userInterfaceImpl) outsideSize() (float64, float64) {
|
||||||
@ -1001,11 +999,10 @@ func (u *userInterfaceImpl) outsideSize() (float64, float64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if u.window.GetAttrib(glfw.Iconified) == glfw.True {
|
if u.window.GetAttrib(glfw.Iconified) == glfw.True {
|
||||||
w, h := u.origWindowSizeInDIP()
|
return float64(u.origWindowWidthInDIP), float64(u.origWindowHeightInDIP)
|
||||||
return float64(w), float64(h)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instead of u.origWindowSizeInDIP(), use the actual window size here.
|
// Instead of u.origWindow{Width,Height}InDIP, use the actual window size here.
|
||||||
// On Windows, the specified size at SetSize and the actual window size might
|
// On Windows, the specified size at SetSize and the actual window size might
|
||||||
// not match (#1163).
|
// not match (#1163).
|
||||||
ww, wh := u.window.GetSize()
|
ww, wh := u.window.GetSize()
|
||||||
@ -1243,6 +1240,9 @@ func (u *userInterfaceImpl) adjustWindowSizeBasedOnSizeLimitsInDIP(width, height
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setWindowSize must be called from the main thread.
|
// setWindowSize must be called from the main thread.
|
||||||
|
//
|
||||||
|
// TODO: Split this function into two: setting members and calling (*glfw.Window).SetSize.
|
||||||
|
// This function is invoked from the SetSize callback, but calling (*glfw.Window).SetSize from the callback is odd (#1816).
|
||||||
func (u *userInterfaceImpl) setWindowSizeInDIP(width, height int, fullscreen bool) {
|
func (u *userInterfaceImpl) setWindowSizeInDIP(width, height int, fullscreen bool) {
|
||||||
if microsoftgdk.IsXbox() {
|
if microsoftgdk.IsXbox() {
|
||||||
// Do nothing. The size is always fixed.
|
// Do nothing. The size is always fixed.
|
||||||
@ -1254,7 +1254,7 @@ func (u *userInterfaceImpl) setWindowSizeInDIP(width, height int, fullscreen boo
|
|||||||
u.graphicsDriver.SetFullscreen(fullscreen)
|
u.graphicsDriver.SetFullscreen(fullscreen)
|
||||||
|
|
||||||
scale := u.deviceScaleFactor(u.currentMonitor())
|
scale := u.deviceScaleFactor(u.currentMonitor())
|
||||||
if ow, oh := u.origWindowSizeInDIP(); ow == width && oh == height && u.isFullscreen() == fullscreen && u.lastDeviceScaleFactor == scale {
|
if u.origWindowWidthInDIP == width && u.origWindowHeightInDIP == height && u.isFullscreen() == fullscreen && u.lastDeviceScaleFactor == scale {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1267,6 +1267,9 @@ func (u *userInterfaceImpl) setWindowSizeInDIP(width, height int, fullscreen boo
|
|||||||
|
|
||||||
u.lastDeviceScaleFactor = scale
|
u.lastDeviceScaleFactor = scale
|
||||||
|
|
||||||
|
u.origWindowWidthInDIP = width
|
||||||
|
u.origWindowHeightInDIP = height
|
||||||
|
|
||||||
// To make sure the current existing framebuffers are rendered,
|
// To make sure the current existing framebuffers are rendered,
|
||||||
// swap buffers here before SetSize is called.
|
// swap buffers here before SetSize is called.
|
||||||
u.swapBuffers()
|
u.swapBuffers()
|
||||||
@ -1287,9 +1290,6 @@ func (u *userInterfaceImpl) setWindowSizeInDIP(width, height int, fullscreen boo
|
|||||||
u.updateWindowSizeLimits()
|
u.updateWindowSizeLimits()
|
||||||
|
|
||||||
u.adjustViewSize()
|
u.adjustViewSize()
|
||||||
|
|
||||||
// As width might be updated, update windowWidth/Height here.
|
|
||||||
u.setOrigWindowSizeInDIP(width, height)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterfaceImpl) minimumWindowWidth() int {
|
func (u *userInterfaceImpl) minimumWindowWidth() int {
|
||||||
@ -1720,12 +1720,3 @@ func (u *userInterfaceImpl) setOrigWindowPos(x, y int) {
|
|||||||
u.origWindowPosX = x
|
u.origWindowPosX = x
|
||||||
u.origWindowPosY = y
|
u.origWindowPosY = y
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterfaceImpl) origWindowSizeInDIP() (int, int) {
|
|
||||||
return u.origWindowWidthInDIP, u.origWindowHeightInDIP
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *userInterfaceImpl) setOrigWindowSizeInDIP(width, height int) {
|
|
||||||
u.origWindowWidthInDIP = width
|
|
||||||
u.origWindowHeightInDIP = height
|
|
||||||
}
|
|
||||||
|
@ -200,8 +200,9 @@ func (w *glfwWindow) Size() (int, int) {
|
|||||||
}
|
}
|
||||||
var ww, wh int
|
var ww, wh int
|
||||||
w.ui.t.Call(func() {
|
w.ui.t.Call(func() {
|
||||||
// Unlike origWindowPos, origWindowSizeInDPI is always updated via the callback.
|
// Unlike origWindowPos, origWindow{Width,Height}InDPI are always updated via the callback.
|
||||||
ww, wh = w.ui.origWindowSizeInDIP()
|
ww = w.ui.origWindowWidthInDIP
|
||||||
|
wh = w.ui.origWindowHeightInDIP
|
||||||
})
|
})
|
||||||
return ww, wh
|
return ww, wh
|
||||||
}
|
}
|
||||||
@ -216,8 +217,6 @@ func (w *glfwWindow) SetSize(width, height int) {
|
|||||||
if w.ui.isWindowMaximized() && runtime.GOOS != "darwin" {
|
if w.ui.isWindowMaximized() && runtime.GOOS != "darwin" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// TODO: Do not call setWindowSizeInDIP directly here (#1816).
|
|
||||||
// Instead, can we call (*Window).SetSize?
|
|
||||||
w.ui.setWindowSizeInDIP(width, height, w.ui.isFullscreen())
|
w.ui.setWindowSizeInDIP(width, height, w.ui.isFullscreen())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user