Ejemplo n.º 1
0
        public BetaMouseMath()
        {
            this.varManager = VarManager.Instance;
            this.inputManager = InputManager.Instance;
            this.gamesManager = BetaGamesManager.Instance;

            this.varManager.GetVar(VarManager.Names.Speed, out m_speed);
            this.varManager.GetVar(VarManager.Names.Speed2, out m_speed2);
            this.varManager.GetVar(VarManager.Names.Speed3, out m_speed3);
            this.varManager.GetVar(VarManager.Names.Speed4, out m_speed4);
            this.varManager.GetVar(VarManager.Names.Accel, out m_accel);
            this.varManager.GetVar(VarManager.Names.Accel2, out m_accel2);
            this.varManager.GetVar(VarManager.Names.Accel3, out m_accel3);
            this.varManager.GetVar(VarManager.Names.Accel4, out m_accel4);
            this.varManager.GetVar(VarManager.Names.Sensitivity1, out m_sensitivity1);
            this.varManager.GetVar(VarManager.Names.Sensitivity2, out m_sensitivity2);
            this.varManager.GetVar(VarManager.Names.AltSens, out m_altSens);
            this.varManager.GetVar(VarManager.Names.AltSens2, out m_altSens2);
            this.varManager.GetVar(VarManager.Names.AltSens3, out m_altSens3);
            this.varManager.GetVar(VarManager.Names.Deadzone, out m_deadzone);
            this.varManager.GetVar(VarManager.Names.YXRatio, out m_yxratio);
            this.varManager.GetVar(VarManager.Names.TransExponent1, out m_transExp1);
            this.varManager.GetVar(VarManager.Names.Smoothness, out m_smoothness);
            this.varManager.GetVar(VarManager.Names.Rate, out m_rate);
            this.varManager.GetVar(VarManager.Names.AutoAnalogDisconnect, out m_autoAnalogDisconnect);
            this.varManager.GetVar(VarManager.Names.CircularDeadzone, out m_circularDeadzone);
            this.varManager.GetVar(VarManager.Names.UseXimApiMouseMath, out m_useXimApiMouseMath);
            this.varManager.GetVar(VarManager.Names.DiagonalDampen, out m_diagonalDampen);
            this.varManager.GetVar(VarManager.Names.CurrentGame, out m_currentGame);
            this.varManager.GetVar(VarManager.Names.MouseStickX, out m_mouseStickX);
            this.varManager.GetVar(VarManager.Names.MouseStickY, out m_mouseStickY);
            this.varManager.GetVar(VarManager.Names.InvertY, out m_inverty);
            this.varManager.GetVar(VarManager.Names.MouseDPI, out m_mouseDpi);
        }
Ejemplo n.º 2
0
        private void CalcDiag(Vector2 mouseDelta, BetaGamesManager.GameSettings gs)
        {
            if (gs.DiagonalCoeff != 0)
            {
                Vector2 absDelta = new Vector2(Math.Abs(mouseDelta.X), Math.Abs(mouseDelta.Y));
                absDelta.Cap(0, (double)Xim.Stick.Max);

                double association = 0;
                if (absDelta.X > absDelta.Y)
                {
                    association = absDelta.Y / absDelta.X;
                    if (association != 0 && !Double.IsNaN(association) && !Double.IsInfinity(association))
                    {
                        //mouseDelta.Y = mouseDelta.Y + mouseDelta.Y * (0.1 - association / 10) * gs.DiagonalCoeff;
                        mouseDelta.Scale(1 - association * gs.DiagonalCoeff);
                    }
                }
                else
                {
                    association = absDelta.X / absDelta.Y;
                    if (association != 0 && !Double.IsNaN(association) && !Double.IsInfinity(association))
                    {
                        //mouseDelta.X = mouseDelta.X + mouseDelta.X * (0.1 - association / 10) * gs.DiagonalCoeff;
                        mouseDelta.Scale(1 - association * gs.DiagonalCoeff);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /*Vector2 absAngVelocity = new Vector2(Math.Abs(angVelocity.X),Math.Abs(angVelocity.Y));
            MouseAlgs.Algorithm xAlg = gs.XAxis[0];
            MouseAlgs.Algorithm yAlg = gs.YAxis[0];
            foreach (MouseAlgs.Algorithm alg in gs.XAxis)
            {
                if (absAngVelocity.X < alg.MinSpeed)
                    break;

                xAlg = alg;

                if (absAngVelocity.X < alg.MaxSpeed)
                    break;
            }

            if (absAngVelocity.X > xAlg.MaxSpeed)
            {
                highEndCarry.X = Math.Sign(angVelocity.X) * (absAngVelocity.X - xAlg.MaxSpeed);
                absAngVelocity.X = xAlg.MaxSpeed;
            }

            foreach (MouseAlgs.Algorithm alg in gs.YAxis)
            {
                if (absAngVelocity.Y < alg.MinSpeed)
                    break;

                yAlg = alg;

                if (Math.Abs(absAngVelocity.Y) < alg.MaxSpeed)
                    break;
            }

            if (absAngVelocity.Y > yAlg.MaxSpeed)
            {
                highEndCarry.Y = Math.Sign(angVelocity.Y) * (absAngVelocity.Y - yAlg.MaxSpeed);
                absAngVelocity.Y = yAlg.MaxSpeed;
            }

            mouseDelta.X = Math.Sign(mouseDelta.X) * xAlg.CalcOutputDelta(absAngVelocity.X, absAngVelocity.Y);
            mouseDelta.Y = Math.Sign(mouseDelta.Y) * yAlg.CalcOutputDelta(absAngVelocity.Y, absAngVelocity.X);*/
        //}
        private void CalcAveraging(Vector2 mouseDelta, BetaGamesManager.GameSettings gs)
        {
            mouseDelta.X = (mouseDelta.X + lastFrame.X * gs.Smoothing) / (1 + gs.Smoothing);
            mouseDelta.Y = (mouseDelta.Y + lastFrame.Y * gs.Smoothing) / (1 + gs.Smoothing);
            this.lastFrame = mouseDelta;
        }
Ejemplo n.º 4
0
 private void CalcDelta(double delayInMs, Vector2 angVelocity, ref Vector2 mouseDelta, BetaGamesManager.GameSettings gs)
 {
     gs.TransAlg.CalcOutputDelta(delayInMs, angVelocity, ref mouseDelta, ref highEndCarry);
 }
Ejemplo n.º 5
0
 private static Vector2 CalcDeadzone(Vector2 mouseDelta, BetaGamesManager.GameSettings gs)
 {
     Vector2 deadzone = null;
     if (gs.Circular)
     {
         deadzone = new Vector2(mouseDelta.X, mouseDelta.Y);
         deadzone.Normalize();
         deadzone.Scale(gs.Deadzone);
     }
     else
     {
         deadzone = new Vector2(gs.Deadzone * Math.Sign(mouseDelta.X), gs.Deadzone * Math.Sign(mouseDelta.Y));
     }
     return deadzone;
 }