示例#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))
}
示例#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))
}
示例#3
0
文件: sdl.go 项目: gnanderson/Go-SDL
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
}
示例#4
0
文件: rwops.go 项目: JalfResi/go-sdl2
func (ctx *RWops) RWtell() int64 {
	if ctx == nil {
		return 0
	}
	return int64(C.RWseek(ctx.cptr(), 0, RW_SEEK_CUR))
}
示例#5
0
文件: rwops.go 项目: JalfResi/go-sdl2
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)))
}