func NewSurface(w, h int) (s *Surface) { mutex.Lock() defer mutex.Unlock() video := C.SDL_GetVideoSurface() ptr := C.SDL_CreateRGBSurface( 0, C.int(w), C.int(h), C.int(video.format.BitsPerPixel), video.format.Rmask, video.format.Gmask, video.format.Bmask, video.format.Amask) s = &Surface{ptr} runtime.SetFinalizer(s, func(s *Surface) { C.SDL_FreeSurface(s.ptr) }) return }
func GetVideoSurface() Surface { ptr := C.SDL_GetVideoSurface() return Surface{unsafe.Pointer(ptr)} }
// Returns a pointer to the current display surface. func GetVideoSurface() *Surface { return (*Surface)(cast(C.SDL_GetVideoSurface())) }
// Flip swaps screen buffers with a double-buffered display mode. Use it to // make the changes you made to the screen become visible. func Flip() { mutex.Lock() defer mutex.Unlock() C.SDL_Flip(C.SDL_GetVideoSurface()) }
// Video returns the surface for the base SDL window. func Video() *Surface { return &Surface{C.SDL_GetVideoSurface()} }
// This function returns a pointer to the current display surface. // If SDL is doing format conversion on the display surface, this // function returns the publicly visible surface, not the real video // surface. func getVideoSurface() *C.SDL_Surface { return C.SDL_GetVideoSurface() }