Example #1
0
// Load_RW (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_12.html)
func Load_RW(src *sdl.RWops, freesrc bool) (*sdl.Surface, error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_freesrc := (C.int)(sdl.Btoi(freesrc))
	_surface := C.IMG_Load_RW(_src, _freesrc)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Surface)(unsafe.Pointer(_surface)), nil
}
Example #2
0
func LoadTexture_RW(renderer *sdl.Renderer, src *sdl.RWops, freesrc bool) (*sdl.Texture, error) {
	_renderer := (*C.SDL_Renderer)(unsafe.Pointer(renderer))
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_freesrc := (C.int)(sdl.Btoi(freesrc))
	_surface := C.IMG_LoadTexture_RW(_renderer, _src, _freesrc)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Texture)(unsafe.Pointer(_surface)), nil
}
Example #3
0
// LoadTyped_RW
// (http://www.libsdl.org/projects/SDL_image/docs/SDL_image_13.html)
func LoadTyped_RW(src *sdl.RWops, freesrc bool, type_ string) (*sdl.Surface, error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_freesrc := (C.int)(sdl.Btoi(freesrc))
	_type := C.CString(type_)
	defer C.free(unsafe.Pointer(_type))
	_surface := C.IMG_LoadTyped_RW(_src, _freesrc, _type)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Surface)(unsafe.Pointer(_surface)), nil
}