green::KeyEventMsg Class Reference

#include <LibraryMessages.h>

List of all members.

Public Member Functions

 KeyEventMsg (unsigned int key, int state)
 KeyEventMsg (MessageInstancePtr msg)
virtual ~KeyEventMsg ()
unsigned int GetKey () const
int GetState () const
virtual MessageInstancePtr Instantiate (Key msgTemplate, MessageTemplateTablePtr table)

Static Public Member Functions

static MessageTemplatePtr CreateTemplate ()

Protected Attributes

unsigned char mKey
int mState


Detailed Description

This is the KeyEventMsg class, which can be used to instantiate (and parse for debugging purposes) a KeyEvent message, which is generated by GRunApplication when a key is pressed or released. Currently, the message forms two fields, an INT_VAR representing the key pressed (ascii values for now), and another INT_VAR representing the state of the button (0 for up, 1 for down) This class also has a static member function CreateTemplate to create the template (to be added to a TemplateTable later).


Constructor & Destructor Documentation

green::KeyEventMsg::KeyEventMsg ( unsigned int  key,
int  state 
) [inline]

Must use this constructor to set the key and state for the new message. For debugging purposes, you can also use the KeyEventMsg(MessageInstancePtr) constructor to parse an existing KeyEventMsg

Parameters:
key The key that was pressed or released (ascii value)
state The state of the key (0 for released, 1 for pressed)

green::KeyEventMsg::KeyEventMsg ( MessageInstancePtr  msg  )  [inline]

Parse a MessageInstance to extract the information subclasses should provide accessor methods for that parsed information

Parameters:
msg The MessageInstance to parse

virtual green::KeyEventMsg::~KeyEventMsg (  )  [inline, virtual]

Default destructor declared virtual


Member Function Documentation

unsigned int green::KeyEventMsg::GetKey (  )  const [inline]

Get the key that was pressed or released

Returns:
The key that was pressed or released (ascii value)

int green::KeyEventMsg::GetState (  )  const [inline]

Get the state of the key

Returns:
The state of the key (0 for released, 1 for pressed)

virtual MessageInstancePtr green::KeyEventMsg::Instantiate ( Key  msgTemplate,
MessageTemplateTablePtr  table 
) [inline, virtual]

Instantiate a MessageInstance from a MessageTemplateTable.

Parameters:
msgType The MessageTemplate Key for the type of message to instantiate
table The MessageTemplateTable to instantiate from
Returns:
Returns a new MessageInstance, using set values

static MessageTemplatePtr green::KeyEventMsg::CreateTemplate (  )  [inline, static]

Create a new MessageTempalte for this kind of template


The documentation for this class was generated from the following file:
Generated on Fri Apr 27 10:27:39 2007 for Green Engine by  doxygen 1.5.1