Exemplo n.º 1
0
func RWFromConstMem(data []byte) (*RWops, error) {
	rw := C.SDL_RWFromConstMem(unsafe.Pointer(&data[0]), C.int(len(data)))
	if rw == nil {
		return nil, getError()
	}

	return &RWops{rw}, nil
}
Exemplo n.º 2
0
func loadSoundFromData(data []Double, sps int) *C.Mix_Chunk {
	bytes := util.CreateWavBytes(data, sps)
	rwop := C.SDL_RWFromConstMem(unsafe.Pointer(&bytes[0]), C.int(len(bytes)))
	chunk := C.Mix_LoadWAV_RW(rwop, 1)
	if chunk == nil {
		panic(fmt.Sprintf("Unable to load Sound data: %v", util.GetMixError()))
	}
	return chunk
}
Exemplo n.º 3
0
func RWFromConstMem(m []byte) *RWops {
	return (*RWops)(C.SDL_RWFromConstMem(unsafe.Pointer(&m[0]), C.int(len(m))))
}