示例#1
0
func (ctx *RWops) RWread(ptr unsafe.Pointer, size, maxnum uint) uint {
	if ctx == nil {
		return 0
	}
	_ctx := (*C.SDL_RWops)(unsafe.Pointer(ctx))
	_size := (C.size_t)(size)
	_maxnum := (C.size_t)(maxnum)
	return (uint)(C.RWread(_ctx, ptr, _size, _maxnum))
}
示例#2
0
文件: sdl.go 项目: gnanderson/Go-SDL
func (rw *RWops) Read(buf []byte) (n int, err error) {
	n = int(C.RWread((*C.SDL_RWops)(rw), unsafe.Pointer(&buf[0]), 1, C.int(len(buf))))

	if rw.EOF() {
		err = io.EOF
	}

	if n < 0 {
		err = errors.New(GetError())
	}

	return
}
示例#3
0
文件: rwops.go 项目: JalfResi/go-sdl2
func (ctx *RWops) RWread(ptr unsafe.Pointer, size, maxnum uint) uint {
	if ctx == nil {
		return 0
	}
	return uint(C.RWread(ctx.cptr(), ptr, C.size_t(size), C.size_t(maxnum)))
}