Golang C.SDL_RWFromMem类(方法)实例源码

下面列出了Golang C.SDL_RWFromMem 类(方法)源码代码实例,从而了解它的用法。

作者:kerker    项目:gtg15-dem   
func RWFromMem(mem unsafe.Pointer, size int) *RWops {
	if mem == nil {
		return nil
	}
	_size := (C.int)(size)
	return (*RWops)(unsafe.Pointer(C.SDL_RWFromMem(mem, _size)))
}

作者:DeedleFak    项目:sd   
func RWFromMem(data []byte) (*RWops, error) {
	rw := C.SDL_RWFromMem(unsafe.Pointer(&data[0]), C.int(len(data)))
	if rw == nil {
		return nil, getError()
	}

	return &RWops{rw}, nil
}

作者:gasperk    项目:pokemon-univers   
func LoadImageRW(_data *[]byte, _size int) *Surface {
	rawImage := C.SDL_RWFromMem(unsafe.Pointer(&((*_data)[0])), C.int(_size))
	img := C.IMG_Load_RW(rawImage, C.int(0))
	if img == nil {
		fmt.Printf("ImageRW load error: %v", C.GoString(C.IMG_GetError()))
	}
	return (*Surface)(cast(img))
}

作者:neagi    项目:Go-SD   
// Creates an RWops from memory.
func RWFromMem(buf []byte) *RWops {
	GlobalMutex.Lock()
	defer GlobalMutex.Unlock()

	p := C.SDL_RWFromMem(unsafe.Pointer(&buf[0]), C.int(len(buf)))
	var rwops RWops
	rwops.cRWops = (*C.SDL_RWops)(p)
	rwops.gcBytes = buf
	return &rwops

}

作者:gnanderso    项目:Go-SD   
func RWFromMem(m []byte) *RWops {
	return (*RWops)(C.SDL_RWFromMem(unsafe.Pointer(&m[0]), C.int(len(m))))
}

作者:jbondeso    项目:Go-SDL   
func RWFromMem(mem []byte) *RWops {
	rw := wrapRWops(C.SDL_RWFromMem(unsafe.Pointer(&mem[0]), C.int(len(mem))))
	rw.mem = mem
	return rw
}


问题


面经


文章

微信
公众号

扫码关注公众号