Пример #1
0
 private bool IsButtonPressed(string button)
 {
     if (button == "+X")
     {
         return(state.GetAxisPosition(JoystickAxis.Horizontal) == 1);
     }
     else if (button == "-X")
     {
         return(state.GetAxisPosition(JoystickAxis.Horizontal) == 0);
     }
     else if (button == "+Y")
     {
         return(state.GetAxisPosition(JoystickAxis.Vertical) == 1);
     }
     else if (button == "-Y")
     {
         return(state.GetAxisPosition(JoystickAxis.Vertical) == 0);
     }
     else
     {
         int value = -1;
         if (int.TryParse(button, out value))
         {
             return(state.GetButtonState(value) == ButtonKeyState.Pressed);
         }
     }
     return(false);
 }
Пример #2
0
 private void JoystickAxisChanged(object sender, JoystickAxisEventArgs e)
 {
     if (e.AxisIndex == 0)
     {
         position.X = (int)(joystick.GetAxisPosition(JoystickAxis.Horizontal) * width);
     }
     else if (e.AxisIndex == 1)
     {
         position.Y = (int)(joystick.GetAxisPosition(JoystickAxis.Vertical) * height);
     }
 }
Пример #3
0
        /// <summary>
        /// Handle if the joystick axis is moved
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="axis"></param>
        public void OnJoystickAxisMoved(object sender, JoystickMoveEventArgs axis)
        {
            switch (axis.Axis)
            {
            case (Joystick.Axis)Controller.Controller.XboxOneDirection.DPadXDir:
                float dx = 0, dy = 0;
                if (Joystick.GetAxisPosition(0, axis.Axis) > 0)
                {
                    SetDirection(Direction.Right);
                    dx = LinearVelocity * Friction * GameMaster.Delta.AsSeconds();
                    Play();
                }
                else if (Joystick.GetAxisPosition(0, axis.Axis) < 0)
                {
                    SetDirection(Direction.Left);
                    dx = -1 * LinearVelocity * Friction * GameMaster.Delta.AsSeconds();
                    Play();
                }
                Move(dx, dy);
                break;

            case (Joystick.Axis)Controller.Controller.XboxOneDirection.Triggers:
                break;
            }
        }
Пример #4
0
 public void JoystickTurn()
 {
     a    += Math.Round(Joystick.GetAxisPosition(0, Joystick.Axis.U), 4) * 0.0005F;
     a     = a % (Math.PI * 2);
     sin_a = (float)Math.Sin(a);
     cos_a = (float)Math.Cos(a);
 }
Пример #5
0
        /// <summary>
        /// Checks the Position of the left joystick.
        /// </summary>
        /// <returns> returns the Position of the left joystick. </returns>
        public Vector2f LeftJoystickPos()
        {
            float x = Joystick.GetAxisPosition(joystickPos, Joystick.Axis.X);
            float y = Joystick.GetAxisPosition(joystickPos, Joystick.Axis.Y);

            return(new Vector2f(x, y));
        }
Пример #6
0
        private static void UpdateJoystickLStickState(ImGuiIOPtr io)
        {
            float lStickXPos = Joystick.GetAxisPosition(s_joystickId, s_lStickInfo.xAxis);

            if (s_lStickInfo.xInverted)
            {
                lStickXPos = -lStickXPos;
            }

            float lStickYPos = Joystick.GetAxisPosition(s_joystickId, s_lStickInfo.yAxis);

            if (s_lStickInfo.yInverted)
            {
                lStickYPos = -lStickYPos;
            }

            if (lStickXPos < -s_lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickLeft] = Math.Abs(lStickXPos / 100);
            }
            if (lStickXPos > s_lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickRight] = lStickXPos / 100;
            }
            if (lStickYPos < -s_lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickLeft] = Math.Abs(lStickYPos / 100);
            }
            if (lStickYPos > s_lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickRight] = lStickYPos / 100;
            }
        }
Пример #7
0
        /// <summary>
        /// Checks the Position of the right joystick.
        /// </summary>
        /// <returns> returns the Position of the right joystick. </returns>
        public Vector2f RightJoystickPos()
        {
            float x = Joystick.GetAxisPosition(joystickPos, Joystick.Axis.U);
            float y = Joystick.GetAxisPosition(joystickPos, Joystick.Axis.R);

            return(new Vector2f(x, y));
        }
Пример #8
0
        public static void Update()
        {
            int bla = (int)Joystick.ButtonCount;

            Joystick.Update();
            JoystickPosition[0] = -new Vector2f(Joystick.GetAxisPosition(0, Joystick.Axis.X), Joystick.GetAxisPosition(0, Joystick.Axis.Y));
            JoystickPosition[1] = -new Vector2f(Joystick.GetAxisPosition(1, Joystick.Axis.X), Joystick.GetAxisPosition(1, Joystick.Axis.Y));
            JoystickPosition[2] = -new Vector2f(Joystick.GetAxisPosition(2, Joystick.Axis.X), Joystick.GetAxisPosition(2, Joystick.Axis.Y));
            JoystickPosition[3] = -new Vector2f(Joystick.GetAxisPosition(3, Joystick.Axis.X), Joystick.GetAxisPosition(3, Joystick.Axis.Y));

            Vector2i mp = Mouse.GetPosition(Game.Window);

            MousePosition = new Vector2f((float)mp.X, (float)mp.Y);

            for (int i = 0; i < (int)Keyboard.Key.KeyCount; i++)
            {
                isKeyTriggered[i] = false;
                isKeyPressed[i]   = false;
                isKeyReleased[i]  = false;

                if (isKeyDown[i])
                {
                    if (!Keyboard.IsKeyPressed((Keyboard.Key)i))
                    {
                        Release((Keyboard.Key)i);
                    }
                }
            }
            for (int i = 0; i < (int)Mouse.Button.ButtonCount; i++)
            {
                isButtonPressed[i]  = false;
                isButtonReleased[i] = false;

                if (isButtonDown[i])
                {
                    if (!Mouse.IsButtonPressed((Mouse.Button)i))
                    {
                        Release((Mouse.Button)i);
                    }
                }
            }
            for (int u = 0; u < 4; u++)
            {
                for (int i = 0; i < (int)Joystick.ButtonCount; i++)
                {
                    isJoyButtonPressed[i][u]  = false;
                    isJoyButtonReleased[i][u] = false;

                    if (isJoyButtonDown[i][u])
                    {
                        if (!Joystick.IsButtonPressed((uint)u, (uint)i))
                        {
                            Release((uint)u, (uint)i);
                        }
                    }
                }
            }
        }
Пример #9
0
        private bool isMovingByJoystick()
        {
            float Yaxis = MathF.Round(Joystick.GetAxisPosition(0, Joystick.Axis.X) / 100F, 4);
            float Xaxis = -MathF.Round(Joystick.GetAxisPosition(0, Joystick.Axis.Y) / 100F, 4);

            if (Yaxis == 0 && Xaxis == 0)
            {
                return(false);
            }
            return(true);
        }
Пример #10
0
 /// <summary>
 /// Get the value of a joystick axis from -100 to 100.
 /// </summary>
 /// <param name="axis">The axis to check.</param>
 /// <param name="joystick">The joystick to check.</param>
 /// <returns>The axis value from -100 to 100.</returns>
 public float GetAxis(JoyAxis axis, int joystick = 0)
 {
     if (Joystick.HasAxis((uint)joystick, (Joystick.Axis)axis))
     {
         if (axis == JoyAxis.PovY)
         { //special case for dpad y
             return(Joystick.GetAxisPosition((uint)joystick, (Joystick.Axis)axis) * -1);
         }
         return(Joystick.GetAxisPosition((uint)joystick, (Joystick.Axis)axis));
     }
     return(0);
 }
Пример #11
0
        public float GetValue(Controller controller)
        {
            float position = Joystick.GetAxisPosition(controller.id, (Joystick.Axis)axisId);

            // Apply deadzoning.
            if (System.Math.Abs(position) < deadZone)
            {
                position = 0;
            }

            return(position * (inverted ? -1 : 1));
        }
Пример #12
0
        public bool IsDown(Controller controller)
        {
            float position = Joystick.GetAxisPosition(controller.id, (Joystick.Axis)axisId);

            switch (type)
            {
            case Type.ActiveAbove:
                return(position > deadZone);

            case Type.ActiveBelow:
                return(position < deadZone);

            default:
                throw new Exception();
            }
        }
Пример #13
0
        internal void Update()
        {
            foreach (var input in _inputs)
            {
                _pressed[input] = false;
            }

            foreach (var input in _inputs)
            {
                _released[input] = false;
            }

            DPad.Update(Joystick.GetAxisPosition(_id, Joystick.Axis.PovY), -Joystick.GetAxisPosition(_id, Joystick.Axis.PovX), DeadZone, 1);
            LeftStick.Update(Joystick.GetAxisPosition(_id, Joystick.Axis.X), Joystick.GetAxisPosition(_id, Joystick.Axis.Y), DeadZone);
            RightStick.Update(Joystick.GetAxisPosition(_id, Joystick.Axis.U), Joystick.GetAxisPosition(_id, Joystick.Axis.R), DeadZone);
        }
Пример #14
0
        public JoystickInput()
        {
            Joystick.Update();
            for (uint i = 0; i < 10; i++)
            {
                if (Joystick.GetAxisPosition(i, Joystick.Axis.U) != 0)
                {
                    connectedJoystick = i;
                    break;
                }
            }
            oldButton     = new bool[(int)JoystickButton.BUTTONNUM];
            currentButton = new bool[(int)JoystickButton.BUTTONNUM];

            leftStick = new Vec2f();
        }
Пример #15
0
        public static void Update()
        {
            if (!isInitialized)
            {
                Initialize();
            }

            Joystick.Update();

            for (uint index = 0; index < numSupportedPads; index++)
            {
                if (!Joystick.IsConnected(index))
                {
                    if (padInputs.ContainsKey(index))
                    {
                        UnregisterPad(index);
                    }
                }
                else
                {
                    if (!padInputs.ContainsKey(index))
                    {
                        RegisterPad(index);
                    }

                    Input input = padInputs[index];

                    for (uint i = 0; i < (uint)GamePadButton.BUTTONNUM; i++)
                    {
                        input.oldButton[i]     = input.currentButton[i];
                        input.currentButton[i] = Joystick.IsButtonPressed(index, i);
                    }

                    input.rightStick = 0.01F * new Vector2(Joystick.GetAxisPosition(index, Joystick.Axis.U), -Joystick.GetAxisPosition(index, Joystick.Axis.R));
                    input.rightStick = AdjustDeadZone(input.rightStick);

                    input.leftStick = 0.01F * new Vector2(Joystick.GetAxisPosition(index, Joystick.Axis.X), -Joystick.GetAxisPosition(index, Joystick.Axis.Y));
                    input.leftStick = AdjustDeadZone(input.leftStick);

                    input.LTRT = Joystick.GetAxisPosition(index, Joystick.Axis.Z);

                    padInputs[index] = input;
                }
            }
        }
Пример #16
0
        public void update()
        {
            Joystick.Update();
            for (int i = 0; i < (int)JoystickButton.BUTTONNUM; i++)
            {
                oldButton[i] = currentButton[i];
            }


            for (int i = 0; i < (int)JoystickButton.BUTTONNUM; i++)
            {
                currentButton[i] = Joystick.IsButtonPressed(connectedJoystick, (uint)i);
            }

            rightStick = new Vec2f(Joystick.GetAxisPosition(connectedJoystick, Joystick.Axis.U), -Joystick.GetAxisPosition(connectedJoystick, Joystick.Axis.R));
            leftStick  = new Vec2f(Joystick.GetAxisPosition(connectedJoystick, Joystick.Axis.X), -Joystick.GetAxisPosition(connectedJoystick, Joystick.Axis.Y));
            LTRT       = Joystick.GetAxisPosition(connectedJoystick, Joystick.Axis.Z);
        }
Пример #17
0
        public static Vector2f GetMoveAxis()
        {
            if (selectedController != 1000)
            {
                float xAxis = (float)Math.Round(Joystick.GetAxisPosition(selectedController, Joystick.Axis.X), 2);
                float yAxis = (float)Math.Round(Joystick.GetAxisPosition(selectedController, Joystick.Axis.Y), 2);

                Vector2f movePos = new Vector2f(xAxis, yAxis);

                if (controllerId == (uint)ControllerType.GameCube)
                {
                    movePos = movePos * 100 / 70;
                    movePos = new Vector2f(Math.Min(100, Math.Max(-100, movePos.X)), Math.Min(100, Math.Max(-100, movePos.Y)));
                }

                return(movePos);
            }

            return(new Vector2f());
        }
Пример #18
0
        private static void UpdateJoystickDPadState(ImGuiIOPtr io)
        {
            float dpadXPos = Joystick.GetAxisPosition(s_joystickId, s_dPadInfo.xAxis);

            if (s_dPadInfo.xInverted)
            {
                dpadXPos = -dpadXPos;
            }

            float dpadYPos = Joystick.GetAxisPosition(s_joystickId, s_dPadInfo.yAxis);

            if (s_dPadInfo.yInverted)
            {
                dpadYPos = -dpadYPos;
            }

            io.NavInputs[(int)ImGuiNavInput.DpadLeft]  = dpadXPos < -s_dPadInfo.threshold ? 1 : 0;
            io.NavInputs[(int)ImGuiNavInput.DpadRight] = dpadXPos > s_dPadInfo.threshold ? 1 : 0;
            io.NavInputs[(int)ImGuiNavInput.DpadUp]    = dpadYPos < -s_dPadInfo.threshold ? 1 : 0;
            io.NavInputs[(int)ImGuiNavInput.DpadDown]  = dpadYPos > s_dPadInfo.threshold ? 1 : 0;
        }
Пример #19
0
        private static void UpdateJoystickDPadState(ImGuiIOPtr io)
        {
            var dpadXPos = Joystick.GetAxisPosition(JoystickId, _dPadInfo.xAxis);

            if (_dPadInfo.xInverted)
            {
                dpadXPos = -dpadXPos;
            }

            var dpadYPos = Joystick.GetAxisPosition(JoystickId, _dPadInfo.yAxis);

            if (_dPadInfo.yInverted)
            {
                dpadYPos = -dpadYPos;
            }

            io.NavInputs[(int)ImGuiNavInput.DpadLeft]  = dpadXPos < -_dPadInfo.threshold ? 1f : 0f;
            io.NavInputs[(int)ImGuiNavInput.DpadRight] = dpadXPos > _dPadInfo.threshold ? 1f : 0f;

            io.NavInputs[(int)ImGuiNavInput.DpadUp]   = dpadYPos < -_dPadInfo.threshold ? 1f : 0f;
            io.NavInputs[(int)ImGuiNavInput.DpadDown] = dpadYPos > _dPadInfo.threshold ? 1f : 0f;
        }
Пример #20
0
        public void JoystickWalk(double frame_time)
        {
            float Yaxis = MathF.Round(Joystick.GetAxisPosition(0, Joystick.Axis.X) / 100F, 4);
            float Xaxis = -MathF.Round(Joystick.GetAxisPosition(0, Joystick.Axis.Y) / 100F, 4);

            var length      = MathF.Sqrt(Xaxis * Xaxis + Yaxis * Yaxis);
            var speedlength = MathF.Sqrt(Xaxis * Xaxis + Yaxis * Yaxis) > 1 ? 1 : MathF.Sqrt(Xaxis * Xaxis + Yaxis * Yaxis);

            if (Program.steps.Status != SoundStatus.Playing && speedlength > 0)
            {
                Program.steps.Play();
            }
            float d = Xaxis == 0 && Yaxis == 0 ? 0 : (float)(speedlength * PlayerSpeed * frame_time);

            float angle = MathF.Acos(Xaxis / length) * (Yaxis >= 0 ? 1 : -1);

            float lsin = MathF.Sin((float)a + angle), lcos = MathF.Cos((float)a + angle);

            if (!Map.isWall((int)(x + (d + 0.05F) * lcos), (int)y))
            {
                x = x + d * lcos;
            }
            if (!Map.isWall((int)x, (int)(y + (d + 0.05F) * lsin)))
            {
                y = y + d * lsin;
            }


            PlayerSpeed = Settings.BasePlayerSpeed;
            if (new System.Drawing.Point((int)x, (int)y) == mapActivator)
            {
                Map.isVisible = true;
            }
            if ((int)x == Map.Out.x && (int)y == Map.Out.y)
            {
                Program.menu.isWin = true; Program.menu.OnOpen();
            }
        }
Пример #21
0
        public static Vector2f GetShootAxis()
        {
            if (selectedController != 1000)
            {
                float xAxis;
                float yAxis;

                if (controllerId == (uint)ControllerType.GameCube)
                {
                    xAxis = (float)Math.Round(Joystick.GetAxisPosition(selectedController, Joystick.Axis.V), 2);
                    yAxis = (float)Math.Round(Joystick.GetAxisPosition(selectedController, Joystick.Axis.U), 2);
                }
                else
                {
                    xAxis = (float)Math.Round(Joystick.GetAxisPosition(selectedController, Joystick.Axis.U), 2);
                    yAxis = (float)Math.Round(Joystick.GetAxisPosition(selectedController, Joystick.Axis.R), 2);
                }

                return(new Vector2f(xAxis, yAxis));
            }

            return(new Vector2f());
        }
Пример #22
0
        private static void UpdateJoystickLStickState(ImGuiIOPtr io)
        {
            var lStickXPos = Joystick.GetAxisPosition(JoystickId, _lStickInfo.xAxis);

            if (_lStickInfo.xInverted)
            {
                lStickXPos = -lStickXPos;
            }

            var lStickYPos = Joystick.GetAxisPosition(JoystickId, _lStickInfo.yAxis);

            if (_lStickInfo.yInverted)
            {
                lStickYPos = -lStickYPos;
            }

            if (lStickXPos < -_lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickLeft] = MathF.Abs(lStickXPos / 100f);
            }

            if (lStickXPos > _lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickRight] = lStickXPos / 100f;
            }

            if (lStickYPos < -_lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickUp] = MathF.Abs(lStickYPos / 100f);
            }

            if (lStickYPos > _lStickInfo.threshold)
            {
                io.NavInputs[(int)ImGuiNavInput.LStickDown] = lStickYPos / 100f;
            }
        }
Пример #23
0
        internal void Events2()
        {
            //Graphics
            if (_context.GetGame.GetPlayer.IsAttack)
            {
                _context.GetGame.GetPlayer.Attack();
            }

            if (_context.GetGame.GetPlayer.HurtPlayer)
            {
                foreach (Monster monster in _context.GetGame.GetMonsters)
                {
                    monster.GetAttack.HurtPlayerAnimation();
                }
            }

            // Manette
            Joystick.Update();
            if (Joystick.IsConnected(0)) //Controller connected
            {
                // Actions
                for (uint i = 0; i < Joystick.GetButtonCount(0); i++) //Test tous les btn
                {
                    if (Joystick.IsButtonPressed(0, i))
                    {
                        switch (i)
                        {
                        case 0:     //A - Jump
                            if (_context.GetGame.GetPlayer.RealPosition.Y < _context.GetGame.GetMapObject.GetLimitMax.Y && _context.GetGame.GetPlayer.IsOnTheGround)
                            {
                                _context.GetGame.GetPlayer.Jump();
                            }
                            break;

                        case 1:     //B - Attack
                            _context.GetGame.GetPlayer.IsAttack = true;
                            _context.GetGame.GetPlayer.Attack();
                            break;
                        }
                    }
                }
                // Moves
                if (Joystick.GetAxisPosition(0, Joystick.Axis.X) >= 80) // Droite
                {
                    _moveTheMapOf += _context.GetGame.GetPlayer.MoveRight((float)_window.Size.X);
                }
                else if (Joystick.GetAxisPosition(0, Joystick.Axis.X) <= -80) // Gauche
                {
                    _moveTheMapOf -= _context.GetGame.GetPlayer.MoveLeft((float)_window.Size.X);
                }
                else if (_context.GetGame.GetPlayer.IsOnTheGround && !_context.GetGame.GetPlayer.IsAttack)
                {
                    _context.GetGame.GetPlayer.GetPlayerSprite.DefaultAnimation();
                }
            }
            else
            {
                if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
                {
                    //_context.GetGame.GetPlayer.GetLife.CurrentPoint = 0; // TEMPORARYYYYYYYYYYYYYYYYYY
                }
                else if (Keyboard.IsKeyPressed(_RightAction))
                {
                    _moveTheMapOf += _context.GetGame.GetPlayer.MoveRight((float)_window.Size.X);
                }
                else if (Keyboard.IsKeyPressed(_LeftAction))
                {
                    _moveTheMapOf -= _context.GetGame.GetPlayer.MoveLeft((float)_window.Size.X);
                }

                if (Keyboard.IsKeyPressed(_JumpAction))
                {
                    if (_context.GetGame.GetPlayer.RealPosition.Y < _context.GetGame.GetMapObject.GetLimitMax.Y && _context.GetGame.GetPlayer.IsOnTheGround)
                    {
                        _context.GetGame.GetPlayer.Jump();
                    }
                }

                if (Keyboard.IsKeyPressed(_AttackAction)) // ATTACK
                {
                    _context.GetGame.GetPlayer.IsAttack = true;
                    _context.GetGame.GetPlayer.Attack();
                }

                if (!Keyboard.IsKeyPressed(_LeftAction) && !Keyboard.IsKeyPressed(_RightAction) && !Keyboard.IsKeyPressed(_JumpAction) && !_context.GetGame.GetPlayer.IsAttack && !_context.GetGame.GetPlayer.HurtPlayer)
                {
                    _context.GetGame.GetPlayer.GetPlayerSprite.DefaultAnimation();
                }
            }
            // ------------------------------PLAYER 2
            //Graphics
            if (_context2.GetGame2.GetPlayer2.IsAttack2)
            {
                _context2.GetGame2.GetPlayer2.Attack2();
            }

            if (_context2.GetGame2.GetPlayer2.HurtPlayer2)
            {
                foreach (Monster monster in _context2.GetGame2.GetMonsters2)
                {
                    monster.GetAttack2.HurtPlayerAnimation2();
                }
            }
            else
            {
                if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
                {
                    //_context.GetGame.GetPlayer.GetLife.CurrentPoint = 0; // TEMPORARYYYYYYYYYYYYYYYYYY
                }
                else if (Keyboard.IsKeyPressed(_RightAction2))
                {
                    _moveTheMapOf2 += _context2.GetGame2.GetPlayer2.MoveRight2((float)_window.Size.X);
                }
                else if (Keyboard.IsKeyPressed(_LeftAction2))
                {
                    _moveTheMapOf2 -= _context2.GetGame2.GetPlayer2.MoveLeft2((float)_window.Size.X);
                }

                if (Keyboard.IsKeyPressed(_JumpAction2))
                {
                    if (_context2.GetGame2.GetPlayer2.RealPosition2.Y2 < _context2.GetGame2.GetMapObject2.GetLimitMax2.Y2 && _context2.GetGame2.GetPlayer2.IsOnTheGround2)
                    {
                        _context2.GetGame2.GetPlayer2.Jump2();
                    }
                }

                if (Keyboard.IsKeyPressed(_AttackAction2)) // ATTACK
                {
                    _context2.GetGame2.GetPlayer2.IsAttack2 = true;
                    _context2.GetGame2.GetPlayer2.Attack2();
                }

                if (!Keyboard.IsKeyPressed(_LeftAction2) && !Keyboard.IsKeyPressed(_RightAction2) && !Keyboard.IsKeyPressed(_JumpAction2) && !_context2.GetGame2.GetPlayer2.IsAttack2 && !_context2.GetGame2.GetPlayer2.HurtPlayer2)
                {
                    _context2.GetGame2.GetPlayer2.GetPlayerSprite2.DefaultAnimation2();
                }
            }
        }
Пример #24
0
 private float axisDirection(Joystick.Axis axis)
 {
     return(Joystick.GetAxisPosition(0, axis));
 }
Пример #25
0
        public void Update(string key = null)
        {
            Joystick.Update();
            float povX = Joystick.GetAxisPosition(0, Joystick.Axis.PovX);

            Console.WriteLine(povX);

            /*for (uint i=10; i<32; i++)
             * {
             * if (Joystick.GetAxisPosition(i, Joystick.Axis.PovX)>0) ;
             *  Console.WriteLine($"{i}  :  {Joystick.GetAxisPosition(i, Joystick.Axis.X)}");
             *  Thread.Sleep(1000);
             * }*/
            /*   _game._window.JoystickMoved += (sender, e) =>
             * {
             *
             *     // PLAYER 1
             *     /* Console.WriteLine(e.Axis);
             *      Console.WriteLine(e.JoystickId);
             *      Console.WriteLine(e.Position);
             *     if (e.Axis == Joystick.Axis.PovX)
             *     {
             *         if (e.Position < 0)
             *         {
             *             _game._fighter2.MoveRight(e.Position / 10000);
             *             _game._fighter2._isMoving = true;
             *            // Console.WriteLine($"id : {e.JoystickId}");
             *         } else
             *         {
             *             _game._fighter2._isMoving = false;
             *
             *         }
             *
             *     }
             * };*/
            /*  if (Keyboard.IsKeyPressed(Keyboard.Key.Q)) Client.SendKey("Q");
             * if (Keyboard.IsKeyPressed(Keyboard.Key.Z)) Client.SendKey("Z");
             * if (Keyboard.IsKeyPressed(Keyboard.Key.S)) Client.SendKey("S");
             * if (Keyboard.IsKeyPressed(Keyboard.Key.D)) Client.SendKey("D");
             * if (Keyboard.IsKeyPressed(Keyboard.Key.A)) Client.SendKey("A");
             * if (Keyboard.IsKeyPressed(Keyboard.Key.E)) Client.SendKey("E"); */

            // PROJECTILE
            if (_game._fighter1._projectile.isThrown == true)
            {
                _game._fighter1._projectile.Position += new Vector2f(_game._fighter1._projectile.Path.X * _game._fighter1.Scale, _game._fighter1._projectile.Path.Y * _game._fighter1.Scale);
            }

            if (_game._fighter2._projectile.isThrown == true)
            {
                if (_game._fighter2._projectile.Sprite.Scale.X > 0)
                {
                    _game._fighter2._projectile.Sprite.Scale = new Vector2f(_game._fighter2._projectile.Sprite.Scale.X * -1, _game._fighter2._projectile.Sprite.Scale.Y);
                }
                _game._fighter2._projectile.Position += new Vector2f(_game._fighter2._projectile.Path.X * _game._fighter2.Scale, _game._fighter2._projectile.Path.Y * _game._fighter2.Scale);
            }

            // ADAPTE LA TAILLE DU PERSONNAGE A LA CARTE
            if (_game._fighter1.Height != _game._stage._groundHeight && _game._fighter1._isJumping == false)
            {
                _game._fighter1._sprite.Position = new Vector2f(_game._fighter1._sprite.Position.X, _game._stage._groundHeight - _game._fighter1._sprite.TextureRect.Height * _game._fighter1._sprite.Scale.Y);
            }

            if (_game._fighter2.Height != _game._stage._groundHeight && _game._fighter2._isJumping == false)
            {
                _game._fighter2._sprite.Position = new Vector2f(_game._fighter2._sprite.Position.X, _game._stage._groundHeight - _game._fighter2._sprite.TextureRect.Height * _game._fighter2._sprite.Scale.Y);
            }

            // SHADOW
            _game._fighter1._shadow.Position = new Vector2f(0, _game._stage._groundHeight - _game._fighter1._shadow.TextureRect.Height * _game._fighter1._shadow.Scale.Y);

            // A CHARACTER TURN AROUND WHEN ANOTHER CHARACTER IS BEHIND HIM
            // LEFT TO THE RIGHT
            if (_game._fighter1.Position.X < _game._fighter2._sprite.Position.X + ((_game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X) / 2))
            {
                // PLAYER 1
                // if (key=="Q") _game._fighter1.MoveLeft(_game._moveSpeed);

                if (Keyboard.IsKeyPressed(Keyboard.Key.Q))
                {
                    _game._fighter1.MoveLeft(_game._moveSpeed);
                }
                // PLAYER 2
                if (Joystick.GetAxisPosition(0, Joystick.Axis.PovX) > 0)
                {
                    _game._fighter2.MoveRight(_game._moveSpeed);
                }

                // TAKE DAMAGE ==========================
                // PUNCHES
                if (_game._fighter1.Hitbox > _game._fighter2.Position.X + _game._fighter2.Width)
                {
                    if (_game._fighter2.TakeDammage(10, "low") == true)
                    {
                        _game._fighter1.GainEnergy(25);
                    }
                }
                if (_game._fighter2.Hitbox < _game._fighter1.Position.X + _game._fighter1.Width && _game._fighter2.Hitbox != 0)
                {
                    if (_game._fighter1.TakeDammage(10, "low") == true)
                    {
                        _game._fighter2.GainEnergy(25);
                    }
                }

                // PROJECTILES
                if (_game._fighter1._projectile.isThrown == true)
                {
                    if (_game._fighter1._projectile.Position.X + _game._fighter1._projectile.Width > _game._fighter2._sprite.Position.X + _game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X)
                    {
                        _game._fighter1._projectile.isThrown = false;
                        if (_game._fighter2.TakeDammage(45, "low") == true)
                        {
                            _game._fighter1.GainEnergy(0);
                        }
                    }
                }

                if (_game._fighter2._projectile.isThrown == true)
                {
                    if (_game._fighter2._projectile.Position.X - _game._fighter2._projectile.Width < _game._fighter1._sprite.Position.X + _game._fighter1._sprite.TextureRect.Width * _game._fighter1._sprite.Scale.X)
                    {
                        _game._fighter2._projectile.isThrown = false;
                        if (_game._fighter1.TakeDammage(45, "low") == true)
                        {
                            _game._fighter2.GainEnergy(0);
                        }
                    }
                }
                // ======================================

                // LIGHT PUNCH
                if (Keyboard.IsKeyPressed(Keyboard.Key.A))
                {
                    _game._fighter1.LightPunch();
                }
                if (Joystick.IsButtonPressed(0, 2))
                {
                    _game._fighter2.LightPunch();
                }

                // LIGHT KICK
                if (Keyboard.IsKeyPressed(Keyboard.Key.E))
                {
                    _game._fighter1.LightKick();
                    if (_game._fighter1._hitbox.Position.X + _game._fighter1._hitbox.Size.X * _game._fighter1._hitbox.Scale.X > _game._fighter2._sprite.Position.X + _game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X)
                    {
                        if (_game._fighter2.TakeDammage(15, "low") == true)
                        {
                            _game._fighter1.GainEnergy(25);
                        }
                    }
                }

                if (Joystick.IsButtonPressed(0, 1))
                {
                    _game._fighter2.LightKick();
                    if (_game._fighter2._hitbox.Position.X - _game._fighter2._hitbox.Size.X * _game._fighter2._hitbox.Scale.X < _game._fighter1._sprite.Position.X + _game._fighter1._sprite.TextureRect.Width * _game._fighter1._sprite.Scale.X)
                    {
                        if (_game._fighter1.TakeDammage(15, "low") == true)
                        {
                            _game._fighter2.GainEnergy(25);
                        }
                    }
                }

                // Special
                if (Keyboard.IsKeyPressed(Keyboard.Key.Space) && _game._fighter1.Energy == 100)
                {
                    _game._fighter1.SpecialMove();
                }

                if (Joystick.IsButtonPressed(0, 3) && _game._fighter2.Energy == 100)
                {
                    _game._fighter2.SpecialMove();
                }


                // IF THE PLAYERS ARE STUCK TO EACHOTHER
                if (_game._fighter1._sprite.Position.X + _game._fighter1._sprite.TextureRect.Width * _game._fighter1._sprite.Scale.X < _game._fighter2._sprite.Position.X + _game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X /* || _game._fighter1._sprite.Position.Y != _game._fighter2._sprite.Position.Y*/)
                {
                    // PLAYER 1
                    if (Keyboard.IsKeyPressed(Keyboard.Key.D))
                    {
                        _game._fighter1.MoveRight(_game._moveSpeed);
                    }
                    // PLAYER 2
                    if (Joystick.GetAxisPosition(0, Joystick.Axis.PovX) < 0)
                    {
                        _game._fighter2.MoveLeft(_game._moveSpeed);
                    }
                }

                // TURNING THE PLAYERS
                if (_game._fighter1._sprite.Scale.X < 0)
                {
                    _game._fighter1._sprite.Scale    = new Vector2f((_game._fighter1._sprite.Scale.X * -1), _game._fighter1._sprite.Scale.Y);
                    _game._fighter1._sprite.Position = new Vector2f(_game._fighter1._sprite.Position.X - _game._fighter1._sprite.TextureRect.Width * _game._fighter1._sprite.Scale.X, _game._fighter1._sprite.Position.Y);

                    _game._fighter2._sprite.Scale    = new Vector2f((_game._fighter2._sprite.Scale.X * -1), _game._fighter2._sprite.Scale.Y);
                    _game._fighter2._sprite.Position = new Vector2f(_game._fighter2._sprite.Position.X + _game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X * -1, _game._fighter2._sprite.Position.Y);
                }
            }

            // RIGHT TO THE LEFT
            if (_game._fighter1.Position.X >= _game._fighter2._sprite.Position.X + ((_game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X) / 2))
            {
                // PLAYER 1
                if (Keyboard.IsKeyPressed(Keyboard.Key.D))
                {
                    _game._fighter1.MoveRight(_game._moveSpeed);
                }
                // PLAYER 2
                if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad3))
                {
                    _game._fighter2.MoveLeft(_game._moveSpeed);
                }
                if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad1))
                {
                    _game._fighter2.MoveRight(_game._moveSpeed);
                }

                // LIGHT PUNCH
                if (Keyboard.IsKeyPressed(Keyboard.Key.A))
                {
                    _game._fighter1.LightPunch();
                }

                // Special
                if (Keyboard.IsKeyPressed(Keyboard.Key.Space) && _game._fighter1.Energy == 100)
                {
                    _game._fighter1.SpecialMove();
                }

                // TAKE DAMAGE ==========================
                // PUNCHES
                if (_game._fighter1.Hitbox < _game._fighter2.Position.X + _game._fighter2.Width)
                {
                    if (_game._fighter2.TakeDammage(10, "low") == true)
                    {
                        _game._fighter1.GainEnergy(25);
                    }
                }

                // PROJECTILES
                if (_game._fighter1._projectile.isThrown == true)
                {
                    if (_game._fighter1._projectile.Position.X + _game._fighter1._projectile.Width < _game._fighter2._sprite.Position.X + _game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X)
                    {
                        _game._fighter1._projectile.isThrown = false;
                        if (_game._fighter2.TakeDammage(20, "low") == true)
                        {
                            _game._fighter1.GainEnergy(0);
                        }
                    }
                }
                // ======================================

                // IF THE PLAYERS ARE STUCK TO EACHOTHER
                if (_game._fighter1._sprite.Position.X + _game._fighter1._sprite.TextureRect.Width * _game._fighter1._sprite.Scale.X >= _game._fighter2._sprite.Position.X + _game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X || _game._fighter1._sprite.Position.Y != _game._fighter2._sprite.Position.Y)
                {
                    // PLAYER 1
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Q))
                    {
                        _game._fighter1.MoveLeft(_game._moveSpeed);
                    }
                }

                // TURNING THE PLAYERS
                if (_game._fighter1._sprite.Scale.X > 0)
                {
                    _game._fighter1._sprite.Scale    = new Vector2f((_game._fighter1._sprite.Scale.X * -1), _game._fighter1._sprite.Scale.Y);
                    _game._fighter1._sprite.Position = new Vector2f(_game._fighter1._sprite.Position.X + _game._fighter2._sprite.TextureRect.Width * _game._fighter1._sprite.Scale.X * -1, _game._fighter1._sprite.Position.Y);

                    _game._fighter2._sprite.Scale    = new Vector2f((_game._fighter2._sprite.Scale.X * -1), _game._fighter2._sprite.Scale.Y);
                    _game._fighter2._sprite.Position = new Vector2f(_game._fighter2._sprite.Position.X - _game._fighter2._sprite.TextureRect.Width * _game._fighter2._sprite.Scale.X, _game._fighter2._sprite.Position.Y);
                }
            }


            // PLAYER 1 CONTROLER
            if (Keyboard.IsKeyPressed(Keyboard.Key.S) && !Keyboard.IsKeyPressed(Keyboard.Key.D) && !Keyboard.IsKeyPressed(Keyboard.Key.Q))
            {
                _game._fighter1.Crouch();
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.Z))
            {
                _game._fighter1.Jump();
            }

            //    if (Joystick.GetAxisPosition(0, Joystick.Axis.PovY) < 0 && Joystick.GetAxisPosition(0, Joystick.Axis.PovX) == 0) _game._fighter2.Crouch();
            if (Joystick.GetAxisPosition(0, Joystick.Axis.PovY) > 50)
            {
                _game._fighter2.Jump();
            }



            _game._fighter1.Update();
            _game._fighter2.Update();


            _game._window.KeyReleased += (sender, e) =>
            {
                // PLAYER 1
                if (e.Code == Keyboard.Key.D)
                {
                    _game._fighter1._isMoving = false;
                }
                if (e.Code == Keyboard.Key.Q)
                {
                    _game._fighter1._isMoving = false;
                }
                if (e.Code == Keyboard.Key.S)
                {
                    _game._fighter1._isCrouching = false;
                }
            };

            _game._window.JoystickMoved += (sender, e) =>
            {
                // PLAYER 1
                if (e.Axis == Joystick.Axis.PovX)
                {
                    _game._fighter2._isMoving = false;
                }
                if (e.Axis == Joystick.Axis.Y && e.Position == 0)
                {
                    _game._fighter2._isCrouching = false;
                }
            };
            //    if (Joystick.GetAxisPosition(0,Joystick.Axis.PovY)==0) _game._fighter2._isCrouching = true;


            /*
             * _game._window.KeyPressed += (sender, e) =>
             * {
             *  if (e.Code == Keyboard.Key.P) _game._fighter1.TakeDammage(100, "low");
             * };*/
            //====================================================================================
            //====================================================================================
            // *** Just for test : Must be deleted in the futur ***
            // *** Key 'P' for test damages on the player's health bar, and O for reset. ***
            // *** The same for the player 2 with the key M and L. ***
            //  if ( Keyboard.IsKeyPressed(Keyboard.Key.P) ) _game._fighter1.TakeDammage(1, "low");
            if (Keyboard.IsKeyPressed(Keyboard.Key.O))
            {
                _game._fighter1._health = 100;
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.I))
            {
                _game._fighter1.GainEnergy(1);
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.P))
            {
                _game._fighter1.TakeDammage(1, "low");
            }


            if (Keyboard.IsKeyPressed(Keyboard.Key.M))
            {
                _game._fighter2.TakeDammage(1, "low");
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.L))
            {
                _game._fighter2._health = 100;
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.K))
            {
                _game._fighter2.GainEnergy(1);
            }

            //====================================================================================
            //====================================================================================
        }
Пример #26
0
        public override void Update(double elapsedTime)
        {
            Joystick.Update();
            if (Joystick.IsConnected(_index))
            {
                //Console.Out.WriteLine("Connected");
            }

            if (Joystick.GetAxisPosition(_index, Joystick.Axis.X) > _deadzone || Joystick.GetAxisPosition(_index, Joystick.Axis.X) < -_deadzone)
            {
                gameObject.transform.Position = gameObject.transform.Position + Vector2D.Right() * elapsedTime * Speed * (Joystick.GetAxisPosition(_index, Joystick.Axis.X) / 100);
            }

            if (Joystick.GetAxisPosition(_index, Joystick.Axis.Y) > _deadzone || Joystick.GetAxisPosition(_index, Joystick.Axis.Y) < -_deadzone)
            {
                gameObject.transform.Position = gameObject.transform.Position + Vector2D.Down() * elapsedTime * Speed * (Joystick.GetAxisPosition(_index, Joystick.Axis.Y) / 100);
            }

            if (Joystick.IsButtonPressed(_index, 1))
            {
                if (_parent.GetScripts <InvincibleScript>().Count > 0)
                {
                    _parent.GetScripts <InvincibleScript>()[0].IsInvincible = true;
                }
            }

            /*if (Joystick.IsButtonPressed(_index,0))
             * {
             *  Console.Out.WriteLine("0 = A");
             * }
             * if (Joystick.IsButtonPressed(_index, 1))
             * {
             *  Console.Out.WriteLine("1 = B");
             * }
             * if (Joystick.IsButtonPressed(_index, 2))
             * {
             *  Console.Out.WriteLine("2 = X");
             * }
             * if (Joystick.IsButtonPressed(_index, 3))
             * {
             *  Console.Out.WriteLine("3 = Y");
             * }
             * if (Joystick.IsButtonPressed(_index, 4))
             * {
             *  Console.Out.WriteLine("4 = L1");
             * }
             * if (Joystick.IsButtonPressed(_index, 5))
             * {
             *  Console.Out.WriteLine("5 = R1");
             * }
             * if (Joystick.IsButtonPressed(_index, 6))
             * {
             *  Console.Out.WriteLine("6 = Select");
             * }
             * if (Joystick.IsButtonPressed(_index, 7))
             * {
             *  Console.Out.WriteLine("7 = Start");
             * }
             * if (Joystick.IsButtonPressed(_index, 8))
             * {
             *  Console.Out.WriteLine("8 = LeftStick");
             * }
             * if (Joystick.IsButtonPressed(_index, 9))
             * {
             *  Console.Out.WriteLine("9 = RightStick");
             * }*/
        }
 public float GetJoystickAxis(uint joystickId, JoystickAxis axis)
 {
     return(Joystick.GetAxisPosition(joystickId, (Joystick.Axis)axis));
 }
Пример #28
0
 public float GetAxisValue(byte axis)
 => Joystick.GetAxisPosition(Id, (Joystick.Axis)axis);
Пример #29
0
        static void Main(string[] args)
        {
            Settings.Load();

            Init();

            float FPS    = 0;
            int   fcount = 0;

            map    = new Map();
            player = new Player(map);

            Text fps = new Text(FPS.ToString(), new Font(Resources.FPS_Font));

            fps.FillColor = Color.Red;
            fps.Position  = new Vector2f(Settings.sWidth - 50, 10);


            ingame   = new Music(Resources.ingame_music);
            inmenu   = new Music(Resources.menu_music);
            stepsbuf = new SoundBuffer(Resources.steps);
            steps    = new Sound(stepsbuf);

            buttonbuf = new SoundBuffer(Resources.button);
            button    = new Sound(buttonbuf);

            steps.Loop  = true;
            ingame.Loop = true;
            inmenu.Loop = true;

            menu = new Menu();
            menu.OnOpen();

            Text debug = new Text($"Время расчета: {player.CalcTime.TotalMilliseconds}\nВремя отрисовки: {player.DrawTime.TotalMilliseconds}", new Font(Resources.FPS_Font));

            debug.Position  = new Vector2f(50, Settings.sHeight - 400);
            debug.FillColor = Color.Magenta;

            Settings.Update(true);

            while (window.IsOpen)
            {
                window.SetVerticalSyncEnabled(Settings.VSync);
                window.SetFramerateLimit(Settings.FPS_Limit);
                fps.Position = new Vector2f(Settings.sWidth - 50, 10);

                if (Exit)
                {
                    window.Close();
                }
                fcount++;
                DateTime start = DateTime.Now;
                fps.DisplayedString = ((int)FPS).ToString();
                window.DispatchEvents();

                if (player.Stamina > 1)
                {
                    player.Stamina = 1;
                }
                if (player.Stamina < 0)
                {
                    player.Stamina = 0;
                }
                Joystick.Update();
                if (!Joystick.IsConnected(0))
                {
                    if (Keyboard.IsKeyPressed(Keyboard.Key.RShift) || Keyboard.IsKeyPressed(Keyboard.Key.LShift))
                    {
                        player.Run();
                    }
                    else
                    {
                        player.Stamina += player.Stamina < 1 ? 0.0025F : 0;
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.W))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.W))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.W, frametime);
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.A))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.A))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.A, frametime);
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.S))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.S))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.S, frametime);
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.D))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.D))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.D, frametime);
                    }
                }
                else
                {
                    player.JoystickTurn();
                    player.JoystickWalk(frametime);

                    if (Joystick.IsButtonPressed(0, 5))
                    {
                        player.Run();
                    }
                    else
                    {
                        player.Stamina += player.Stamina < 1 ? 0.0025F : 0;
                    }
                }
                if (Keyboard.IsKeyPressed(Keyboard.Key.F1))
                {
                    Help();
                }


                window.Clear(Color.White);
                window.SetMouseCursorVisible(isMenu);
                //Drawing
                if (menu.isWin)
                {
                    EndScene();
                }
                if (isMenu)
                {
                    menu.Draw(window);
                }
                else
                {
                    inmenu.Stop();
                    player.Draw(window);
                    map.Draw(window);
                    player.DrawOnMap(window);
                }
                //====================



                if (fcount == 20)
                {
                    debug.DisplayedString = $"" +
                                            $"Joystick.Axis.Y = {MathF.Round(Joystick.GetAxisPosition(0, Joystick.Axis.Z) / 100F, 4)}\n" +
                                            $"Joystick.Axis.X = {Joystick.IsButtonPressed(0, 6)}\n" +
                                            $"Test = {TEST}\n";
                }

                window.Draw(debug);
                window.Draw(fps);
                window.Display();


                frametime = (DateTime.Now - start).TotalSeconds;
                if (fcount == 20)
                {
                    FPS    = (float)(1 / frametime);
                    fcount = 0;
                    window.Draw(debug);
                }
            }
        }
Пример #30
0
        public static string RefreshAxisPressed()
        {
            var helperText = "";

            Joystick.Update();

            var joyX = Joystick.GetAxisPosition(0, Joystick.Axis.PovX);
            var joyY = Joystick.GetAxisPosition(0, Joystick.Axis.PovY);

            if (joyX == 0 && joyY == 0)
            {
                helperText = "no directional button pressed";

                ClearJoystikFlag(ControllerState.DPAD_LEFT_PRESSED);
                ClearJoystikFlag(ControllerState.DPAD_RIGHT_PRESSED);
                ClearJoystikFlag(ControllerState.DPAD_DOWN_PRESSED);
                ClearJoystikFlag(ControllerState.DPAD_UP_PRESSED);

                return(helperText); // no button pressed!
            }

            if (joyY == -100)
            {
                SetJoystikFlag(ControllerState.DPAD_LEFT_PRESSED);
                helperText = string.Format("Axis Pressed: DPAD_LEFT {0}, {1}", joyX, joyY);
            }
            else
            {
                ClearJoystikFlag(ControllerState.DPAD_LEFT_PRESSED);
            }

            if (joyY == 100)
            {
                SetJoystikFlag(ControllerState.DPAD_RIGHT_PRESSED);
                helperText = string.Format("Axis Pressed: DPAD_RIGHT {0}, {1}", joyX, joyY);
            }
            else
            {
                ClearJoystikFlag(ControllerState.DPAD_RIGHT_PRESSED);
            }

            if (joyX == -100 || joyX == -70)
            {
                SetJoystikFlag(ControllerState.DPAD_DOWN_PRESSED);
                helperText = string.Format("Axis Pressed: DPAD_DOWN {0}, {1}", joyX, joyY);
            }
            else
            {
                ClearJoystikFlag(ControllerState.DPAD_DOWN_PRESSED);
            }

            if (joyX == 100)
            {
                SetJoystikFlag(ControllerState.DPAD_UP_PRESSED);
                helperText = string.Format("Axis Pressed: DPAD_UP {0}, {1}", joyX, joyY);
            }
            else
            {
                ClearJoystikFlag(ControllerState.DPAD_UP_PRESSED);
            }

            return(helperText);
        }