Esempio n. 1
0
 public bool KeyPressed(Keys key)
 {
     if (CurrentKeyboardState.IsKeyDown(key) && PreviousKeyboardState.IsKeyUp(key))
     {
         if (active)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 2
0
 /// <summary>
 /// Given a previous key state of up determine if its been pressed.
 /// </summary>
 /// <param name="name">The name of the keybind.</param>
 /// <returns></returns>
 public bool KeyHit(string name)
 {
     if (!keybinds.ContainsKey(name))
     {
         return(false);
     }
     foreach (var key in keybinds[name])
     {
         if (KeyboardState.IsKeyDown(key) && PreviousKeyboardState.IsKeyUp(key))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 3
0
        public void Update()
        {
            PreviousKeyboardState = CurrentKeyboardState;
            CurrentKeyboardState  = Keyboard.GetState();

            DownKeys.Clear();
            PressedKeys.Clear();
            Keys[] keys = CurrentKeyboardState.GetPressedKeys(); // TODO: per frame heap allocs
            foreach (Keys key in keys)
            {
                if (PreviousKeyboardState.IsKeyUp(key) && IsKeyDown(key))
                {
                    PressedKeys.Add(key);
                }
                //else //if (_previousKeyState.IsKeyDown(key) && _currentKeyState.IsKeyDown(key))
                //    DownKeys.Add(key);
                if (IsKeyDown(key))
                {
                    DownKeys.Add(key);
                }
            }
        }
 public bool PressedKey(Keys key)
 {
     return(PreviousKeyboardState.IsKeyUp(key) && CurrentKeyboardState.IsKeyDown(key));
 }
Esempio n. 5
0
        /// <summary>
        /// Update method
        /// </summary>
        /// <param name="gameTime"></param>
        protected override void Update(GameTime gameTime)
        {
            if (this.Name == "TitleSelectionFrame")
            {
                string currentPosition = null;

                foreach (KeyValuePair <string, Vector2> keyValuePair in titleMenuDictionary) // Find the current position of the menu selection image
                {
                    if ((
                            (keyValuePair.Value.X == this.DrawLocation.X)
                            ) && (
                            (keyValuePair.Value.Y == this.DrawLocation.Y)
                            ) && (
                            (keyValuePair.Key != "TitleSelectionFrame")
                            ))
                    {
                        currentPosition = keyValuePair.Key;
                    }
                }

                // Move the image down if the down key is pressed
                if (CurrentKeyboardState.IsKeyDown(Keys.Down) && PreviousKeyboardState.IsKeyUp(Keys.Down))
                {
                    SoundEffectInstances["MenuMove"].Play();

                    switch (currentPosition)
                    {
                    case "NewGame":
                        base.CreateRectangle(titleMenuDictionary["LevelEditor"]);

                        break;

                    case "LevelEditor":
                        base.CreateRectangle(titleMenuDictionary["Options"]);

                        break;
                    }
                }// Move the image up if the up key is pressed
                else if (CurrentKeyboardState.IsKeyDown(Keys.Up) && PreviousKeyboardState.IsKeyUp(Keys.Up))
                {
                    SoundEffectInstances["MenuMove"].Play();

                    switch (currentPosition)
                    {
                    case "LevelEditor":
                        base.CreateRectangle(titleMenuDictionary["NewGame"]);

                        break;

                    case "Options":
                        base.CreateRectangle(titleMenuDictionary["LevelEditor"]);

                        break;
                    }
                }// Go into the menu if the enter key is pressed
                else if (CurrentKeyboardState.IsKeyDown(Keys.Enter) && PreviousKeyboardState.IsKeyUp(Keys.Enter))
                {
                    switch (currentPosition)
                    {
                    case "NewGame":
                        gameState = GameState.InGame;

                        break;

                    case "LevelEditor":
                        gameState = GameState.LevelEditor;

                        break;

                    case "Options":
                        gameState = GameState.Options;

                        break;
                    }
                }
            }
        }
Esempio n. 6
0
 public static bool KeyPressed(Keys key)
 {
     return(KeyboardState.IsKeyDown(key) && PreviousKeyboardState.IsKeyUp(key));
 }
Esempio n. 7
0
 public static bool IsKeyPressed(Keys key) => CurrentKeyboardState.IsKeyDown(key) && PreviousKeyboardState.IsKeyUp(key);
Esempio n. 8
0
        /// <summary>
        /// Applies movement to the player character
        /// </summary>
        /// <param name="gameTime"></param>
        /// <returns>The new rectangle where the character needs to be drawn</returns>
        public override Vector2 ApplyMovement(GameTime gameTime)
        {
            Vector2 returnValue;

            // Apply movement based on keys pressed
            if ((CurrentKeyboardState.IsKeyDown(Keys.A)) && (PreviousKeyboardState.IsKeyUp(Keys.A)) ||
                (CurrentKeyboardState.IsKeyDown(Keys.Left)) && (PreviousKeyboardState.IsKeyUp(Keys.Left)))
            {
                base.MovementAppliedTo = MovementAppliedTo.Left;
                base.SpriteEffect      = SpriteEffects.FlipHorizontally;
            }
            else if ((CurrentKeyboardState.IsKeyDown(Keys.D)) && (PreviousKeyboardState.IsKeyUp(Keys.D)) ||
                     (CurrentKeyboardState.IsKeyDown(Keys.Right)) && (PreviousKeyboardState.IsKeyUp(Keys.Right)))
            {
                base.MovementAppliedTo = MovementAppliedTo.Right;
                base.SpriteEffect      = SpriteEffects.None;
            }
            else if ((CurrentKeyboardState.IsKeyUp(Keys.A)) && (PreviousKeyboardState.IsKeyDown(Keys.A)) ||
                     (CurrentKeyboardState.IsKeyUp(Keys.Left)) && (PreviousKeyboardState.IsKeyDown(Keys.Left)))
            {
                if ((!base.JumpInProgress) && (!base.HasJumped))
                {
                    base.MovementAppliedTo = MovementAppliedTo.None;
                }
            }
            else if ((CurrentKeyboardState.IsKeyUp(Keys.D)) && (PreviousKeyboardState.IsKeyDown(Keys.D)) ||
                     (CurrentKeyboardState.IsKeyUp(Keys.Right)) && (PreviousKeyboardState.IsKeyDown(Keys.Right)))
            {
                if ((!base.JumpInProgress) && (!base.HasJumped))
                {
                    base.MovementAppliedTo = MovementAppliedTo.None;
                    base.SpriteEffect      = SpriteEffects.None;
                }
            }
            // Implement the jump feature
            if (base.GravityDirection == GravityDirection.Down)
            {
                if (((CurrentKeyboardState.IsKeyDown(Keys.Space)) && (PreviousKeyboardState.IsKeyUp(Keys.Space)) ||
                     (CurrentKeyboardState.IsKeyDown(Keys.Up)) && (PreviousKeyboardState.IsKeyUp(Keys.Up))) &&
                    ((base.HitObstacle == HitObstacle.FromTop) || (this.JumpCount == 1)))
                {
                    base.TimeSinceJump = gameTime.ElapsedGameTime.Milliseconds;

                    base.MovementAppliedTo = MovementAppliedTo.Up;

                    base.HitObstacle = HitObstacle.None;

                    if (this.PlatformVerticalAcceleration > 0)
                    {
                        base.GravitationalVelocity -= this.PlatformVerticalAcceleration;
                    }

                    if (base.HasJumped == false)
                    {
                        base.HasJumped = true;
                        SoundEffectInstances["JumpSound"].Play();
                    }

                    if (base.JumpInProgress == false)
                    {
                        base.JumpInProgress = true;
                    }
                }
            }
            else if (base.GravityDirection == GravityDirection.Up)
            {
                if (((CurrentKeyboardState.IsKeyDown(Keys.Space)) && (PreviousKeyboardState.IsKeyUp(Keys.Space)) ||
                     (CurrentKeyboardState.IsKeyUp(Keys.Up)) && (PreviousKeyboardState.IsKeyDown(Keys.Up))) &&
                    ((base.HitObstacle == HitObstacle.FromTop) || (this.JumpCount == 1)))
                {
                    base.MovementAppliedTo = MovementAppliedTo.Down;

                    base.HitObstacle = HitObstacle.None;

                    if (base.HasJumped == false)
                    {
                        base.HasJumped = true;
                    }

                    if (base.JumpInProgress == false)
                    {
                        base.JumpInProgress = true;
                    }
                }
            }
            // Cancel movement if nothing is being pressed (because of velocity)
            if ((CurrentKeyboardState.IsKeyUp(Keys.A)) && (CurrentKeyboardState.IsKeyUp(Keys.D)) &&
                (CurrentKeyboardState.IsKeyUp(Keys.Left)) && (CurrentKeyboardState.IsKeyUp(Keys.Right)) &&
                (base.Falling == false) && (base.HasJumped == false) && (base.JumpInProgress == false))
            {
                base.MovementAppliedTo = MovementAppliedTo.None;
            }
            // Attempt at working with gametime
            if (base.TimeSinceLastUpdate > 100)
            {
                this.UpdateSprite();
                base.SelectSprite(base.CurrentSpriteIndex);

                base.TimeSinceLastUpdate = 0;
            }

            base.CalculateGravity(gameTime);
            base.CalculateMovement(gameTime);

            returnValue = new Vector2(
                this.DrawLocation.X + base.MovementVelocity,
                this.DrawLocation.Y + base.GravitationalVelocity
                );

            return(returnValue);
        }
Esempio n. 9
0
 /// <summary>
 /// Given a previous key state of up determine if its been pressed.
 /// </summary>
 /// <param name="key">key to check</param>
 /// <returns></returns>
 public bool KeyHit(Keys key)
 {
     return(KeyboardState.IsKeyDown(key) && PreviousKeyboardState.IsKeyUp(key));
 }
Esempio n. 10
0
        /// <summary>
        /// Update method
        /// </summary>
        /// <param name="gameTime"></param>
        protected override void Update(GameTime gameTime)
        {
            if (this.Name == "OptionsSelectionFrame")
            {
                string currentPosition = null;

                foreach (KeyValuePair <string, Vector2> keyValuePair in optionMenuDictionary)
                {
                    if ((
                            (keyValuePair.Value.X - 20 == this.DrawLocation.X)
                            ) && (
                            (keyValuePair.Value.Y - 15 == this.DrawLocation.Y)
                            ) && (
                            (keyValuePair.Key != "OptionSelectionFrame")
                            ))
                    {
                        currentPosition = keyValuePair.Key;                                 // Find the current index of the selection bar
                    }
                }
                // Move the selection bar based on key pressed
                if (CurrentKeyboardState.IsKeyDown(Keys.Down) && PreviousKeyboardState.IsKeyUp(Keys.Down))
                {
                    SoundEffectInstances["MenuMove"].Play();

                    switch (currentPosition)
                    {
                    case "Music":
                        base.CreateRectangle(
                            (int)(optionMenuDictionary["SFX"].X - 20),
                            (int)(optionMenuDictionary["SFX"].Y - 15)
                            );

                        break;
                    }
                }
                else if (CurrentKeyboardState.IsKeyDown(Keys.Up) && PreviousKeyboardState.IsKeyUp(Keys.Up))
                {
                    SoundEffectInstances["MenuMove"].Play();

                    switch (currentPosition)
                    {
                    case "SFX":
                        base.CreateRectangle(
                            (int)(optionMenuDictionary["Music"].X - 20),
                            (int)(optionMenuDictionary["Music"].Y - 15)
                            );

                        break;
                    }
                }
                else if (CurrentKeyboardState.IsKeyDown(Keys.Right) && PreviousKeyboardState.IsKeyUp(Keys.Right))
                {
                    switch (currentPosition)
                    {
                    case "Music":
                        if (SoundEffectInstances["BackgroundMusic"].Volume < 0.9f)          // Move the side scrolling volume controls

                        {
                            SoundEffectInstances["BackgroundMusic"].Volume += 0.1f;

                            foreach (Option menuOption in OptionElements)
                            {
                                if (menuOption.Name == "MusicSlider")
                                {
                                    menuOption.CreateRectangle(                             // Adjust the volume
                                        (int)(optionMenuDictionary["MusicSlider"].X + 10),
                                        (int)(optionMenuDictionary["MusicSlider"].Y)
                                        );

                                    optionMenuDictionary["MusicSlider"] = new Vector2(
                                        (int)(optionMenuDictionary["MusicSlider"].X + 10),
                                        (int)(optionMenuDictionary["MusicSlider"].Y)
                                        );

                                    SoundEffectInstances["MenuMove"].Play();
                                }
                            }
                        }
                        else
                        {
                            SoundEffectInstances["Error"].Play();
                        }

                        break;

                    case "SFX":
                        bool movedSlider = false;

                        foreach (KeyValuePair <string, SoundEffectInstance> keyValuePair in SoundEffectInstances)
                        {
                            if (keyValuePair.Key != "BackgroundMusic")
                            {
                                if (keyValuePair.Value.Volume < 0.9f)                       // Move the side scrolling volume controls
                                {
                                    keyValuePair.Value.Volume += 0.1f;

                                    if (!movedSlider)
                                    {
                                        foreach (Option menuOption in OptionElements)
                                        {
                                            if (menuOption.Name == "SFXSlider")
                                            {
                                                menuOption.CreateRectangle(                 // Adjust the volume
                                                    (int)(optionMenuDictionary["SFXSlider"].X + 10),
                                                    (int)(optionMenuDictionary["SFXSlider"].Y)
                                                    );

                                                optionMenuDictionary["SFXSlider"] = new Vector2(
                                                    (int)(optionMenuDictionary["SFXSlider"].X + 10),
                                                    (int)(optionMenuDictionary["SFXSlider"].Y)
                                                    );

                                                SoundEffectInstances["MenuMove"].Play();
                                            }
                                        }

                                        movedSlider = true;
                                    }
                                }
                                else
                                {
                                    SoundEffectInstances["Error"].Play();
                                }
                            }
                        }

                        break;

                    case "Difficulty":
                        break;
                    }
                }
                else if (CurrentKeyboardState.IsKeyDown(Keys.Left) && PreviousKeyboardState.IsKeyUp(Keys.Left))
                {
                    switch (currentPosition)
                    {
                    case "Music":
                        if (SoundEffectInstances["BackgroundMusic"].Volume > 0.1f)          // Move the side scrolling volume controls
                        {
                            SoundEffectInstances["BackgroundMusic"].Volume -= 0.1f;

                            foreach (Option menuOption in OptionElements)
                            {
                                if (menuOption.Name == "MusicSlider")
                                {
                                    menuOption.CreateRectangle(                             // Adjust the volume
                                        (int)(optionMenuDictionary["MusicSlider"].X - 10),
                                        (int)(optionMenuDictionary["MusicSlider"].Y)
                                        );

                                    optionMenuDictionary["MusicSlider"] = new Vector2(
                                        (int)(optionMenuDictionary["MusicSlider"].X - 10),
                                        (int)(optionMenuDictionary["MusicSlider"].Y)
                                        );

                                    SoundEffectInstances["MenuMove"].Play();
                                }
                            }
                        }
                        else
                        {
                            SoundEffectInstances["Error"].Play();
                        }

                        break;

                    case "SFX":
                        bool movedSlider = false;

                        foreach (KeyValuePair <string, SoundEffectInstance> keyValuePair in SoundEffectInstances)
                        {
                            if (keyValuePair.Key != "BackgroundMusic")
                            {
                                if (keyValuePair.Value.Volume > 0.1f)                       // Move the side scrolling volume controls
                                {
                                    keyValuePair.Value.Volume -= 0.1f;

                                    if (!movedSlider)
                                    {
                                        foreach (Option menuOption in OptionElements)
                                        {
                                            if (menuOption.Name == "SFXSlider")
                                            {
                                                menuOption.CreateRectangle(                 // Adjust the volume
                                                    (int)(optionMenuDictionary["SFXSlider"].X - 10),
                                                    (int)(optionMenuDictionary["SFXSlider"].Y)
                                                    );

                                                optionMenuDictionary["SFXSlider"] = new Vector2(
                                                    (int)(optionMenuDictionary["SFXSlider"].X - 10),
                                                    (int)(optionMenuDictionary["SFXSlider"].Y)
                                                    );

                                                SoundEffectInstances["MenuMove"].Play();
                                            }
                                        }

                                        movedSlider = true;
                                    }
                                }
                                else
                                {
                                    SoundEffectInstances["Error"].Play();
                                }
                            }
                        }

                        break;
                    }
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Checks if all of the keys specified were up last frame
 /// </summary>
 public bool WasAllKeysUp(params Keys[] keys)
 {
     return(keys.All(k => PreviousKeyboardState.IsKeyUp(k)));
 }
Esempio n. 12
0
 /// <summary>
 /// Checks if a given key is was up last frame
 /// </summary>
 public bool WasKeyUp(Keys key)
 {
     return(PreviousKeyboardState.IsKeyUp(key));
 }
Esempio n. 13
0
 /// <summary>
 /// Checks if any of the keys specified were up the last frame
 /// </summary>
 public bool WereAnyKeysUp(params Keys[] keys)
 {
     return(keys.Any(k => PreviousKeyboardState.IsKeyUp(k)));
 }
Esempio n. 14
0
 public static bool IsNewKeyPress(Keys k)
 {
     return(CurrentKeyboardState.IsKeyDown(k) && PreviousKeyboardState.IsKeyUp(k));
 }
Esempio n. 15
0
 public bool wasButtonPressedAndReleased(Keys k)
 {
     return
         ((CurrentKeyboardState.IsKeyDown(k) && PreviousKeyboardState.IsKeyUp(k)) ? true : false);
 }
Esempio n. 16
0
 public static bool WasKeyJustPressed(Keys key)
 {
     return(PreviousKeyboardState.IsKeyUp(key) && CurrentKeyboardState.IsKeyDown(key));
 }
Esempio n. 17
0
 /// <summary>
 ///   Helper for checking if a key was newly pressed during this update.
 /// </summary>
 public bool IsNewKeyPress(Keys key)
 {
     return(KeyboardState.IsKeyDown(key) && PreviousKeyboardState.IsKeyUp(key));
 }
Esempio n. 18
0
 /// <summary>
 ///     Check if key has just been pressed
 /// </summary>
 /// <param name="key">Key to check</param>
 public static bool IsKeyTyped(Keys key)
 {
     return(PreviousKeyboardState.IsKeyUp(key) && CurrentKeyboardState.IsKeyDown(key));
 }
 /// <summary>
 /// Queries the current and previous keyboard states to work out whether a key has been pressed
 /// </summary>
 /// <param name="key">The key we wish to query</param>
 /// <returns>Returns true if the key is down this frame and up the previous frame</returns>
 public bool IsKeyPressed(Keys key)
 {
     return(CurrentKeyboardState.IsKeyDown(key) && PreviousKeyboardState.IsKeyUp(key));
 }
Esempio n. 20
0
        public override void Update(GameTime gameTime)
        {
            //Update Keyboard and Mouse States
            PreviousKeyboardState = CurrentKeyboardState;
            CurrentKeyboardState  = Keyboard.GetState();
            PreviousMouseState    = CurrentMouseState;
            CurrentMouseState     = Mouse.GetState();

            //Clear Data Structures
            ActiveActions.Clear();
            ActiveStates.Clear();
            ActiveRanges.Clear();
            MappedKeyboardKeys.Clear();
            MappedMouseButtons.Clear();
            MappedMouseRanges.Clear();
            RangeValues.Clear();

            MouseScreenLocation = new Point(CurrentMouseState.X, CurrentMouseState.Y);

            //Sort EntityList by InputMap Priority
            EntityList.Sort((Entity x, Entity y) =>
            {
                if (x.GetComponent <CInputMap>().Priority < y.GetComponent <CInputMap>().Priority)
                {
                    return(-1);
                }
                else if (x.GetComponent <CInputMap>().Priority > y.GetComponent <CInputMap>().Priority)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            //Map Raw Inputs to Actions, States and Ranges
            foreach (Entity e in EntityList)
            {
                var inputMap = e.GetComponent <CInputMap>();

                //KEYBOARD KEY TO ACTION
                foreach (KeyValuePair <Keys, int> pair in inputMap.KeyboardKeyToAction)
                {
                    if (!MappedKeyboardKeys.Contains(pair.Key))
                    {
                        if (PreviousKeyboardState.IsKeyUp(pair.Key) && CurrentKeyboardState.IsKeyDown(pair.Key))
                        {
                            ActiveActions.Add(pair.Value);
                            MappedKeyboardKeys.Add(pair.Key);
                        }
                    }
                }

                //KEYBOARD KEY TO STATE
                foreach (KeyValuePair <Keys, int> pair in inputMap.KeyboardKeyToState)
                {
                    if (!MappedKeyboardKeys.Contains(pair.Key))
                    {
                        if (CurrentKeyboardState.IsKeyDown(pair.Key))
                        {
                            ActiveStates.Add(pair.Value);
                            MappedKeyboardKeys.Add(pair.Key);
                        }
                    }
                }

                //MOUSE BUTTON TO ACTION
                foreach (KeyValuePair <MouseButtons, int> pair in inputMap.MouseButtonToAction)
                {
                    if (!MappedMouseButtons.Contains(pair.Key))
                    {
                        if (pair.Key == MouseButtons.LeftButton)
                        {
                            if (PreviousMouseState.LeftButton == ButtonState.Released && CurrentMouseState.LeftButton == ButtonState.Pressed)
                            {
                                ActiveActions.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.RightButton)
                        {
                            if (PreviousMouseState.RightButton == ButtonState.Released && CurrentMouseState.RightButton == ButtonState.Pressed)
                            {
                                ActiveActions.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.MiddleButton)
                        {
                            if (PreviousMouseState.MiddleButton == ButtonState.Released && CurrentMouseState.MiddleButton == ButtonState.Pressed)
                            {
                                ActiveActions.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.XButton1)
                        {
                            if (PreviousMouseState.XButton1 == ButtonState.Released && CurrentMouseState.XButton1 == ButtonState.Pressed)
                            {
                                ActiveActions.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.XButton2)
                        {
                            if (PreviousMouseState.XButton2 == ButtonState.Released && CurrentMouseState.XButton2 == ButtonState.Pressed)
                            {
                                ActiveActions.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                    }
                }

                //MOUSE BUTTON TO STATE
                foreach (KeyValuePair <MouseButtons, int> pair in inputMap.MouseButtonToState)
                {
                    if (!MappedMouseButtons.Contains(pair.Key))
                    {
                        if (pair.Key == MouseButtons.LeftButton)
                        {
                            if (CurrentMouseState.LeftButton == ButtonState.Pressed)
                            {
                                ActiveStates.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.RightButton)
                        {
                            if (CurrentMouseState.RightButton == ButtonState.Pressed)
                            {
                                ActiveStates.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.MiddleButton)
                        {
                            if (CurrentMouseState.MiddleButton == ButtonState.Pressed)
                            {
                                ActiveStates.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.XButton1)
                        {
                            if (CurrentMouseState.XButton1 == ButtonState.Pressed)
                            {
                                ActiveStates.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                        if (pair.Key == MouseButtons.XButton2)
                        {
                            if (CurrentMouseState.XButton2 == ButtonState.Pressed)
                            {
                                ActiveStates.Add(pair.Value);
                                MappedMouseButtons.Add(pair.Key);
                            }
                        }
                    }
                }

                //MOUSE RANGE TO RANGE
                foreach (KeyValuePair <MouseRanges, int> pair in inputMap.MouseRangeToRange)
                {
                    if (!MappedMouseRanges.Contains(pair.Key))
                    {
                        if (pair.Key == MouseRanges.ScrollDelta)
                        {
                            ActiveRanges.Add(pair.Value);
                            RangeValues.Add(pair.Value, CurrentMouseState.ScrollWheelValue - PreviousMouseState.ScrollWheelValue);
                            MappedMouseRanges.Add(pair.Key);
                        }
                        if (pair.Key == MouseRanges.MouseHorizontalDelta)
                        {
                            float hCenter = ViewPort.Width / 2;
                            ActiveRanges.Add(pair.Value);
                            RangeValues.Add(pair.Value, CurrentMouseState.X - hCenter);
                            MappedMouseRanges.Add(pair.Key);
                        }
                        if (pair.Key == MouseRanges.MouseVerticalDelta)
                        {
                            float vCenter = ViewPort.Height / 2;
                            ActiveRanges.Add(pair.Value);
                            RangeValues.Add(pair.Value, CurrentMouseState.Y - vCenter);
                            MappedMouseRanges.Add(pair.Key);
                        }
                    }
                }
            }

            //Given the Mapped Inputs, Call all Callbacks and see if they can use the Mapped Input
            foreach (Entity e in EntityList)
            {
                var inputHandlers = e.GetComponent <CInputHandlers>();

                foreach (int callbackID in inputHandlers.InputHandlerIDs)
                {
                    GameRegistry.FetchInputCallback(callbackID)(e, gameTime, ActiveActions, ActiveStates, ActiveRanges, RangeValues);
                }
            }
        }