当前位置: 首页>>代码示例>>C#>>正文


C# MyJoystickAxesEnum类代码示例

本文整理汇总了C#中MyJoystickAxesEnum的典型用法代码示例。如果您正苦于以下问题:C# MyJoystickAxesEnum类的具体用法?C# MyJoystickAxesEnum怎么用?C# MyJoystickAxesEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyJoystickAxesEnum类属于命名空间,在下文中一共展示了MyJoystickAxesEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ComputeJoystickAxisState

        private float ComputeJoystickAxisState(XB1Interface.XB1Interface.GamepadState padState, MyJoystickAxesEnum axis)
        {
            float value = 0.0f;
            if (IsJoystickConnected() && IsJoystickAxisSupported(axis))
            {
                
                switch (axis)
                {
                        
                    case MyJoystickAxesEnum.RotationXpos:
                    case MyJoystickAxesEnum.RotationXneg: value = padState.rx; break;
                    case MyJoystickAxesEnum.RotationYpos:
                    case MyJoystickAxesEnum.RotationYneg: value = -padState.ry; break;
                    case MyJoystickAxesEnum.Xpos:
                    case MyJoystickAxesEnum.Xneg: value = padState.lx; break;
                    case MyJoystickAxesEnum.Ypos:
                    case MyJoystickAxesEnum.Yneg: value = -padState.ly; break;

                }
                 
            }
            return value;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:23,代码来源:MyXInputInput.cs

示例2: IsJoystickAxisNewPressed

 //  Check to see if a specific button on the joystick is currently pressed and was not pressed during the last update. 
 bool ModAPI.IMyInput.IsJoystickAxisNewPressed(MyJoystickAxesEnum axis) { return IsJoystickAxisNewPressed(axis); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:2,代码来源:MyDirectXInput_ModAPI.cs

示例3: IsJoystickAxisValid

 //  Return true if joystick axis is valid for user controls
 bool ModAPI.IMyInput.IsJoystickAxisValid(MyJoystickAxesEnum axis) { return IsJoystickAxisValid(axis); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:2,代码来源:MyDirectXInput_ModAPI.cs

示例4:

 float IMyInput.GetJoystickAxisStateForGameplay(MyJoystickAxesEnum axis) { return 0; }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:1,代码来源:MyNullInput.cs

示例5: IsJoystickAxisValid

 //  Return true if joystick axis is valid for user controls
 public bool IsJoystickAxisValid(MyJoystickAxesEnum axis)
 {
     foreach (var item in m_validJoystickAxes)
     {
         if (item == axis) return true;
     }
     return false;
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:9,代码来源:MyXInputInput.cs

示例6: NullControl

 public static void NullControl(MyStringId context, MyJoystickAxesEnum axis)
 {
     MyStringId key = MyStringId.NullOrEmpty;
     foreach (var pair in m_bindings[context].Bindings)
     {
         if (pair.Value is JoystickAxis && pair.Value.Code == (byte)axis)
         {
             key = pair.Key;
             break;
         }
     }
     if (key != MyStringId.NullOrEmpty)
         m_bindings[context][key] = m_nullControl;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MyControllerHelper.cs

示例7: GetPreviousJoystickAxisStateRaw

 //  Find out how much a specific joystick axis was pressed.
 //  Return a raw number between 0 and 65535. 32768 is the middle value.
 public float GetPreviousJoystickAxisStateRaw(MyJoystickAxesEnum axis)
 {
     int value = 32768;
     if (m_joystickConnected && axis != MyJoystickAxesEnum.None && m_previousJoystickState != null && IsJoystickAxisSupported(axis))
     {
         switch (axis)
         {
             case MyJoystickAxesEnum.RotationXpos:
             case MyJoystickAxesEnum.RotationXneg: value = m_previousJoystickState.RotationX; break;
             case MyJoystickAxesEnum.RotationYpos:
             case MyJoystickAxesEnum.RotationYneg: value = m_previousJoystickState.RotationY; break;
             case MyJoystickAxesEnum.RotationZpos:
             case MyJoystickAxesEnum.RotationZneg: value = m_previousJoystickState.RotationZ; break;
             case MyJoystickAxesEnum.Xpos:
             case MyJoystickAxesEnum.Xneg: value = m_previousJoystickState.X; break;
             case MyJoystickAxesEnum.Ypos:
             case MyJoystickAxesEnum.Yneg: value = m_previousJoystickState.Y; break;
             case MyJoystickAxesEnum.Zpos:
             case MyJoystickAxesEnum.Zneg: value = m_previousJoystickState.Z; break;
             case MyJoystickAxesEnum.Slider1pos:
             case MyJoystickAxesEnum.Slider1neg:
                 {
                     var array = m_previousJoystickState.Sliders;
                     value = (array.Length < 1) ? 32768 : array[0];
                 }
                 break;
             case MyJoystickAxesEnum.Slider2pos:
             case MyJoystickAxesEnum.Slider2neg:
                 {
                     var array = m_previousJoystickState.Sliders;
                     value = (array.Length < 2) ? 32768 : array[1];
                 }
                 break;
         }
     }
     return value;
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:39,代码来源:MyDirectXInput.cs

示例8: JoystickAxis

 public JoystickAxis(MyJoystickAxesEnum axis) { Axis = axis; }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:1,代码来源:MyControllerHelper.cs

示例9: AddControl

 public static void AddControl(MyStringId context, MyStringId stringId, MyJoystickAxesEnum axis)
 {
     m_bindings[context][stringId] = new JoystickAxis(axis);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:4,代码来源:MyControllerHelper.cs

示例10: GetPreviousJoystickAxisStateForGameplay

 //  Find out how much a specific joystick half-axis is pressed.
 //  Return a number between 0 and 1 (taking deadzone, sensitivity and non-linearity into account).
 public float GetPreviousJoystickAxisStateForGameplay(MyJoystickAxesEnum axis)
 {
     return ComputeJoystickAxisStateForGameplay(m_previousJoystickState, axis);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:6,代码来源:MyXInputInput.cs

示例11: GetJoystickAxisStateForGameplay

 //  Find out how much a specific joystick half-axis is pressed.
 //  Return a number between 0 and 1 (taking deadzone, sensitivity and non-linearity into account).
 public float GetJoystickAxisStateForGameplay(MyJoystickAxesEnum axis)
 {
     return ComputeJoystickAxisStateForGameplay(m_actualJoystickState, axis);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:6,代码来源:MyXInputInput.cs

示例12: ComputeJoystickAxisStateForGameplay

        private float ComputeJoystickAxisStateForGameplay(XB1Interface.XB1Interface.GamepadState padState, MyJoystickAxesEnum axis)
        {
            if (IsJoystickConnected() && IsJoystickAxisSupported(axis))
            {
                // Input position scaled to (-1..1).
                float position = ComputeJoystickAxisState(padState, axis);
                float distance = (((int)axis) % 2 != 0) ? position : -position; // even -> neg axis
                if (distance > m_joystickDeadzone)
                {
                    distance = (distance - m_joystickDeadzone) / (1 - m_joystickDeadzone);  // Rescale distance to (0..1) outside the deadzone.
                    return m_joystickSensitivity * (float)Math.Pow(distance, m_joystickExponent);
                }
            }

            return 0.0f;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:16,代码来源:MyXInputInput.cs

示例13: WasJoystickAxisReleased

 //  Check to see if a specific button on the joystick was released.
 public bool WasJoystickAxisReleased(MyJoystickAxesEnum axis)
 {
     bool isPressed = false;
     //if (m_joystickConnected && axis != MyJoystickAxesEnum.None && m_previousJoystickState != null)
     if (IsJoystickConnected() && axis != MyJoystickAxesEnum.None)
     {
         isPressed = GetPreviousJoystickAxisStateForGameplay(axis) <= MyJoystickConstants.ANALOG_PRESSED_THRESHOLD;
     }
     if (!isPressed && axis == MyJoystickAxesEnum.None)
     {
         return true;
     }
     if (!IsJoystickAxisSupported(axis)) return false;
     return isPressed;
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:16,代码来源:MyXInputInput.cs

示例14: IsJoystickAxisPressed

 public bool IsJoystickAxisPressed(MyJoystickAxesEnum axis)
 {
     bool isPressed = false;
     if (m_joystickConnected && axis != MyJoystickAxesEnum.None && m_actualJoystickState != null)
     {
         isPressed = GetJoystickAxisStateForGameplay(axis) > MyJoystickConstants.ANALOG_PRESSED_THRESHOLD;
     }
     if (!isPressed && axis == MyJoystickAxesEnum.None)
     {
         return true;
     }
     if (!IsJoystickAxisSupported(axis)) return false;
     return isPressed;
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:14,代码来源:MyDirectXInput.cs

示例15: IsJoystickAxisSupported

 public bool IsJoystickAxisSupported(MyJoystickAxesEnum axis)
 {
     if (m_joystick.IsConnected == false)
     {
         return false;
     }
     
     switch (axis)
     {
         case MyJoystickAxesEnum.RotationZpos:
         case MyJoystickAxesEnum.RotationZneg:
         case MyJoystickAxesEnum.Zneg:
         case MyJoystickAxesEnum.Slider1pos:
         case MyJoystickAxesEnum.Slider1neg:
         case MyJoystickAxesEnum.Slider2pos:
         case MyJoystickAxesEnum.Slider2neg:
         case MyJoystickAxesEnum.None:
             return false;
         default:
             return true;
     }
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:22,代码来源:MyXInputInput.cs


注:本文中的MyJoystickAxesEnum类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。