Microsoft.Xna.Framework.Input
Class KeyboardState

java.lang.Object
  extended by System.ValueType
      extended by Microsoft.Xna.Framework.Input.KeyboardState

public final class KeyboardState
extends ValueType

Represents a state of keystrokes recorded by a keyboard input device.

Author:
Halofreak1990

Constructor Summary
KeyboardState(Keys... keys)
          Initializes a new instance of the KeyboardState class.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns a value that indicates whether the current instance is equal to a specified object.
 KeyState get(Keys key)
          Returns the state of a particular key.
 Keys[] GetPressedKeys()
          Gets an array of values that correspond to the keyboard keys that are currently being pressed.
 int hashCode()
          Gets the hash code for this instance.
 boolean IsKeyDown(Keys key)
          Returns whether a specified key is currently being pressed.
 boolean IsKeyUp(Keys key)
          Returns whether a specified key is currently not pressed.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyboardState

public KeyboardState(Keys... keys)
Initializes a new instance of the KeyboardState class.

Parameters:
keys - Array or parameter list of Keys to initialize as pressed.
Method Detail

get

public KeyState get(Keys key)
Returns the state of a particular key.

Parameters:
key - Enumerated value representing the key to query.
Returns:
The state of the key specified by key.

equals

public boolean equals(java.lang.Object obj)
Returns a value that indicates whether the current instance is equal to a specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to compare this object to.
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Gets the hash code for this instance.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code for this object.

GetPressedKeys

public Keys[] GetPressedKeys()
Gets an array of values that correspond to the keyboard keys that are currently being pressed.

Returns:
The keys that are currently pressed.

IsKeyDown

public boolean IsKeyDown(Keys key)
Returns whether a specified key is currently being pressed.

Parameters:
key - Enumerated value that specifies the key to query.
Returns:
true if the key specified by key is being held down; false otherwise.

IsKeyUp

public boolean IsKeyUp(Keys key)
Returns whether a specified key is currently not pressed.

Parameters:
key - Enumerated value that specifies the key to query.
Returns:
true if the key specified by key is not pressed; false otherwise.