// JoystickPos queries the current position of one or more axes of a joystick. // The positional values are returned in an array, where the first element // represents the first axis of the joystick (normally the X axis). Each // position is in the range -1.0 to 1.0. Where applicable, the positive // direction of an axis is right, forward or up, and the negative direction is // left, back or down. // // Note: If len(axes) exceeds the number of axes supported by the joystick, or if // the joystick is not available, the unused elements in the pos array will be // set to 0.0 (zero). // // Note: The function returns the number of actually returned axes. This is // the minimum of len(axes) and the number of axes supported by the joystick. // If the joystick is not supported or connected, the function will return 0 (zero). func JoystickPos(joy int, axes []float32) int { if len(axes) == 0 { return 0 } return int(C.glfwGetJoystickPos(C.int(joy), (*C.float)(unsafe.Pointer(&axes[0])), C.int(len(axes)))) }
func JoystickPos(joy int, numaxes int) float32 { var pos C.float if int(C.glfwGetJoystickPos(C.int(joy), &pos, C.int(numaxes))) != 1 { return 0 } return float32(pos) }