Struct KeyboardState
Encapsulates the state of a Keyboard device.
Implements
Inherited Members
Namespace: OpenTK.Input
Assembly: OpenTK.dll
Syntax
public struct KeyboardState : IEquatable<KeyboardState>
Properties
IsAnyKeyDown
Gets a value indicating whether any key is down.
Declaration
public readonly bool IsAnyKeyDown { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsConnected
Gets a Boolean indicating whether this keyboard is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
Item[Key]
Declaration
public bool this[Key key] { get; }
Parameters
Type | Name | Description |
---|---|---|
Key | key | The Key to check. |
Property Value
Type | Description |
---|---|
Boolean | True if key is pressed; false otherwise. |
Item[Int16]
Declaration
public readonly bool this[short code] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int16 | code | The scancode to check. |
Property Value
Type | Description |
---|---|
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 |
---|---|
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 |
---|---|---|
Object | obj | The Object to compare to. |
Returns
Type | Description |
---|---|
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 |
---|---|
Int32 | A Int32 represting the hashcode for this instance. |
Overrides
IsKeyDown(Key)
Gets a 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 |
---|---|
Boolean |
IsKeyDown(Int16)
Gets a Boolean indicating whether this scan code is down.
Declaration
public bool IsKeyDown(short code)
Parameters
Type | Name | Description |
---|---|---|
Int16 | code | The scan code to check. |
Returns
Type | Description |
---|---|
Boolean |
IsKeyUp(Key)
Gets a 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 |
---|---|
Boolean |
IsKeyUp(Int16)
Gets a Boolean indicating whether this scan code is down.
Declaration
public bool IsKeyUp(short code)
Parameters
Type | Name | Description |
---|---|---|
Int16 | code | The scan code to check. |
Returns
Type | Description |
---|---|
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 |
---|---|
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 |
---|---|
Boolean | True if both left is not equal to right; false otherwise. |