コード例 #1
0
        private static void UpdateRazerTurretKeyboard()
        {
            int playerNum = 0;

            if (null == m_buttonStates ||
                m_buttonStates.Count == 0)
            {
                return;
            }
            Dictionary <int, bool> buttonState = m_buttonStates[playerNum];

            if (null == m_buttonDownStates ||
                m_buttonDownStates.Count == 0)
            {
                return;
            }
            Dictionary <int, bool> buttonDownState = m_buttonDownStates[playerNum];

            if (null == m_buttonUpStates ||
                m_buttonUpStates.Count == 0)
            {
                return;
            }
            Dictionary <int, bool> buttonUpState = m_buttonUpStates[playerNum];

            foreach (FieldInfo fi in typeof(RazerTurretKeyboard).GetFields())
            {
                if (fi.FieldType == typeof(int))
                {
                    int keycode = (int)fi.GetValue(null);
                    buttonState[keycode]     = NdkWrapper.isPressed(playerNum, keycode);
                    buttonDownState[keycode] = NdkWrapper.isPressedDown(playerNum, keycode);
                    buttonUpState[keycode]   = NdkWrapper.isPressedUp(playerNum, keycode);
                }
            }
        }
コード例 #2
0
        public static void UpdateInputFrame()
        {
            for (int deviceId = 0; deviceId < OuyaController.MAX_CONTROLLERS; ++deviceId)
            {
                #region Track Axis States

                Dictionary <int, float> axisState = m_axisStates[deviceId];
                axisState[OuyaController.AXIS_LS_X] = NdkWrapper.getAxis(deviceId, OuyaController.AXIS_LS_X);
                axisState[OuyaController.AXIS_LS_Y] = NdkWrapper.getAxis(deviceId, OuyaController.AXIS_LS_Y);
                axisState[OuyaController.AXIS_RS_X] = NdkWrapper.getAxis(deviceId, OuyaController.AXIS_RS_X);
                axisState[OuyaController.AXIS_RS_Y] = NdkWrapper.getAxis(deviceId, OuyaController.AXIS_RS_Y);
                axisState[OuyaController.AXIS_L2]   = NdkWrapper.getAxis(deviceId, OuyaController.AXIS_L2);
                axisState[OuyaController.AXIS_R2]   = NdkWrapper.getAxis(deviceId, OuyaController.AXIS_R2);

                #endregion

                #region Track Button Up / Down States

                Dictionary <int, bool> buttonState     = m_buttonStates[deviceId];
                Dictionary <int, bool> buttonDownState = m_buttonDownStates[deviceId];
                Dictionary <int, bool> buttonUpState   = m_buttonUpStates[deviceId];

                buttonState[OuyaController.BUTTON_O]          = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_O);
                buttonState[OuyaController.BUTTON_U]          = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_U);
                buttonState[OuyaController.BUTTON_Y]          = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_Y);
                buttonState[OuyaController.BUTTON_A]          = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_A);
                buttonState[OuyaController.BUTTON_L1]         = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_L1);
                buttonState[OuyaController.BUTTON_R1]         = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_R1);
                buttonState[OuyaController.BUTTON_L3]         = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_L3);
                buttonState[OuyaController.BUTTON_R3]         = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_R3);
                buttonState[OuyaController.BUTTON_DPAD_UP]    = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_DPAD_UP);
                buttonState[OuyaController.BUTTON_DPAD_DOWN]  = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_DPAD_DOWN);
                buttonState[OuyaController.BUTTON_DPAD_RIGHT] = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_DPAD_RIGHT);
                buttonState[OuyaController.BUTTON_DPAD_LEFT]  = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_DPAD_LEFT);
                buttonState[OuyaController.BUTTON_MENU]       = NdkWrapper.isPressed(deviceId, OuyaController.BUTTON_MENU);

                buttonDownState[OuyaController.BUTTON_O]          = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_O);
                buttonDownState[OuyaController.BUTTON_U]          = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_U);
                buttonDownState[OuyaController.BUTTON_Y]          = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_Y);
                buttonDownState[OuyaController.BUTTON_A]          = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_A);
                buttonDownState[OuyaController.BUTTON_L1]         = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_L1);
                buttonDownState[OuyaController.BUTTON_R1]         = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_R1);
                buttonDownState[OuyaController.BUTTON_L3]         = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_L3);
                buttonDownState[OuyaController.BUTTON_R3]         = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_R3);
                buttonDownState[OuyaController.BUTTON_DPAD_UP]    = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_DPAD_UP);
                buttonDownState[OuyaController.BUTTON_DPAD_DOWN]  = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_DPAD_DOWN);
                buttonDownState[OuyaController.BUTTON_DPAD_RIGHT] = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_DPAD_RIGHT);
                buttonDownState[OuyaController.BUTTON_DPAD_LEFT]  = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_DPAD_LEFT);
                buttonDownState[OuyaController.BUTTON_MENU]       = NdkWrapper.isPressedDown(deviceId, OuyaController.BUTTON_MENU);

                buttonUpState[OuyaController.BUTTON_O]          = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_O);
                buttonUpState[OuyaController.BUTTON_U]          = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_U);
                buttonUpState[OuyaController.BUTTON_Y]          = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_Y);
                buttonUpState[OuyaController.BUTTON_A]          = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_A);
                buttonUpState[OuyaController.BUTTON_L1]         = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_L1);
                buttonUpState[OuyaController.BUTTON_R1]         = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_R1);
                buttonUpState[OuyaController.BUTTON_L3]         = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_L3);
                buttonUpState[OuyaController.BUTTON_R3]         = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_R3);
                buttonUpState[OuyaController.BUTTON_DPAD_UP]    = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_DPAD_UP);
                buttonUpState[OuyaController.BUTTON_DPAD_DOWN]  = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_DPAD_DOWN);
                buttonUpState[OuyaController.BUTTON_DPAD_RIGHT] = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_DPAD_RIGHT);
                buttonUpState[OuyaController.BUTTON_DPAD_LEFT]  = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_DPAD_LEFT);
                buttonUpState[OuyaController.BUTTON_MENU]       = NdkWrapper.isPressedUp(deviceId, OuyaController.BUTTON_MENU);

                #endregion

                //debugOuyaController(deviceId);
            }

            NdkWrapper.clearButtonStates();
        }
コード例 #3
0
 public static void ClearButtons()
 {
     NdkWrapper.clearButtons();
 }
コード例 #4
0
 public static void ClearAxes()
 {
     NdkWrapper.clearAxes();
 }
コード例 #5
0
 public static int GetTurretMouseInfo(int index)
 {
     return(NdkWrapper.getTurretMouseInfo(index));
 }