diff --git a/internal/game/game.go b/internal/game/game.go index a0c1bd2..0a7408d 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -24,7 +24,9 @@ type Game struct { rotY itype.Angle rotZ float32 // Degrees in range (-90, 90) - fbSize itype.Vec2i + fbSize itype.Vec2i + fullscreen bool + lastPos, lastSize itype.Vec2i // Window size before entering fullscreen io imgui.IO gui guiState diff --git a/internal/game/logic.go b/internal/game/logic.go index a7f7edc..7cf27ea 100644 --- a/internal/game/logic.go +++ b/internal/game/logic.go @@ -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 + } + } } })