Пример #1
0
// Get the current desktop video mode
func (mi *monitorInternal) getDesktopMode() VideoMode {
	win32Mode := C.DEVMODEW{dmSize: C.DEVMODEW_size}
	C.__EnumDisplaySettingsW(&mi.info.szDevice[0], C.ENUM_CURRENT_SETTINGS, &win32Mode)
	return VideoMode{
		Width:        uint(win32Mode.dmPelsWidth),
		Height:       uint(win32Mode.dmPelsHeight),
		BitsPerPixel: uint(win32Mode.dmBitsPerPel),
	}
}
Пример #2
0
// Get the list of all the supported fullscreen video modes
func (mi *monitorInternal) getFullscreenVideoModes() []VideoMode {
	// Enumerate all available video modes for the primary display adapter
	mode_set := make(map[VideoMode]bool)
	for win32Mode, count := (C.DEVMODEW{dmSize: C.DEVMODEW_size}), C.DWORD(0); C.__EnumDisplaySettingsW(&mi.info.szDevice[0], count, &win32Mode) != 0; count++ {
		vm := VideoMode{
			Width:        uint(win32Mode.dmPelsWidth),
			Height:       uint(win32Mode.dmPelsHeight),
			BitsPerPixel: uint(win32Mode.dmBitsPerPel),
		}
		mode_set[vm] = true
	}

	// add them all into the slice
	modes := make([]VideoMode, 0, len(mode_set))
	for mode, _ := range mode_set {
		modes = append(modes, mode)
	}
	return modes
}