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))) }
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 }
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)) }
// 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 }
func RWFromMem(m []byte) *RWops { return (*RWops)(C.SDL_RWFromMem(unsafe.Pointer(&m[0]), C.int(len(m)))) }
func RWFromMem(mem []byte) *RWops { rw := wrapRWops(C.SDL_RWFromMem(unsafe.Pointer(&mem[0]), C.int(len(mem)))) rw.mem = mem return rw }