コード例 #1
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
 public void SetNoControl()
 {
     m_joystickAxis   = MyJoystickAxesEnum.None;
     m_joystickButton = MyJoystickButtonsEnum.None;
     m_mouseButton    = MyMouseButtonsEnum.None;
     m_keyboardKey    = Keys.None;
     m_keyboardKey2   = Keys.None;
 }
コード例 #2
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum?defaultControlMouse,
                  Keys?defaultControlKey, MyJoystickButtonsEnum?defaultControlJoy, MyJoystickAxesEnum?defaultControlJoyAxis)
     : this(control, text, controlType)
 {
     m_mouseButton    = defaultControlMouse.HasValue ? defaultControlMouse.Value : MyMouseButtonsEnum.None;
     m_keyboardKey    = defaultControlKey.HasValue ? defaultControlKey.Value : Keys.None;
     m_joystickButton = defaultControlJoy.HasValue ? defaultControlJoy.Value : MyJoystickButtonsEnum.None;
     m_joystickAxis   = defaultControlJoyAxis.HasValue ? defaultControlJoyAxis.Value : MyJoystickAxesEnum.None;
 }
コード例 #3
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType)
 {
     m_editorControl   = control;
     m_gameControlType = MyGuiGameControlType.EDITOR;
     m_text            = text;
     m_controlType     = controlType;
     m_joystickButton  = MyJoystickButtonsEnum.None;
     m_joystickAxis    = MyJoystickAxesEnum.None;
     m_mouseButton     = MyMouseButtonsEnum.None;
     m_keyboardKey     = Keys.None;
 }
コード例 #4
0
        public static void NullControl(MyStringId context, MyJoystickButtonsEnum button)
        {
            MyStringId key = MyStringId.NullOrEmpty;

            foreach (var pair in m_bindings[context].Bindings)
            {
                if (pair.Value is JoystickButton && pair.Value.Code == (byte)button)
                {
                    key = pair.Key;
                    break;
                }
            }
            if (key != MyStringId.NullOrEmpty)
            {
                m_bindings[context][key] = m_nullControl;
            }
        }
コード例 #5
0
        string IMyControlNameLookup.GetName(MyJoystickButtonsEnum joystickButton)
        {
            if (joystickButton == MyJoystickButtonsEnum.None)
            {
                return("");
            }

            switch (joystickButton)
            {
            case MyJoystickButtonsEnum.JDLeft:  return(MyTexts.GetString(MyCommonTexts.JoystickButtonLeft));

            case MyJoystickButtonsEnum.JDRight: return(MyTexts.GetString(MyCommonTexts.JoystickButtonRight));

            case MyJoystickButtonsEnum.JDUp:    return(MyTexts.GetString(MyCommonTexts.JoystickButtonUp));

            case MyJoystickButtonsEnum.JDDown:  return(MyTexts.GetString(MyCommonTexts.JoystickButtonDown));

            default:
                return("JB" + ((int)joystickButton - 4));
            }
        }
コード例 #6
0
ファイル: MyNullInput.cs プロジェクト: fluxit/SpaceEngineers
 bool IMyInput.IsJoystickButtonNewPressed(MyJoystickButtonsEnum button) { return false; }
コード例 #7
0
 public string GetName(MyJoystickButtonsEnum joystickButton)
 {
     return m_nameLookup.GetName(joystickButton);
 }
コード例 #8
0
ファイル: MyNullInput.cs プロジェクト: fluxit/SpaceEngineers
 bool IMyInput.IsJoystickButtonValid(MyJoystickButtonsEnum button) { return false; }
コード例 #9
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
 public void SetControl(MyJoystickButtonsEnum joyButton)
 {
     m_joystickButton = joyButton;
 }
コード例 #10
0
 //  Check to see if a specific button on the joystick was released.
 public bool WasJoystickButtonReleased(MyJoystickButtonsEnum button)
 {
     bool wasReleased = false;
     //if (m_joystickConnected && button != MyJoystickButtonsEnum.None && m_previousJoystickState != null)
     if (IsJoystickConnected() && button != MyJoystickButtonsEnum.None)
     {
         GamepadButtonFlags flags = JoystickHelper.VRageToXInput(button);
         switch (button)
         {
             case MyJoystickButtonsEnum.J11:
                 wasReleased = !IsGamepadLTriggerPressed(m_previousJoystickState.Gamepad);
                 break;
             case MyJoystickButtonsEnum.J12:
                 wasReleased = !IsGamepadRTriggerPressed(m_previousJoystickState.Gamepad);
                 break;
             //default: wasReleased = (m_previousJoystickState.IsReleased((int)button - 5)); break;
             default: wasReleased = (m_previousJoystickState.Gamepad.Buttons & flags) == 0x0; break;
         }
     }
     if (!wasReleased && button == MyJoystickButtonsEnum.None)
     {
         return true;
     }
     return wasReleased;
 }
コード例 #11
0
 //  Check to see if a specific button on the joystick is pressed.
 bool ModAPI.IMyInput.IsJoystickButtonPressed(MyJoystickButtonsEnum button) { return ((IMyInput)this).IsJoystickButtonPressed(button); }
コード例 #12
0
 public JoystickButton(MyJoystickButtonsEnum button) { Button = button; }
コード例 #13
0
ファイル: MyControl.cs プロジェクト: Bunni/Miner-Wars-2081
 public void SetNoControl()
 {
     m_joystickAxis = MyJoystickAxesEnum.None;
     m_joystickButton = MyJoystickButtonsEnum.None;
     m_mouseButton = MyMouseButtonsEnum.None;
     m_keyboardKey = Keys.None;
     m_keyboardKey2 = Keys.None;
 }
コード例 #14
0
 public static void NullControl(MyStringId context, MyJoystickButtonsEnum button)
 {
     MyStringId key = MyStringId.NullOrEmpty;
     foreach (var pair in m_bindings[context].Bindings)
     {
         if (pair.Value is JoystickButton && pair.Value.Code == (byte)button)
         {
             key = pair.Key;
             break;
         }
     }
     if (key != MyStringId.NullOrEmpty)
         m_bindings[context][key] = m_nullControl;
 }
コード例 #15
0
ファイル: MyControl.cs プロジェクト: Bunni/Miner-Wars-2081
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType)
 {
     m_editorControl = control;
     m_gameControlType = MyGuiGameControlType.EDITOR;
     m_text = text;
     m_controlType = controlType;
     m_joystickButton = MyJoystickButtonsEnum.None;
     m_joystickAxis = MyJoystickAxesEnum.None;
     m_mouseButton = MyMouseButtonsEnum.None;
     m_keyboardKey = Keys.None;
 }
コード例 #16
0
ファイル: MyControl.cs プロジェクト: Bunni/Miner-Wars-2081
 public void SetControl(MyJoystickButtonsEnum joyButton)
 {
     m_joystickButton = joyButton;
 }
コード例 #17
0
ファイル: MyControl.cs プロジェクト: Bunni/Miner-Wars-2081
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyMouseButtonsEnum? defaultControlMouse,
     Keys? defaultControlKey, MyJoystickButtonsEnum? defaultControlJoy, MyJoystickAxesEnum? defaultControlJoyAxis)
     : this(control, text, controlType)
 {
     m_mouseButton = defaultControlMouse.HasValue ? defaultControlMouse.Value : MyMouseButtonsEnum.None;
     m_keyboardKey = defaultControlKey.HasValue ? defaultControlKey.Value : Keys.None;
     m_joystickButton = defaultControlJoy.HasValue ? defaultControlJoy.Value : MyJoystickButtonsEnum.None;
     m_joystickAxis = defaultControlJoyAxis.HasValue ? defaultControlJoyAxis.Value : MyJoystickAxesEnum.None;
 }
コード例 #18
0
ファイル: MyControl.cs プロジェクト: Bunni/Miner-Wars-2081
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyJoystickButtonsEnum defaultControl)
     : this(control, text, controlType, null, null, defaultControl, null)
 {
 }
コード例 #19
0
        string IMyControlNameLookup.GetName(MyJoystickButtonsEnum joystickButton)
        {
            if (joystickButton == MyJoystickButtonsEnum.None)
                return "";

            switch (joystickButton)
            {
                case MyJoystickButtonsEnum.JDLeft:  return MyTexts.GetString(MyCommonTexts.JoystickButtonLeft);
                case MyJoystickButtonsEnum.JDRight: return MyTexts.GetString(MyCommonTexts.JoystickButtonRight);
                case MyJoystickButtonsEnum.JDUp:    return MyTexts.GetString(MyCommonTexts.JoystickButtonUp);
                case MyJoystickButtonsEnum.JDDown:  return MyTexts.GetString(MyCommonTexts.JoystickButtonDown);

                default:
                    return "JB" + ((int)joystickButton - 4);
            }
        }
コード例 #20
0
 //  Check to see if a specific button on the joystick is currently pressed and was not pressed during the last update. 
 bool ModAPI.IMyInput.IsJoystickButtonNewPressed(MyJoystickButtonsEnum button) { return IsJoystickButtonNewPressed(button); }
コード例 #21
0
 //  Check to see if a specific button on the joystick was released.
 public bool WasJoystickButtonReleased(MyJoystickButtonsEnum button)
 {
     bool wasReleased = false;
     if (m_joystickConnected && button != MyJoystickButtonsEnum.None && m_previousJoystickState != null)
     {
         switch (button)
         {
             case MyJoystickButtonsEnum.JDLeft: wasReleased = !WasGamepadKeyLeftPressed(); break;
             case MyJoystickButtonsEnum.JDRight: wasReleased = !WasGamepadKeyRightPressed(); break;
             case MyJoystickButtonsEnum.JDUp: wasReleased = !WasGamepadKeyUpPressed(); break;
             case MyJoystickButtonsEnum.JDDown: wasReleased = !WasGamepadKeyDownPressed(); break;
             default: wasReleased = (m_previousJoystickState.IsReleased((int)button - 5)); break;
         }
     }
     if (!wasReleased && button == MyJoystickButtonsEnum.None)
     {
         return true;
     }
     return wasReleased;
 }
コード例 #22
0
 //  Return true if joystick button is valid for user controls
 bool ModAPI.IMyInput.IsJoystickButtonValid(MyJoystickButtonsEnum button) { return IsJoystickButtonValid(button); }
コード例 #23
0
 //  Return true if joystick button is valid for user controls
 bool ModAPI.IMyInput.IsJoystickButtonValid(MyJoystickButtonsEnum button)
 {
     return(((IMyInput)this).IsJoystickButtonValid(button));
 }
コード例 #24
0
 //  Check to see if a specific button on the joystick is currently pressed and was not pressed during the last update.
 bool ModAPI.IMyInput.IsJoystickButtonNewPressed(MyJoystickButtonsEnum button)
 {
     return(IsJoystickButtonNewPressed(button));
 }
コード例 #25
0
 //  Check to see if a specific button on the joystick is pressed.
 public bool IsJoystickButtonPressed(MyJoystickButtonsEnum button)
 {
     bool isPressed = false;
     if (IsJoystickConnected() && button != MyJoystickButtonsEnum.None)
     {
         switch (button)
         {
             case MyJoystickButtonsEnum.J11:
                 isPressed = IsGamepadLTriggerPressed(m_actualJoystickState.Gamepad);
                 break;
             case MyJoystickButtonsEnum.J12:
                 isPressed = IsGamepadRTriggerPressed(m_actualJoystickState.Gamepad);
                 break;
             default: isPressed = (m_actualJoystickState.Gamepad.Buttons & JoystickHelper.VRageToXInput(button)) != 0x0; break;
         }
     }
     if (!isPressed && button == MyJoystickButtonsEnum.None)
     {
         return true;
     }
     return isPressed;
 }
コード例 #26
0
 public static void AddControl(MyStringId context, MyStringId stringId, MyJoystickButtonsEnum button)
 {
     m_bindings[context][stringId] = new JoystickButton(button);
 }
コード例 #27
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
 public MyControl(MyEditorControlEnums control, MyTextsWrapperEnum text, MyGuiControlTypeEnum controlType, MyJoystickButtonsEnum defaultControl)
     : this(control, text, controlType, null, null, defaultControl, null)
 {
 }
コード例 #28
0
 public bool IsJoystickButtonReleased(MyJoystickButtonsEnum button)
 {
     bool isReleased = false;
     if (m_joystickConnected && button != MyJoystickButtonsEnum.None && m_actualJoystickState != null)
     {
         switch (button)
         {
             case MyJoystickButtonsEnum.JDLeft: isReleased = !IsGamepadKeyLeftPressed(); break;
             case MyJoystickButtonsEnum.JDRight: isReleased = !IsGamepadKeyRightPressed(); break;
             case MyJoystickButtonsEnum.JDUp: isReleased = !IsGamepadKeyUpPressed(); break;
             case MyJoystickButtonsEnum.JDDown: isReleased = !IsGamepadKeyDownPressed(); break;
             default: isReleased = m_actualJoystickState.IsReleased((int)button - 5); break;
         }
     }
     if (!isReleased && button == MyJoystickButtonsEnum.None)
     {
         return true;
     }
     return isReleased;
 }
コード例 #29
0
ファイル: MyControl.cs プロジェクト: fluxit/SpaceEngineers
 public static void AppendName(ref StringBuilder output, MyJoystickButtonsEnum joystickButton)
 {
     EnsureExists(ref output);
     output.Append(MyInput.Static.GetName(joystickButton));
 }
コード例 #30
0
 bool ModAPI.IMyInput.IsNewJoystickButtonReleased(MyJoystickButtonsEnum button)
 {
     return(((IMyInput)this).IsNewJoystickButtonReleased(button));
 }
コード例 #31
0
ファイル: MyControl.cs プロジェクト: warex0/SpaceEngineers
 public static void AppendName(ref StringBuilder output, MyJoystickButtonsEnum joystickButton)
 {
     EnsureExists(ref output);
     output.Append(MyInput.Static.GetName(joystickButton));
 }
コード例 #32
0
 string ModAPI.IMyInput.GetName(MyJoystickButtonsEnum joystickButton)
 {
     return(((IMyInput)this).GetName(joystickButton));
 }
コード例 #33
0
 static public uint VRageToXInput(MyJoystickButtonsEnum button)
 {
     return (uint)(kArrVRageToXInput[(byte)button]);
 }
コード例 #34
0
 public bool IsNewJoystickButtonReleased(MyJoystickButtonsEnum button)
 {
     bool isReleased = false;
     //if (m_joystickConnected && button != MyJoystickButtonsEnum.None && m_actualJoystickState != null && m_previousJoystickState != null)
     if (IsJoystickConnected() && button != MyJoystickButtonsEnum.None) // && m_actualJoystickState != null && m_previousJoystickState != null)
     {
         GamepadButtonFlags flags = JoystickHelper.VRageToXInput(button);
         switch (button)
         {
             case MyJoystickButtonsEnum.J11:
                 isReleased = (!IsGamepadLTriggerPressed(m_actualJoystickState.Gamepad)) &&
                     IsGamepadLTriggerPressed(m_previousJoystickState.Gamepad);
                 break;
             case MyJoystickButtonsEnum.J12:
                 isReleased = (!IsGamepadRTriggerPressed(m_actualJoystickState.Gamepad)) &&
                     IsGamepadRTriggerPressed(m_previousJoystickState.Gamepad);
                 break;
             //default: isReleased = ((m_actualJoystickState.IsReleased((int)button - 5)) && (m_previousJoystickState.IsPressed((int)button - 5))); break;
             default: isReleased = ((m_actualJoystickState.Gamepad.Buttons & flags) == 0x0) &&
                 ((m_previousJoystickState.Gamepad.Buttons & flags) != 0x0); break;
         }
     }
     if (!isReleased && button == MyJoystickButtonsEnum.None)
     {
         return true;
     }
     return isReleased;
 }
コード例 #35
0
 bool IMyInput.IsJoystickButtonNewPressed(MyJoystickButtonsEnum button)
 {
     return(false);
 }
コード例 #36
0
 //  Return true if joystick button is valid for user controls
 public bool IsJoystickButtonValid(MyJoystickButtonsEnum button)
 {
     foreach (var item in m_validJoystickButtons)
     {
         if (item == button) return true;
     }
     return false;
 }
コード例 #37
0
 bool IMyInput.IsNewJoystickButtonReleased(MyJoystickButtonsEnum button)
 {
     return(false);
 }
コード例 #38
0
 static public GamepadButtonFlags VRageToXInput(MyJoystickButtonsEnum button)
 {
     return kArrVRageToXInput[(byte)button];
 }
コード例 #39
0
 bool IMyInput.IsJoystickButtonValid(MyJoystickButtonsEnum button)
 {
     return(false);
 }
コード例 #40
0
ファイル: MyNullInput.cs プロジェクト: fluxit/SpaceEngineers
 string IMyInput.GetName(MyJoystickButtonsEnum joystickButton) { return ""; }
コード例 #41
0
 string IMyInput.GetName(MyJoystickButtonsEnum joystickButton)
 {
     return("");
 }
コード例 #42
0
ファイル: MyNullInput.cs プロジェクト: fluxit/SpaceEngineers
 bool IMyInput.IsNewJoystickButtonReleased(MyJoystickButtonsEnum button) { return false; }
コード例 #43
0
 public JoystickButton(MyJoystickButtonsEnum button)
 {
     Button = button;
 }
コード例 #44
0
 bool ModAPI.IMyInput.IsNewJoystickButtonReleased(MyJoystickButtonsEnum button) { return IsNewJoystickButtonReleased(button); }
コード例 #45
0
 public static void AddControl(MyStringId context, MyStringId stringId, MyJoystickButtonsEnum button)
 {
     m_bindings[context][stringId] = new JoystickButton(button);
 }
コード例 #46
0
 string ModAPI.IMyInput.GetName(MyJoystickButtonsEnum joystickButton) { return GetName(joystickButton); }
コード例 #47
0
ファイル: MyGuiInput.cs プロジェクト: Bunni/Miner-Wars-2081
 //  Return true if joystick button is used by some user control
 public MyControl GetControl(MyJoystickButtonsEnum button, MyGuiGameControlType gameControlType)
 {
     MyControl[] controlsList = GetControlsListByGameControlType(gameControlType);
     foreach (var item in m_gameControlsList)
     {
         if (item.GetJoystickControl() == button) return item;
     }
     return null;
 }