Golang C.SDL_JoystickGetBall类(方法)实例源码

下面列出了Golang C.SDL_JoystickGetBall 类(方法)源码代码实例,从而了解它的用法。

作者:TomMurra    项目:go-sdl   
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))
}

作者:beora    项目:fung   
// 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
}

作者:gnanderso    项目:Go-SD   
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
}

作者:kearsle    项目:Go-SD   
// 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))))
}

作者:tanem    项目:amor   
// 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))
}


问题


面经


文章

微信
公众号

扫码关注公众号