35 lines
678 B
Go
35 lines
678 B
Go
package allg5
|
|
|
|
// #include <allegro5/allegro.h>
|
|
import "C"
|
|
|
|
type Monitor struct {
|
|
X1, Y1 int
|
|
X2, Y2 int
|
|
}
|
|
|
|
func monitor(m *C.ALLEGRO_MONITOR_INFO) Monitor {
|
|
return Monitor{int(m.x1), int(m.y1), int(m.x2), int(m.y2)}
|
|
}
|
|
|
|
func DefaultMonitor() Monitor {
|
|
var m C.ALLEGRO_MONITOR_INFO
|
|
C.al_get_monitor_info(C.ALLEGRO_DEFAULT_DISPLAY_ADAPTER, &m)
|
|
return monitor(&m)
|
|
}
|
|
|
|
func Monitors() []Monitor {
|
|
var n = NumberOfVideoAdapters()
|
|
var mons []Monitor
|
|
var m C.ALLEGRO_MONITOR_INFO
|
|
for i := 0; i < n; i++ {
|
|
C.al_get_monitor_info(C.int(i), &m)
|
|
mons = append(mons, monitor(&m))
|
|
}
|
|
return mons
|
|
}
|
|
|
|
func NumberOfVideoAdapters() int {
|
|
return int(C.al_get_num_video_adapters())
|
|
}
|