private InputManager _inputManager;
protected override void Initialize()
{
_inputManager = new InputManager();
Components.Add(_inputManager);
}
protected override void Update(GameTime gameTime)
{
if (_inputManager.KeyWasPressed(Keys.Enter))
{
// TODO: Use your newfound input awesomeness!
}
}
-
KeyWasPressed(Keys) : boolReturns whether the specified key was pressed and released (not held) since the last
Update()call. -
KeyWasPressedFor(Keys, TimeSpan) : boolReturns whether the specified key has been held for the specified duration.
-
KeyWasPressedWithModifiers(Keys, Keys[]) : boolReturns whether the specified key was pressed and released (not held) while the specified modifiers were held.
-
KeyWasReleased(Keys) : boolReturns
trueif the specified key was recently released (during the lastUpdate()call);falseotherwise. -
GetElapsedHeldTime(Keys) : TimeSpanReturns the duration for which the specified key has been held.
-
GetElapsedHeldTime(MouseButtons) : TimeSpanReturns the duration for which the specified mouse button has been held.
-
MouseButtonIsDown(MouseButtons) : bool -
MouseButtonIsUp(MouseButtons) : bool -
MouseButtonWasClicked(MouseButtons) : bool -
ButtonWasClickedWithKeyModifiers(MouseButtons, Keys[]) : bool -
ButtonWasReleased(MouseButtons) : bool -
GetDistanceScrolled() : int -
MouseIsScrollingUp() : bool -
MouseIsScrollingDown() : bool