예제 #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)))
}