game: fullscreen on F11
This commit is contained in:
@@ -129,6 +129,23 @@ func (g *Game) Init(win *glfw.Window) {
|
||||
win.SetCursorPos(float64(width)/2, float64(height)/2)
|
||||
}
|
||||
}
|
||||
|
||||
if key == glfw.KeyF11 {
|
||||
if g.fullscreen {
|
||||
win.SetMonitor(nil, g.lastPos[0], g.lastPos[1], g.lastSize[0], g.lastSize[1], glfw.DontCare)
|
||||
g.fullscreen = false
|
||||
} else {
|
||||
g.lastPos[0], g.lastPos[1] = win.GetPos()
|
||||
g.lastSize[0], g.lastSize[1] = win.GetSize()
|
||||
|
||||
monitor := glfw.GetPrimaryMonitor()
|
||||
videoMode := monitor.GetVideoMode()
|
||||
|
||||
win.SetMonitor(monitor, 0, 0, videoMode.Width, videoMode.Height, glfw.DontCare)
|
||||
|
||||
g.fullscreen = true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user