本文整理匯總了Golang中C.SDL_RWFromFile函數的典型用法代碼示例。如果您正苦於以下問題:Golang SDL_RWFromFile函數的具體用法?Golang SDL_RWFromFile怎麽用?Golang SDL_RWFromFile使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了SDL_RWFromFile函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SaveBMP
func (s *Surface) SaveBMP(_file string) {
cfile := C.CString(_file)
defer C.free(unsafe.Pointer(cfile))
cparams := C.CString("wb")
defer C.free(unsafe.Pointer(cparams))
C.SDL_SaveBMP_RW(s.Get(), C.SDL_RWFromFile(cfile, cparams), C.int(1))
}
示例2: LoadBMP
func LoadBMP(_file string) *Surface {
cfile := C.CString(_file)
defer C.free(unsafe.Pointer(cfile))
cparams := C.CString("rb")
defer C.free(unsafe.Pointer(cparams))
return (*Surface)(C.SDL_LoadBMP_RW(C.SDL_RWFromFile(cfile, cparams), C.int(1)))
}
示例3: LoadWAV
func LoadWAV(file string) *Chunk {
_file := C.CString(file)
defer C.free(unsafe.Pointer(_file))
_rb := C.CString("rb")
defer C.free(unsafe.Pointer(_rb))
return (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(C.SDL_RWFromFile(_file, _rb), 1)))
}
示例4: RWFromFile
func RWFromFile(file, mode string) *RWops {
_file := C.CString(file)
defer C.free(unsafe.Pointer(_file))
_mode := C.CString(mode)
defer C.free(unsafe.Pointer(_mode))
return (*RWops)(unsafe.Pointer(C.SDL_RWFromFile(_file, _mode)))
}
示例5: RWFromFile
// Functions to create SDL_RWops structures from various data sources
// Creates an RWOPS from a file
func RWFromFile(file, mode string) *C.SDL_RWops {
cfile := cstr(file)
defer cfile.free()
cmode := cstr(mode)
defer cmode.free()
rw := C.SDL_RWFromFile(cfile, cmode)
return rw
}
示例6: LoadWAV
func LoadWAV(file string, spec *AudioSpec, audio_buf **uint8, audio_len *uint32) *AudioSpec {
_file := (C.CString)(file)
_spec := (*C.SDL_AudioSpec)(unsafe.Pointer(spec))
_audio_buf := (**C.Uint8)(unsafe.Pointer(audio_buf))
_audio_len := (*C.Uint32)(unsafe.Pointer(audio_len))
return (*AudioSpec)(unsafe.Pointer(C.SDL_LoadWAV_RW(C.SDL_RWFromFile(_file, C.CString("rb")),
1, _spec, _audio_buf, _audio_len)))
}
示例7: LoadWAV
// LoadWAV (https://wiki.libsdl.org/SDL_LoadWAV)
func LoadWAV(file string, spec *AudioSpec, audioBuf **uint8, audioLen *uint32) *AudioSpec {
_file := C.CString(file)
_rb := C.CString("rb")
defer C.free(unsafe.Pointer(_file))
defer C.free(unsafe.Pointer(_rb))
_audioBuf := (**C.Uint8)(unsafe.Pointer(audioBuf))
_audioLen := (*C.Uint32)(unsafe.Pointer(audioLen))
return (*AudioSpec)(unsafe.Pointer(C.SDL_LoadWAV_RW(C.SDL_RWFromFile(_file, _rb), 1, spec.cptr(), _audioBuf, _audioLen)))
}
示例8: loadSound
func loadSound(name string) *C.Mix_Chunk {
cfile, rb := C.CString(name), C.CString("rb")
rwop := C.SDL_RWFromFile(cfile, rb)
C.free(unsafe.Pointer(cfile))
C.free(unsafe.Pointer(rb))
chunk := C.Mix_LoadWAV_RW(rwop, 1)
if chunk == nil {
panic(fmt.Sprintf("Unable to load Sound file (%v): %v", name, util.GetMixError()))
}
return chunk
}
示例9: LoadWAV
func LoadWAV(file string) *Chunk {
cfile := C.CString(file)
cchunk := C.Mix_LoadWAV_RW(C.SDL_RWFromFile(cfile, C.CString("rb")), 1)
C.free(unsafe.Pointer(cfile))
if cchunk == nil {
return nil
}
return &Chunk{cchunk}
}
示例10: LoadWAV
func LoadWAV(file string) (chunk *Chunk, err error) {
_file := C.CString(file)
defer C.free(unsafe.Pointer(_file))
_rb := C.CString("rb")
defer C.free(unsafe.Pointer(_rb))
// why doesn't this call Mix_LoadWAV ?
chunk = (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(C.SDL_RWFromFile(_file, _rb), 1)))
if chunk == nil {
err = sdl.GetError()
}
return
}
示例11: RWFromFile
func RWFromFile(file string, mode int) *RWops {
cfile := C.CString(file)
defer C.free(unsafe.Pointer(cfile))
cmode := modeFromFlags(mode)
if cmode == nil {
return nil
}
defer C.free(unsafe.Pointer(cmode))
return (*RWops)(C.SDL_RWFromFile(cfile, cmode))
}
示例12: RWFromFile
func RWFromFile(file string, mode string) (*RWops, error) {
cfile := C.CString(file)
defer C.free(unsafe.Pointer(cfile))
cmode := C.CString(mode)
defer C.free(unsafe.Pointer(cmode))
rw := C.SDL_RWFromFile(cfile, cmode)
if rw == nil {
return nil, getError()
}
return &RWops{rw}, nil
}
示例13: LoadWAV
// LoadWAV (https://wiki.libsdl.org/SDL_LoadWAV)
func LoadWAV(file string, spec *AudioSpec) ([]byte, *AudioSpec) {
_file := C.CString(file)
_rb := C.CString("rb")
defer C.free(unsafe.Pointer(_file))
defer C.free(unsafe.Pointer(_rb))
var _audioBuf *C.Uint8
var _audioLen C.Uint32
audioSpec := (*AudioSpec)(unsafe.Pointer(C.SDL_LoadWAV_RW(C.SDL_RWFromFile(_file, _rb), 1, spec.cptr(), &_audioBuf, &_audioLen)))
var b []byte
sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b))
sliceHeader.Len = (int)(_audioLen)
sliceHeader.Cap = (int)(_audioLen)
sliceHeader.Data = uintptr(unsafe.Pointer(_audioBuf))
return b, audioSpec
}
示例14: loadWAV
func loadWAV(path string) (*audioData, error) {
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
var data *C.Uint8
var len C.Uint32
var s C.SDL_AudioSpec // Apparently just a buffer? SDL just zeroes it, fills it, and returns it.
spec := C.SDL_LoadWAV_RW(C.SDL_RWFromFile(cpath, rb), 1, &s, &data, &len)
if spec == nil {
return nil, sdlError()
}
var err error
data, len, err = convert(spec, data, len)
if err != nil {
return nil, err
}
return &audioData{
path: path,
data: unsafe.Pointer(data),
len: uintptr(len),
}, nil
}
示例15: LoadWAV
func LoadWAV(file string) *Chunk {
_file := (C.CString)(file)
return (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(C.SDL_RWFromFile(_file,
C.CString("rb")), 1)))
}