示例#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
}
示例#2
0
文件: video.go 项目: badgerodon/go
func GetVideoSurface() Surface {
	ptr := C.SDL_GetVideoSurface()
	return Surface{unsafe.Pointer(ptr)}
}
示例#3
0
文件: sdl.go 项目: gnanderson/Go-SDL
// Returns a pointer to the current display surface.
func GetVideoSurface() *Surface { return (*Surface)(cast(C.SDL_GetVideoSurface())) }
示例#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())
}
示例#5
0
// Video returns the surface for the base SDL window.
func Video() *Surface {
	return &Surface{C.SDL_GetVideoSurface()}
}
示例#6
0
文件: video.go 项目: beoran/fungo
// 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()
}