Exemplo n.º 1
0
// 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)))
}
Exemplo n.º 2
0
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))
}
Exemplo n.º 3
0
Arquivo: sdl.go Projeto: neagix/Go-SDL
// 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)
}
Exemplo n.º 4
0
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
}
Exemplo n.º 5
0
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
}
Exemplo n.º 6
0
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)))
}