Example #1
0
func (rw *RWops) Write(buf []byte) (n int, err error) {
	n = int(C.RWwrite((*C.SDL_RWops)(rw), unsafe.Pointer(&buf[0]), 1, C.int(len(buf))))

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

	return
}
Example #2
0
func (ctx *RWops) RWwrite(ptr unsafe.Pointer, size, num uint) uint {
	if ctx == nil {
		return 0
	}
	if ptr == nil {
		return 0
	}
	return uint(C.RWwrite(ctx.cptr(), ptr, C.size_t(size), C.size_t(size)))
}
Example #3
0
func (ctx *RWops) RWwrite(ptr unsafe.Pointer, size, num uint) uint {
	if ctx == nil {
		return 0
	}
	if ptr == nil {
		return 0
	}
	_ctx := (*C.SDL_RWops)(unsafe.Pointer(ctx))
	_size := (C.size_t)(size)
	_num := (C.size_t)(num)
	return (uint)(C.RWwrite(_ctx, ptr, _size, _num))
}