C#Code
C#Code
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
Libraries.Messaging.KeyboardInputMessageHandler Class Reference
Inheritance diagram for Libraries.Messaging.KeyboardInputMessageHandler:
Libraries.Messaging.BaseMessageHandler Libraries.Messaging.BaseMessageHandler Libraries.BaseObject Libraries.BaseObject

List of all members.

Public Types

enum  KeyboardKeyState { PRESSED = 0, HELD, RELEASED, NONE }

Public Member Functions

 KeyboardInputMessageHandler ()
void AddKeyStateCheck (Keys key, Input.ButtonState state)
void AddKeyStateCheck (Keys key, bool onPress, bool onRelease, bool onHeld, bool onNone)
void RemoveKeyStateCheck (Keys key, Input.ButtonState state)
void RemoveKeyStateChecks (Keys key)
void RemoveAllChecks ()
override void Update (int timePassed)
Input.ButtonState GetState (Keys key)
 KeyboardInputMessageHandler ()
void AddKeyStateCheck (Keys key, KeyboardKeyState state)
void AddKeyStateCheck (Keys key, bool onPress, bool onRelease, bool onHeld, bool onNone)
void RemoveKeyStateCheck (Keys key, KeyboardKeyState state)
void RemoveKeyStateChecks (Keys key)
void RemoveAllChecks ()
override void Update (int timePassed)

Protected Member Functions

int FindKeyEvent (Keys key, Input.ButtonState state)
int FindKeyState (Keys key)

Protected Attributes

List< KeyboardInputMessagem_keyChecks
 Key states to check for.
List< KeyboardInputMessagem_keyStates
 Last known state (HELD or NONE) for each key being checked.

Private Member Functions

void RemoveKeyCurrentState (Keys key)
void RemoveKeyCurrentState (Keys key)
int FindKeyEvent (Keys key, KeyboardKeyState state)
int FindKeyState (Keys key)

Detailed Description

Message handler for input events. Checks for input and creates messages that the input occured. Input should never be directly checked by anything else. Anybody that needs to know about input can check the handler.


Member Enumeration Documentation

Represents a keyboard key state.

Enumerator:
PRESSED 
HELD 

Key was pressed.

RELEASED 

Key is held.

NONE 

Key is released.

Key is up (default state). Must be last in the list. Add other enums before this.


Constructor & Destructor Documentation

Libraries.Messaging.KeyboardInputMessageHandler.KeyboardInputMessageHandler ( )

Default constructor.

Libraries.Messaging.KeyboardInputMessageHandler.KeyboardInputMessageHandler ( )

Default constructor.


Member Function Documentation

void Libraries.Messaging.KeyboardInputMessageHandler.AddKeyStateCheck ( Keys  key,
Input.ButtonState  state 
)

Add a check for the given key and the corresponding state. If a check already exists then nothing happens.

key - Key to check for.
state - State to check for.
void Libraries.Messaging.KeyboardInputMessageHandler.AddKeyStateCheck ( Keys  key,
bool  onPress,
bool  onRelease,
bool  onHeld,
bool  onNone 
)

Add a check for the given key and the corresponding states. If a check already exists then nothing happens. This is for convenience so you can set all the states at one. This does not remove states if you pass fall for anything.

key - Key to check for.
onPress - True if it should check for the on press event, false if not.
onRelease - True if it should check for the on release event, false if not.
onHeld - True if it should check for the key being held event, false if not.
onNone - True if a message should occur if the key is not held or pressed.
void Libraries.Messaging.KeyboardInputMessageHandler.AddKeyStateCheck ( Keys  key,
KeyboardKeyState  state 
)

Add a check for the given key and the corresponding state. If a check already exists then nothing happens.

key - Key to check for.
state - State to check for.
void Libraries.Messaging.KeyboardInputMessageHandler.AddKeyStateCheck ( Keys  key,
bool  onPress,
bool  onRelease,
bool  onHeld,
bool  onNone 
)

Add a check for the given key and the corresponding states. It a check already exists then nothing happens. This is for convenience so you can set all the states at one. This does not remove states if you pass fall for anything.

key - Key to check for.
onPress - True if it should check for the on press event, false if not.
onRelease - True if it should check for the on release event, false if not.
onHeld - True if it should check for the key being held event, false if not.
onNone - True if a message should occur if the key is not held or pressed.
int Libraries.Messaging.KeyboardInputMessageHandler.FindKeyEvent ( Keys  key,
Input.ButtonState  state 
) [protected]

Searchs the list of key events to check for and finds where the given event is located.

key - Key to check for.
state - State to check for.

Return:
Value is the index in the list the matching event is at. It is -1 if not found.
int Libraries.Messaging.KeyboardInputMessageHandler.FindKeyEvent ( Keys  key,
KeyboardKeyState  state 
) [private]

Searchs the list of key events to check for and finds where the given event is located.

key - Key to check for.
state - State to check for.

Return:
Value is the index in the list the matching event is at. It is -1 if not found.
int Libraries.Messaging.KeyboardInputMessageHandler.FindKeyState ( Keys  key) [protected]

Searchs the list of key events to check for and finds where the given key state is located.

key - Key to check for.

Return:
Value is the index in the list the matching state is at. It is -1 if not found.
int Libraries.Messaging.KeyboardInputMessageHandler.FindKeyState ( Keys  key) [private]

Searchs the list of key events to check for and finds where the given key state is located.

key - Key to check for.

Return:
Value is the index in the list the matching state is at. It is -1 if not found.
Input.ButtonState Libraries.Messaging.KeyboardInputMessageHandler.GetState ( Keys  key)

Searchs the last known key stats for the given key and finds what the state was.

key - Key to check for.

Return:
Value is the last known state.
void Libraries.Messaging.KeyboardInputMessageHandler.RemoveAllChecks ( )

Remove all keyboard checks and states.

void Libraries.Messaging.KeyboardInputMessageHandler.RemoveAllChecks ( )

Remove all keyboard checks and states.

void Libraries.Messaging.KeyboardInputMessageHandler.RemoveKeyCurrentState ( Keys  key) [private]

Removes the stored current state for the given key. Use when all events for the key are removed.

key - Key whose state we no longer need to store.
void Libraries.Messaging.KeyboardInputMessageHandler.RemoveKeyCurrentState ( Keys  key) [private]

Removes the stored current state for the given key. Use when all events for the key are removed.

key - Key whose state we no longer need to store.
void Libraries.Messaging.KeyboardInputMessageHandler.RemoveKeyStateCheck ( Keys  key,
KeyboardKeyState  state 
)

Remove a check for the given key and the corresponding state.

key - Key to check for.
state - State to check for.
void Libraries.Messaging.KeyboardInputMessageHandler.RemoveKeyStateCheck ( Keys  key,
Input.ButtonState  state 
)

Remove a check for the given key and the corresponding state.

key - Key to check for.
state - State to check for.
void Libraries.Messaging.KeyboardInputMessageHandler.RemoveKeyStateChecks ( Keys  key)

Remove all checks for the given key.

key - Key to check for.
void Libraries.Messaging.KeyboardInputMessageHandler.RemoveKeyStateChecks ( Keys  key)

Remove all checks for the given key.

key - Key to check for.
override void Libraries.Messaging.KeyboardInputMessageHandler.Update ( int  timePassed) [virtual]

Check for key events.

timePassed - Time passed for the update to handle.

Reimplemented from Libraries.Messaging.BaseMessageHandler.

override void Libraries.Messaging.KeyboardInputMessageHandler.Update ( int  timePassed) [virtual]

Check for key events.

timePassed - Time passed for the update to handle. Value is in milliseconds.

Reimplemented from Libraries.Messaging.BaseMessageHandler.


Member Data Documentation

Key states to check for.

Last known state (HELD or NONE) for each key being checked.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Properties