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); }
//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); }
public void update() { updateControllerInput(); previousMouseState = currentMouseState; previousPressedKeys = currentPressedKeys; currentMouseState = Mouse.GetState(); currentPressedKeys = Keyboard.GetState().GetPressedKeys(); if (inputProcessor != null) { updateMouseInput(); updateKeyboardInput(); } }