Beispiel #1
0
func (ctx *RWops) RWtell() int64 {
	if ctx == nil {
		return 0
	}
	_ctx := (*C.SDL_RWops)(unsafe.Pointer(ctx))
	return (int64)(C.RWseek(_ctx, 0, RW_SEEK_CUR))
}
Beispiel #2
0
func (ctx *RWops) RWseek(offset int64, whence int) int64 {
	if ctx == nil {
		return -1
	}
	_ctx := (*C.SDL_RWops)(unsafe.Pointer(ctx))
	_offset := (C.Sint64)(offset)
	_whence := (C.int)(whence)
	return (int64)(C.RWseek(_ctx, _offset, _whence))
}
Beispiel #3
0
func (rw *RWops) Seek(offset int64, whence int) (int64, error) {
	var w C.int
	switch whence {
	case 0:
		w = C.SEEK_SET
	case 1:
		w = C.SEEK_CUR
	case 2:
		w = C.SEEK_END
	default:
		return offset, errors.New("Bad whence.")
	}

	return int64(C.RWseek((*C.SDL_RWops)(rw), C.int(offset), w)), nil
}
Beispiel #4
0
func (ctx *RWops) RWtell() int64 {
	if ctx == nil {
		return 0
	}
	return int64(C.RWseek(ctx.cptr(), 0, RW_SEEK_CUR))
}
Beispiel #5
0
func (ctx *RWops) RWseek(offset int64, whence int) int64 {
	if ctx == nil {
		return -1
	}
	return int64(C.RWseek(ctx.cptr(), C.Sint64(offset), C.int(whence)))
}