2018-09-22 14:23:26 +00:00
|
|
|
package allg5
|
2018-06-04 19:15:53 +00:00
|
|
|
|
|
|
|
// #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())
|
|
|
|
}
|