Beispiel #1
0
    public static void initKeyStates()
    {
        OuyaInputManager.OuyaKeyState keyState;
        keyStates = new List <OuyaInputManager.OuyaKeyState>();

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player1;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player2;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player3;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player4;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player5;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player6;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player7;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player8;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player9;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player10;
        keyStates.Add(keyState);

        keyState        = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player11;
        keyStates.Add(keyState);
    }
    public static void initKeyStates()
    {
        OuyaInputManager.OuyaKeyState keyState;
        keyStates = new List<OuyaInputManager.OuyaKeyState>();

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player1;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player2;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player3;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player4;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player5;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player6;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player7;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player8;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player9;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player10;
        keyStates.Add(keyState);

        keyState = new OuyaInputManager.OuyaKeyState();
        keyState.player = OuyaSDK.OuyaPlayer.player11;
        keyStates.Add(keyState);
    }
Beispiel #3
0
    public static void HandleButtonEvent(OuyaSDK.InputButtonEvent inputEvent)
    {
        OuyaInputManager.OuyaKeyState keyState = OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer());
        if (null == keyState)
        {
            return;
        }

        switch (inputEvent.getKeyAction())
        {
        case OuyaSDK.InputAction.KeyDown:
        case OuyaSDK.InputAction.KeyUp:
            switch (inputEvent.getKeyCode())
            {
            case OuyaSDK.KeyEnum.BUTTON_O:
                keyState.m_buttonO = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_U:
                keyState.m_buttonU = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_Y:
                keyState.m_buttonY = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_A:
                keyState.m_buttonA = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_LB:
                keyState.m_buttonLB = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_LT:
                keyState.m_buttonLT = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_L3:
                keyState.m_buttonL3 = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_RB:
                keyState.m_buttonRB = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_RT:
                keyState.m_buttonRT = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_R3:
                keyState.m_buttonR3 = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_SYSTEM:
                keyState.m_buttonSystem = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                keyState.m_buttonDPadDown = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                keyState.m_buttonDPadLeft = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                keyState.m_buttonDPadRight = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                keyState.m_buttonDPadUp = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                break;

            default:
                return;
            }
            OuyaButtonEvent.buttonPressEvent(inputEvent.getPlayer(), inputEvent.getKeyCode(), inputEvent.getKeyAction());
            break;
        }
    }
Beispiel #4
0
 public static OuyaInputManager.OuyaKeyState getPlayerKeyState(OuyaSDK.OuyaPlayer player)
 {
     OuyaInputManager.OuyaKeyState keyState = keyStates.Find(delegate(OuyaInputManager.OuyaKeyState key) { return(key.player.Equals(player)); });
     return(keyState);
 }