예제 #1
0
func (joystick *Joystick) GetBall(ball int, dx, dy *int) int {
	_joystick := (*C.SDL_Joystick)(joystick)
	_ball := (C.int)(ball)
	_dx := (*C.int)(unsafe.Pointer(dx))
	_dy := (*C.int)(unsafe.Pointer(dy))
	return (int)(C.SDL_JoystickGetBall(_joystick, _ball, _dx, _dy))
}
예제 #2
0
파일: joystick.go 프로젝트: beoran/fungo
// Get the ball axis change since the last poll
// This returns the change in x and y, and true, or 0 ,0, false
// or -1 if you passed it invalid parameters.
// The ball indices start at index 0.
func JoystickGetBall(joystick *C.SDL_Joystick, ball int) (int, int, bool) {
	x := 0
	y := 0
	dx := (*C.int)(unsafe.Pointer(&x))
	dy := (*C.int)(unsafe.Pointer(&y))
	res := i2b(int(C.SDL_JoystickGetBall(joystick, C.int(ball), dx, dy)))
	if !res {
		return 0, 0, false
	}
	return x, y, true
}
예제 #3
0
파일: sdl.go 프로젝트: gnanderson/Go-SDL
func (j *Joystick) GetBall(n int) (dx, dy int) {
	ret := C.SDL_JoystickGetBall((*C.SDL_Joystick)(unsafe.Pointer(j)),
		C.int(n),
		(*C.int)(unsafe.Pointer(&dx)),
		(*C.int)(unsafe.Pointer(&dy)),
	)

	if ret < 0 {
		dx, dy = -1, -1
	}

	return
}
예제 #4
0
파일: sdl.go 프로젝트: kearsley/Go-SDL
// Get the ball axis change since the last poll. The ball indices
// start at index 0. This returns 0, or -1 if you passed it invalid
// parameters.
func (joystick *Joystick) GetBall(ball int, dx, dy *int) int {
	return int(C.SDL_JoystickGetBall(joystick.cJoystick, C.int(ball), (*C.int)(cast(dx)), (*C.int)(cast(dy))))
}
예제 #5
0
파일: joystick.go 프로젝트: tanema/amore
// Joystick (https://wiki.libsdl.org/SDL_JoystickGetBall)
func (joy *Joystick) GetBall(ball int, dx, dy *int) int {
	_dx := (*C.int)(unsafe.Pointer(dx))
	_dy := (*C.int)(unsafe.Pointer(dy))
	return (int)(C.SDL_JoystickGetBall(joy.cptr(), C.int(ball), _dx, _dy))
}