Exemple #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))
}
Exemple #2
0
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
}
Exemple #3
0
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)))
}