2016-03-27 13:01:51 -07:00
|
|
|
// PresentationApp project glfw.go
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/go-gl/glfw/v3.1/glfw"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2018-02-07 10:00:10 -08:00
|
|
|
monitorHeight int // displayed width
|
|
|
|
monitors []*glfw.Monitor
|
|
|
|
monitorWidth int // displayed height
|
|
|
|
projectorMonitor *glfw.Monitor
|
2016-03-27 13:01:51 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func checkMon() {
|
|
|
|
monitors = glfw.GetMonitors()
|
|
|
|
|
|
|
|
if i := len(monitors); i < 2 {
|
|
|
|
fmt.Println("You only have 1 monitor!!!!!!!!!!! :-P")
|
2018-02-07 10:00:10 -08:00
|
|
|
monitorWidth = 800
|
|
|
|
monitorHeight = 600
|
2016-03-27 13:01:51 -07:00
|
|
|
|
2018-02-07 10:00:10 -08:00
|
|
|
projectorMonitor = monitors[0]
|
2016-03-27 13:01:51 -07:00
|
|
|
} else {
|
|
|
|
fmt.Printf("You have %d monitors\n", i)
|
2018-02-07 10:00:10 -08:00
|
|
|
monitorWidth = monitors[1].GetVideoMode().Width
|
|
|
|
monitorHeight = monitors[1].GetVideoMode().Height
|
|
|
|
projectorMonitor = monitors[1]
|
2016-03-27 13:01:51 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
monitorInfo()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func monitorInfo() {
|
2018-02-07 10:00:10 -08:00
|
|
|
fmt.Println(len(monitors))
|
2016-03-27 13:01:51 -07:00
|
|
|
for _, mon := range monitors {
|
2018-02-07 10:00:10 -08:00
|
|
|
fmt.Printf("Monitor name: %s\n", mon.GetName())
|
|
|
|
x, y := mon.GetPos()
|
|
|
|
fmt.Printf("Position: %v, %v\n", x, y)
|
|
|
|
fmt.Printf("Size: %v x %v\n", mon.GetVideoMode().Width, mon.GetVideoMode().Height)
|
2016-03-27 13:01:51 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func glInit() {
|
2018-02-07 10:00:10 -08:00
|
|
|
if err = glfw.Init(); err == nil {
|
|
|
|
checkMon()
|
|
|
|
DisplayWindow.Root().Set("height", monitorHeight)
|
|
|
|
DisplayWindow.Root().Set("width", monitorWidth)
|
|
|
|
DisplayWindow.Root().Set("x", 0)
|
|
|
|
DisplayWindow.Root().Set("y", 0)
|
2016-03-27 13:01:51 -07:00
|
|
|
}
|
|
|
|
}
|