Beispiel #1
0
func GetCurrentDisplayMode(i int) (*DisplayMode, error) {
	var dm DisplayMode
	if C.SDL_GetCurrentDisplayMode(C.int(i), dm.c()) != 0 {
		return nil, getError()
	}

	return &dm, nil
}
Beispiel #2
0
func NewSurface(w, h int) (*Surface, error) {
	var curr C.SDL_DisplayMode
	if C.SDL_GetCurrentDisplayMode(0, &curr) != 0 {
		return nil, sdlerr()
	}
	pixfmt := C.SDL_AllocFormat(curr.format)

	s := C.SDL_CreateRGBSurface(0, C.int(w), C.int(h),
		C.int(pixfmt.BitsPerPixel),
		pixfmt.Rmask, pixfmt.Gmask,
		pixfmt.Bmask, pixfmt.Amask)
	if s == nil {
		return nil, sdlerr()
	}

	surf := &Surface{s, pixfmt}
	runtime.SetFinalizer(surf, freesurf)
	return surf, nil
}
Beispiel #3
0
func GetCurrentDisplayMode(displayIndex int, mode *DisplayMode) int {
	_displayIndex := (C.int)(displayIndex)
	_mode := (*C.SDL_DisplayMode)(unsafe.Pointer(mode))
	return (int)(C.SDL_GetCurrentDisplayMode(_displayIndex, _mode))
}
Beispiel #4
0
// GetCurrentDisplayMode (https://wiki.libsdl.org/SDL_GetCurrentDisplayMode)
func GetCurrentDisplayMode(displayIndex int, mode *DisplayMode) error {
	if C.SDL_GetCurrentDisplayMode(C.int(displayIndex), mode.cptr()) != 0 {
		return GetError()
	}
	return nil
}
Beispiel #5
0
func GetCurrentDisplayMode(displayIndex int, mode *DisplayMode) int {
	return int(C.SDL_GetCurrentDisplayMode(C.int(displayIndex), mode.cptr()))
}