Shift
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Pages
Shift.Input.KeyboardState Struct Reference

Holds the state of keystrokes by a keyboard. More...

Public Member Functions

bool InternalGetKey (Keys key)
 
void InternalSetKey (Keys key)
 
void InternalClearKey (Keys key)
 
void InternalClearAllKeys ()
 
 KeyboardState (Keys[] keys, bool capsLock=false, bool numLock=false)
 Initializes a new instance of the KeyboardState class. More...
 
 KeyboardState (params Keys[] keys)
 Initializes a new instance of the KeyboardState class. More...
 
bool IsKeyDown (Keys key)
 Gets whether given key is currently being pressed. More...
 
bool IsKeyUp (Keys key)
 Gets whether given key is currently being not pressed. More...
 
Keys[] GetPressedKeys ()
 Returns an array of values holding keys that are currently being pressed. More...
 
override int GetHashCode ()
 Gets the hash code for KeyboardState instance. More...
 
override bool Equals (object obj)
 Compares whether current instance is equal to specified object. More...
 

Static Public Member Functions

static bool operator== (KeyboardState a, KeyboardState b)
 Compares whether two KeyboardState instances are equal. More...
 
static bool operator!= (KeyboardState a, KeyboardState b)
 Compares whether two KeyboardState instances are not equal. More...
 

Public Attributes

uint keys0
 
uint keys1
 
uint keys2
 
uint keys3
 
uint keys4
 
uint keys5
 
uint keys6
 
uint keys7
 

Static Public Attributes

static Keys[] empty = new Keys[0]
 

Properties

bool CapsLock [get, set]
 Gets the current state of the Caps Lock key. More...
 
bool NumLock [get, set]
 Gets the current state of the Num Lock key. More...
 
KeyState this[Keys key] [get]
 Returns the state of a specified key. More...
 

Detailed Description

Holds the state of keystrokes by a keyboard.

Definition at line 9 of file KeyboardState.cs.

Constructor & Destructor Documentation

Shift.Input.KeyboardState.KeyboardState ( Keys[]  keys,
bool  capsLock = false,
bool  numLock = false 
)
inline

Initializes a new instance of the KeyboardState class.

Parameters
keysList of keys to be flagged as pressed on initialization.
capsLockCaps Lock state.
numLockNum Lock state.

Definition at line 117 of file KeyboardState.cs.

Shift.Input.KeyboardState.KeyboardState ( params Keys[]  keys)
inline

Initializes a new instance of the KeyboardState class.

Parameters
keysList of keys to be flagged as pressed on initialization.

Definition at line 140 of file KeyboardState.cs.

Member Function Documentation

override bool Shift.Input.KeyboardState.Equals ( object  obj)
inline

Compares whether current instance is equal to specified object.

Parameters
objThe KeyboardState to compare.
Returns
true if the provided KeyboardState instance is same with current; false otherwise.

Definition at line 276 of file KeyboardState.cs.

override int Shift.Input.KeyboardState.GetHashCode ( )
inline

Gets the hash code for KeyboardState instance.

Returns
Hash code of the object.

Definition at line 237 of file KeyboardState.cs.

Keys [] Shift.Input.KeyboardState.GetPressedKeys ( )
inline

Returns an array of values holding keys that are currently being pressed.

Returns
The keys that are currently being pressed.

Definition at line 212 of file KeyboardState.cs.

void Shift.Input.KeyboardState.InternalClearAllKeys ( )
inline

Definition at line 70 of file KeyboardState.cs.

void Shift.Input.KeyboardState.InternalClearKey ( Keys  key)
inline

Definition at line 54 of file KeyboardState.cs.

bool Shift.Input.KeyboardState.InternalGetKey ( Keys  key)
inline

Definition at line 17 of file KeyboardState.cs.

void Shift.Input.KeyboardState.InternalSetKey ( Keys  key)
inline

Definition at line 38 of file KeyboardState.cs.

bool Shift.Input.KeyboardState.IsKeyDown ( Keys  key)
inline

Gets whether given key is currently being pressed.

Parameters
keyThe key to query.
Returns
true if the key is pressed; false otherwise.

Definition at line 174 of file KeyboardState.cs.

bool Shift.Input.KeyboardState.IsKeyUp ( Keys  key)
inline

Gets whether given key is currently being not pressed.

Parameters
keyThe key to query.
Returns
true if the key is not pressed; false otherwise.

Definition at line 184 of file KeyboardState.cs.

static bool Shift.Input.KeyboardState.operator!= ( KeyboardState  a,
KeyboardState  b 
)
inlinestatic

Compares whether two KeyboardState instances are not equal.

Parameters
aKeyboardState instance to the left of the inequality operator.
bKeyboardState instance to the right of the inequality operator.
Returns
true if the instances are different; false otherwise.

Definition at line 266 of file KeyboardState.cs.

static bool Shift.Input.KeyboardState.operator== ( KeyboardState  a,
KeyboardState  b 
)
inlinestatic

Compares whether two KeyboardState instances are equal.

Parameters
aKeyboardState instance to the left of the equality operator.
bKeyboardState instance to the right of the equality operator.
Returns
true if the instances are equal; false otherwise.

Definition at line 248 of file KeyboardState.cs.

Member Data Documentation

Keys [] Shift.Input.KeyboardState.empty = new Keys[0]
static

Definition at line 12 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys0

Definition at line 15 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys1

Definition at line 15 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys2

Definition at line 15 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys3

Definition at line 15 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys4

Definition at line 15 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys5

Definition at line 15 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys6

Definition at line 15 of file KeyboardState.cs.

uint Shift.Input.KeyboardState.keys7

Definition at line 15 of file KeyboardState.cs.

Property Documentation

bool Shift.Input.KeyboardState.CapsLock
getset

Gets the current state of the Caps Lock key.

Definition at line 85 of file KeyboardState.cs.

bool Shift.Input.KeyboardState.NumLock
getset

Gets the current state of the Num Lock key.

Definition at line 90 of file KeyboardState.cs.

KeyState Shift.Input.KeyboardState.this[Keys key]
get

Returns the state of a specified key.

Parameters
keyThe key to query.
Returns
The state of the key.

Definition at line 165 of file KeyboardState.cs.


The documentation for this struct was generated from the following file: