Exemplo n.º 1
0
    public void ProcessUserInput()
    {
        if (SdlHardware.KeyPressed(SdlHardware.KEY_ESC))
        {
            finished = true;
        }
        if (SdlHardware.KeyPressed(SdlHardware.KEY_RIGHT) ||
            SdlHardware.JoystickMovedRight())
        {
            player.MoveRight();
        }
        if (SdlHardware.KeyPressed(SdlHardware.KEY_LEFT) ||
            SdlHardware.JoystickMovedLeft())
        {
            player.MoveLeft();
        }
        if ((SdlHardware.KeyPressed(SdlHardware.KEY_SPC) ||
             SdlHardware.JoystickMovedUp() ||
             (SdlHardware.MouseClicked() && activeMouse)) &&
            (!player.GetFire().IsVisible()))
        {
            player.Shoot();
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_T))
        {
            if (SdlHardware.KeyPressed(SdlHardware.KEY_V))
            {
                ApplyCheat('V');
            }
            if (SdlHardware.KeyPressed(SdlHardware.KEY_N))
            {
                ApplyCheat('N');
            }
            if (SdlHardware.KeyPressed(SdlHardware.KEY_R))
            {
                ApplyCheat('R');
            }
            if (SdlHardware.KeyPressed(SdlHardware.KEY_P))
            {
                ApplyCheat('P');
            }
            if (SdlHardware.KeyPressed(SdlHardware.KEY_D))
            {
                ApplyCheat('D');
            }
        }

        if (activeMouse)
        {
            player.MoveTo(SdlHardware.GetMouseX(), player.GetY());
        }

        if (SdlHardware.KeyPressed(SdlHardware.KEY_O))
        {
            if (activeMouse)
            {
                activeMouse    = false;
                activeJoystick = true;
            }
            else if (activeJoystick)
            {
                activeJoystick = false;
            }
            else
            {
                activeMouse = true;
            }
        }
    }