mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
ui: Show the window on the current monitor (#704)
Tested on macOS. This doesn't work on Windows yet since there are some codes that depends on the primary monitor.
This commit is contained in:
parent
fb7a3f2736
commit
effd530026
@ -508,10 +508,12 @@ func Run(width, height int, scale float64, title string, g GraphicsContext, main
|
||||
u.window.SetTitle(title)
|
||||
u.window.Show()
|
||||
|
||||
v := u.currentMonitor().GetVideoMode()
|
||||
m := u.currentMonitor()
|
||||
mx, my := m.GetPos()
|
||||
v := m.GetVideoMode()
|
||||
w, h := u.glfwSize()
|
||||
x := (v.Width - w) / 2
|
||||
y := (v.Height - h) / 3
|
||||
x := mx + (v.Width-w)/2
|
||||
y := my + (v.Height-h)/3
|
||||
x, y = adjustWindowPosition(x, y)
|
||||
u.window.SetPos(x, y)
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user