Пример #1
0
func LoadTexture(renderer *sdl.Renderer, file string) (*sdl.Texture, error) {
	_renderer := (*C.SDL_Renderer)(unsafe.Pointer(renderer))
	_file := C.CString(file)
	defer C.free(unsafe.Pointer(_file))
	_surface := C.IMG_LoadTexture(_renderer, _file)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Texture)(unsafe.Pointer(_surface)), nil
}
Пример #2
0
func LoadTexture(r *sdl.Renderer, name string) (*sdl.Texture, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	s := C.IMG_LoadTexture(cRenderer(r), cname)
	if s == nil {
		return nil, getError()
	}

	return goTexture(s), nil
}
Пример #3
0
func LoadTexture(renderer *sdl.Renderer, file string) *sdl.Texture {
	_renderer := (*C.SDL_Renderer)(unsafe.Pointer(renderer))
	_file := C.CString(file)
	defer C.free(unsafe.Pointer(_file))
	return (*sdl.Texture)(unsafe.Pointer(C.IMG_LoadTexture(_renderer, _file)))
}