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

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

作者:21isgonnabeagoodyea    项目:gg   
func Keystate(key string) int {
	if key == "joy1stick1x" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 0))
	}
	if key == "joy1stick1y" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 1))
	}
	if key == "joy1stick2x" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 3))
	}
	if key == "joy1stick2y" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 4))
	}
	if key == "joy1a" {
		makestickopened()
		return int(C.SDL_JoystickGetButton(joy, 0))
	}
	var length C.int
	keys := C.SDL_GetKeyboardState(&length)
	return int(*(*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(keys)) + uintptr(str2scancode(key))))) //letter scancodes start at 4

}

作者:kearsle    项目:Go-SD   
// Get the current state of a button on a joystick. The button indices
// start at index 0.
func (joystick *Joystick) GetButton(button int) uint8 {
	return uint8(C.SDL_JoystickGetButton(joystick.cJoystick, C.int(button)))
}

作者:TomMurra    项目:go-sdl   
func (joystick *Joystick) GetButton(button int) byte {
	_joystick := (*C.SDL_Joystick)(joystick)
	_button := (C.int)(button)
	return (byte)(C.SDL_JoystickGetButton(_joystick, _button))
}

作者:tanem    项目:amor   
// Joystick (https://wiki.libsdl.org/SDL_JoystickGetButton)
func (joy *Joystick) GetButton(button int) byte {
	return (byte)(C.SDL_JoystickGetButton(joy.cptr(), C.int(button)))
}

作者:gnanderso    项目:Go-SD   
func (j *Joystick) GetButton(n int) bool {
	return C.SDL_JoystickGetButton((*C.SDL_Joystick)(unsafe.Pointer(j)), C.int(n)) != 0
}

作者:beora    项目:fung   
// Get the current state of a button on a joystick
// The button indices start at index 0.
func JoystickGetButton(joystick *C.SDL_Joystick, button int) uint8 {
	return uint8(C.SDL_JoystickGetButton(joystick, C.int(button)))
}


问题


面经


文章

微信
公众号

扫码关注公众号