作者:gnanderso
项目:Go-SD
// Loads Surface from RWops (using IMG_Load_RW).
func Load_RW(rw *RWops, ac bool) *Surface {
acArg := C.int(0)
if ac {
acArg = 1
}
return (*Surface)(unsafe.Pointer(C.IMG_Load_RW((*C.SDL_RWops)(rw), acArg)))
}
作者: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
// Loads Surface from RWops (using IMG_Load_RW).
func Load_RW(rwOps *RWops) *Surface {
GlobalMutex.Lock()
var screen = C.IMG_Load_RW((*C.SDL_RWops)(cast(rwOps.cRWops)), 0)
GlobalMutex.Unlock()
return wrap(screen)
}
作者:flaz
项目:go-sdl
func Load_RW(src *sdl.RWops, freesrc int) (*sdl.Surface, error) {
_src := (*C.SDL_RWops)(unsafe.Pointer(src))
_freesrc := (C.int)(freesrc)
_surface := C.IMG_Load_RW(_src, _freesrc)
if _surface == nil {
return nil, GetError()
}
return (*sdl.Surface)(unsafe.Pointer(_surface)), nil
}
作者:DeedleFak
项目:sd
func Load_RW(rw *sdl.RWops, freesrc bool) (*sdl.Surface, error) {
cfreesrc := C.int(0)
if freesrc {
cfreesrc = 1
}
s := C.IMG_Load_RW(cRWops(rw), cfreesrc)
if s == nil {
return nil, getError()
}
return (*sdl.Surface)(unsafe.Pointer(s)), nil
}
作者:JalfRes
项目:go-sdl
func Load_RW(src *sdl.RWops, freesrc int) *sdl.Surface {
_src := (*C.SDL_RWops)(unsafe.Pointer(src))
_freesrc := (C.int)(freesrc)
return (*sdl.Surface)(unsafe.Pointer(C.IMG_Load_RW(_src, _freesrc)))
}