Struct KeyboardState
Encapsulates the state of a Keyboard device.
Implements
Inherited Members
Namespace: OpenTK.Input
Assembly: cs.temp.dll.dll
Syntax
public struct KeyboardState : IEquatable<KeyboardState>
Properties
IsAnyKeyDown
Gets a value indicating whether any key is down.
Declaration
public bool IsAnyKeyDown { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsConnected
Gets a System.Boolean indicating whether this keyboard is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[Key]
Gets a System.Boolean indicating whether the specified Key is pressed.
Declaration
public bool this[Key key] { get; }
Parameters
Type | Name | Description |
---|---|---|
Key | key | The Key to check. |
Property Value
Type | Description |
---|---|
System.Boolean | True if key is pressed; false otherwise. |
Item[Int16]
Gets a System.Boolean indicating whether the specified Key is pressed.
Declaration
public bool this[short code] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | code | The scancode to check. |
Property Value
Type | Description |
---|---|
System.Boolean | True if code is pressed; false otherwise. |
Methods
Equals(KeyboardState)
Compares two KeyboardState instances.
Declaration
public bool Equals(KeyboardState other)
Parameters
Type | Name | Description |
---|---|---|
KeyboardState | other | The instance to compare two. |
Returns
Type | Description |
---|---|
System.Boolean | True, if both instances are equal; false otherwise. |
Equals(Object)
Compares to an object instance for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The System.Object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | True if this instance is equal to obj; false otherwise. |
Overrides
GetHashCode()
Generates a hashcode for the current instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A System.Int32 represting the hashcode for this instance. |
Overrides
IsKeyDown(Key)
Gets a System.Boolean indicating whether this key is down.
Declaration
public bool IsKeyDown(Key key)
Parameters
Type | Name | Description |
---|---|---|
Key | key | The Key to check. |
Returns
Type | Description |
---|---|
System.Boolean |
IsKeyDown(Int16)
Gets a System.Boolean indicating whether this scan code is down.
Declaration
public bool IsKeyDown(short code)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | code | The scan code to check. |
Returns
Type | Description |
---|---|
System.Boolean |
IsKeyUp(Key)
Gets a System.Boolean indicating whether this key is up.
Declaration
public bool IsKeyUp(Key key)
Parameters
Type | Name | Description |
---|---|---|
Key | key | The Key to check. |
Returns
Type | Description |
---|---|
System.Boolean |
IsKeyUp(Int16)
Gets a System.Boolean indicating whether this scan code is down.
Declaration
public bool IsKeyUp(short code)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | code | The scan code to check. |
Returns
Type | Description |
---|---|
System.Boolean |
Operators
Equality(KeyboardState, KeyboardState)
Checks whether two KeyboardState instances are equal.
Declaration
public static bool operator ==(KeyboardState left, KeyboardState right)
Parameters
Type | Name | Description |
---|---|---|
KeyboardState | left | A KeyboardState instance. |
KeyboardState | right | A KeyboardState instance. |
Returns
Type | Description |
---|---|
System.Boolean | True if both left is equal to right; false otherwise. |
Inequality(KeyboardState, KeyboardState)
Checks whether two KeyboardState instances are not equal.
Declaration
public static bool operator !=(KeyboardState left, KeyboardState right)
Parameters
Type | Name | Description |
---|---|---|
KeyboardState | left | A KeyboardState instance. |
KeyboardState | right | A KeyboardState instance. |
Returns
Type | Description |
---|---|
System.Boolean | True if both left is not equal to right; false otherwise. |