// Utility public static void GetState(ref NpadState pOutValue, NpadId npadId, NpadStyle npadStyle) { NpadButton preButtons = pOutValue.buttons; switch (npadStyle) { case NpadStyle.FullKey: NpadFullKey.GetState(ref pOutValue, npadId); break; case NpadStyle.Handheld: NpadHandheld.GetState(ref pOutValue, npadId); break; case NpadStyle.JoyDual: NpadJoyDual.GetState(ref pOutValue, npadId); break; case NpadStyle.JoyLeft: NpadJoyLeft.GetState(ref pOutValue, npadId); break; case NpadStyle.JoyRight: NpadJoyRight.GetState(ref pOutValue, npadId); break; } pOutValue.preButtons = preButtons; }
private void HandleNpadButtonUpEvent(int npadIndex, NpadButton button) { lock (_lock) { KeyboardResult result = KeyboardResult.NotSet; switch (button) { case NpadButton.A: result = KeyboardResult.Accept; _keyboardRenderer.UpdateCommandState(false, null, null); break; case NpadButton.B: result = KeyboardResult.Cancel; _keyboardRenderer.UpdateCommandState(null, false, null); break; } if (IsKeyboardActive()) { if (!_canAcceptController) { _canAcceptController = true; } else if (InputModeControllerEnabled()) { PushUpdatedState(_textValue, _cursorBegin, result); } } } }
public void Clear() { this.samplingNumber = 0; this.buttons = NpadButton.None; this.analogStickL.Clear(); this.analogStickR.Clear(); this.attributes = NpadAttribute.None; this.preButtons = NpadButton.None; }
/// <summary> /// 今のフレームにボタンを離したか /// </summary> /// <param name="index">コントローラーの番号</param> /// <param name="button">取得するボタン</param> /// <returns>離したならtrueを返す</returns> static public bool GetButtonUp(int index, NpadButton button) { //未接続ならfalse if (!SwitchManager.GetInstance().IsConnect(index)) { return(false); } return(IsPrevButton(index, (long)button) && !IsCurrentButton(index, (long)button)); }
public NpadButton GetCurrentButtonsOfAllNpads() { NpadButton buttons = 0; foreach (var state in _lastStates) { buttons |= state.Buttons; } return(buttons); }
/// <summary>Buttonの入力</summary> /// <param name="input">入力するButton</param> /// <param name="Push">入力の種類(引数無しの時は押しっぱなし)</param> public bool ButtonGet(NpadButton input, Style style = Style.Push) { try { return(GetButtonSet(ButtonKeep[input], input, style)); } catch (KeyNotFoundException) { ButtonKeep[input] = new InputSet(); return(GetButtonSet(ButtonKeep[input], input, style)); } }
private bool GetButtonSet(InputSet inputSet, NpadButton input, Style style) { inputSet.Push = npadState.GetButtonDown(input); if (style == Style.Down) { inputSet.Back = inputSet.Push && !inputSet.Keep; } if (style == Style.Up) { inputSet.Back = !inputSet.Push && inputSet.Keep; } inputSet.Keep = inputSet.Push; if (style == Style.Push) { return(inputSet.Keep); } return(inputSet.Back); }
private void ActivateFrontend() { Logger.Debug?.Print(LogClass.ServiceAm, $"Activating software keyboard frontend"); _inputMode = KeyboardInputMode.ControllerAndKeyboard; _npads.Update(true); NpadButton buttons = _npads.GetCurrentButtonsOfAllNpads(); // Block the input if the current accept key is pressed so the applet won't be instantly closed. _canAcceptController = (buttons & NpadButton.A) == 0; _dynamicTextInputHandler.TextProcessingEnabled = true; _keyboardRenderer.UpdateCommandState(null, null, true); _keyboardRenderer.UpdateTextState(null, null, null, null, true); }
private void HandleNpadButtonDownEvent(int npadIndex, NpadButton button) { lock (_lock) { if (!IsKeyboardActive()) { return; } switch (button) { case NpadButton.A: _keyboardRenderer.UpdateCommandState(_canAcceptController, null, null); break; case NpadButton.B: _keyboardRenderer.UpdateCommandState(null, _canAcceptController, null); break; } } }
public bool GetButtonDown(NpadButton button) => default; // 0x00A1C5F0-0x00A1C620 public bool GetButtonUp(NpadButton button) => default; // 0x00A1C620-0x00A1C920
public bool GetButton(NpadButton button) => default; // 0x00A1C5E0-0x00A1C5F0 public bool GetButtonDown(NpadButton button) => default; // 0x00A1C5F0-0x00A1C620
} // 0x00A1C5C0-0x00A1C5E0 public bool GetButton(NpadButton button) => default; // 0x00A1C5E0-0x00A1C5F0
public bool GetButtonUp(NpadButton button) { return(((this.preButtons & button) != 0) && ((this.buttons & button) == 0)); }
public bool GetButton(NpadButton button) { return((this.buttons & button) != 0); }
bool GetButtonState(NpadButton button) { return((state.buttons & button) != 0); }