The Open Toolkit library  1.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
OpenTK.Input.KeyboardState Struct Reference

Encapsulates the state of a Keyboard device. More...

Inherits IEquatable< KeyboardState >.

Public Member Functions

bool IsKeyDown (Key key)
 Gets a System.Boolean indicating whether this key is down. More...
 
bool IsKeyDown (short code)
 Gets a System.Boolean indicating whether this scan code is down. More...
 
bool IsKeyUp (Key key)
 Gets a System.Boolean indicating whether this key is up. More...
 
bool IsKeyUp (short code)
 Gets a System.Boolean indicating whether this scan code is down. More...
 
override bool Equals (object obj)
 Compares to an object instance for equality. More...
 
override int GetHashCode ()
 Generates a hashcode for the current instance. More...
 
bool Equals (KeyboardState other)
 Compares two KeyboardState instances. More...
 

Static Public Member Functions

static bool operator== (KeyboardState left, KeyboardState right)
 Checks whether two KeyboardState instances are equal. More...
 
static bool operator!= (KeyboardState left, KeyboardState right)
 Checks whether two KeyboardState instances are not equal. More...
 
static void ValidateOffset (int offset, bool ScanCode)
 

Public Attributes

const int IntSize = sizeof(int)
 
const int NumInts = ((int)Key.LastKey + IntSize - 1) / IntSize
 
unsafe fixed int Keys [NumInts]
 
const int CodesSize = 256
 
unsafe fixed int Codes [CodesSize]
 
bool is_connected
 

Properties

bool this[Key key] [get]
 Gets a System.Boolean indicating whether the specified OpenTK.Input.Key is pressed. More...
 
bool this[short code] [get]
 Gets a System.Boolean indicating whether the specified OpenTK.Input.Key is pressed. More...
 
bool IsConnected [get, set]
 Gets a System.Boolean indicating whether this keyboard is connected. More...
 

Detailed Description

Encapsulates the state of a Keyboard device.

Member Function Documentation

override bool OpenTK.Input.KeyboardState.Equals ( object  obj)

Compares to an object instance for equality.

Parameters
objThe System.Object to compare to.
Returns
True if this instance is equal to obj; false otherwise.
bool OpenTK.Input.KeyboardState.Equals ( KeyboardState  other)

Compares two KeyboardState instances.

Parameters
otherThe instance to compare two.
Returns
True, if both instances are equal; false otherwise.
override int OpenTK.Input.KeyboardState.GetHashCode ( )

Generates a hashcode for the current instance.

Returns
A System.Int32 represting the hashcode for this instance.
bool OpenTK.Input.KeyboardState.IsKeyDown ( Key  key)

Gets a System.Boolean indicating whether this key is down.

Parameters
keyThe OpenTK.Input.Key to check.
bool OpenTK.Input.KeyboardState.IsKeyDown ( short  code)

Gets a System.Boolean indicating whether this scan code is down.

Parameters
codeThe scan code to check.
bool OpenTK.Input.KeyboardState.IsKeyUp ( Key  key)

Gets a System.Boolean indicating whether this key is up.

Parameters
keyThe OpenTK.Input.Key to check.
bool OpenTK.Input.KeyboardState.IsKeyUp ( short  code)

Gets a System.Boolean indicating whether this scan code is down.

Parameters
codeThe scan code to check.
static bool OpenTK.Input.KeyboardState.operator!= ( KeyboardState  left,
KeyboardState  right 
)
static

Checks whether two KeyboardState instances are not equal.

Parameters
leftA KeyboardState instance.
rightA KeyboardState instance.
Returns
True if both left is not equal to right; false otherwise.
static bool OpenTK.Input.KeyboardState.operator== ( KeyboardState  left,
KeyboardState  right 
)
static

Checks whether two KeyboardState instances are equal.

Parameters
leftA KeyboardState instance.
rightA KeyboardState instance.
Returns
True if both left is equal to right; false otherwise.

Property Documentation

bool OpenTK.Input.KeyboardState.IsConnected
getset

Gets a System.Boolean indicating whether this keyboard is connected.

bool OpenTK.Input.KeyboardState.this[Key key]
get

Gets a System.Boolean indicating whether the specified OpenTK.Input.Key is pressed.

Parameters
keyThe OpenTK.Input.Key to check.
Returns
True if key is pressed; false otherwise.
bool OpenTK.Input.KeyboardState.this[short code]
get

Gets a System.Boolean indicating whether the specified OpenTK.Input.Key is pressed.

Parameters
codeThe scancode to check.
Returns
True if code is pressed; false otherwise.