Example #1
0
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
}
Example #2
0
func GetVideoSurface() Surface {
	ptr := C.SDL_GetVideoSurface()
	return Surface{unsafe.Pointer(ptr)}
}
Example #3
0
// Returns a pointer to the current display surface.
func GetVideoSurface() *Surface { return (*Surface)(cast(C.SDL_GetVideoSurface())) }
Example #4
0
// 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())
}
Example #5
0
// Video returns the surface for the base SDL window.
func Video() *Surface {
	return &Surface{C.SDL_GetVideoSurface()}
}
Example #6
0
// 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()
}