Example #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))
}
Example #2
0
// 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
}
Example #3
0
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
}
Example #4
0
// 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))))
}
Example #5
0
// 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))
}