// JoystickJustPressed returns whether the joystick Button has just been pressed down.
// If the button index is out of range, this will return false.
//
// This API is experimental.
968882
func (w *Window) JoystickJustPressed(js Joystick, button int) bool {
	return w.currJoy.getButton(js, button) && !w.prevJoy.getButton(js, button)
}
646617
func GameControllerMappingForGUID(guid JoystickGUID) string {
	mappingString := C.SDL_GameControllerMappingForGUID(guid.c())
	defer C.free(unsafe.Pointer(mappingString))
	return C.GoString(mappingString)
}
672488
func (w *WiichuckDriver) setJoystickDefaultValue(joystickAxis string, defaultValue float64) {
	w.mtx.Lock()
	defer w.mtx.Unlock()
	if w.joystick[joystickAxis] == -1 {
		w.joystick[joystickAxis] = defaultValue
	}
}
708908
func (w *Window) JoystickName(js Joystick) string {
	return w.currJoy.name[js]
}
839161
func progressBehavior(state *nstyle.WidgetStates, in *Input, r rect.Rect, maxval int, value int, modifiable bool) int {
	if !modifiable {
		*state = nstyle.WidgetStateInactive
		return value
	}

	exitstate := basicWidgetStateControl(state, in, r)

	if *state == nstyle.WidgetStateActive {
		if !in.Mouse.Down(mouse.ButtonLeft) {
			*state = exitstate
		} else {
			ratio := maxFloat(0, float64(in.Mouse.Pos.X-r.X)) / float64(r.W)
			value = int(float64(maxval) * ratio)
			if value < 0 {
				value = 0
			}
		}
	}

	if maxval > 0 && value > maxval {
		value = maxval
	}
	return value
}
107669
func JoystickGetDeviceVendor(index int) int {
	return int(C.SDL_JoystickGetDeviceVendor(C.int(index)))
}
227950
func (c *Emulation) SetTouchEmulationEnabled(enabled bool, maxTouchPoints int) (*gcdmessage.ChromeResponse, error) {
	var v EmulationSetTouchEmulationEnabledParams
	v.Enabled = enabled
	v.MaxTouchPoints = maxTouchPoints
	return c.SetTouchEmulationEnabledWithParams(&v)
}
299425
func JoystickGetGUIDFromString(pchGUID string) JoystickGUID {
	_pchGUID := C.CString(pchGUID)
	defer C.free(unsafe.Pointer(_pchGUID))
	return (JoystickGUID)(C.SDL_JoystickGetGUIDFromString(_pchGUID))
}
1288430
func (w *WiichuckDriver) adjustOrigins() {
	w.setJoystickDefaultValue("sy_origin", w.data["sy"])
	w.setJoystickDefaultValue("sx_origin", w.data["sx"])
}
83881
func (c *Context) EditPressedInlineKeyboard(kb InlineKeyboard) error {
	if c.Callback == nil {
		return errors.New("EditPressedInlineKeyboard: Callback is not presented")
	}

	return c.EditInlineKeyboard(c.Callback.Message, c.Callback.Message.InlineKeyboardMarkup.State, kb)
}
692516
func (l *LogEvent) LevelJustified() (rv string) {
	rv = l.Level.String()
	if len(rv) < 5 {
		rv += strings.Repeat(" ", 5-len(rv))
	}
	return rv
}
1043511
func HapticOpened(index int) (bool, error) {
	ret := int(C.SDL_HapticOpened(C.int(index)))
	if ret == 0 {
		return false, GetError()
	}
	return ret == 1, nil
}
1214021
func (bind *GameControllerButtonBind) Axis() int {
	val, _ := binary.Varint(bind.value[:4])
	return int(val)
}
268153
func (tp *TouchPeer) OnTouchMove(pxx, pxy float32) {
	simlog.FuncIn()
	x, y := tp.calcTouchedPosition(pxx, pxy)
	for i := range tp.touchListeners {
		tp.touchListeners[i].OnTouchMove(x, y)
	}
	simlog.FuncOut()
}
33349
func (joy *Joystick) AxisInitialState(axis int) (state int16, ok bool) {
	ok = C.SDL_JoystickGetAxisInitialState(joy.cptr(), C.int(axis), (*C.Sint16)(&state)) == C.SDL_TRUE
	return
}
679621
func (js *joystickState) getButton(joystick Joystick, button int) bool {
	// Check that the joystick and button is valid, return false by default
	if js.buttons[joystick] == nil || button >= len(js.buttons[joystick]) || button < 0 {
		return false
	}
	return js.buttons[joystick][byte(button)] == 1
}
682705
func (joy *Joystick) Button(button int) byte {
	return (byte)(C.SDL_JoystickGetButton(joy.cptr(), C.int(button)))
}