Esempio n. 1
0
 public MonoGameInput()
 {
     currentMouseState  = previousMouseState = Mouse.GetState();
     currentPressedKeys = previousPressedKeys = new Keys[0];
     gamePads           = new MonoGameGamePad[Microsoft.Xna.Framework.Input.GamePad.MaximumGamePadCount];
     for (var i = 0; i < gamePads.Length; i++)
     {
         gamePads[i] = new MonoGameGamePad(i);
     }
     gamePadsArray = Array.with(gamePads);
 }
Esempio n. 2
0
        //custom contains implementation because c# one is based on linq which is too slow
        private static bool contains(Keys[] keys, Keys key)
        {
            for (int i = 0; i < keys.Length; i++)
            {
                if (keys[i] == key)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 3
0
 public void update()
 {
     updateControllerInput();
     previousMouseState  = currentMouseState;
     previousPressedKeys = currentPressedKeys;
     currentMouseState   = Mouse.GetState();
     currentPressedKeys  = Keyboard.GetState().GetPressedKeys();
     if (inputProcessor != null)
     {
         updateMouseInput();
         updateKeyboardInput();
     }
 }