NLMISC::CEventListenerAsync Class Reference

CEventListenerAsync. More...

#include <event_listener.h>

Inherits NLMISC::IEventListener.

List of all members.

Public Member Functions

 CEventListenerAsync ()
 Constructor.
virtual ~CEventListenerAsync ()
void addToServer (CEventServer &server)
 Register the listener to the server.
void removeFromServer (CEventServer &server)
 Unregister the listener to the server.
bool isKeyDown (TKey key) const
 Get a key down instant state.
bool isKeyPushed (TKey key, bool release=true)
 Get if a the state of key has pushed since the last call of isKeyPushed with release=true.
void reset ()
 Clear all the Down states to false.

Protected Member Functions

virtual void operator() (const CEvent &event)
 Call back of the listener.

Protected Attributes

CBitSet _KeyArray
CBitSet _KeyDownArray
CBitSet _KeyReleaseArray

Detailed Description

CEventListenerAsync.

Author:
Stephane Coutelas
Nevrax France
Date:
2000

Definition at line 87 of file event_listener.h.


Constructor & Destructor Documentation

NLMISC::CEventListenerAsync::CEventListenerAsync (  ) 

Constructor.

Definition at line 48 of file event_listener.cpp.

References _KeyArray, _KeyDownArray, _KeyReleaseArray, NLMISC::KeyCount, reset(), and NLMISC::CBitSet::resize().

virtual NLMISC::CEventListenerAsync::~CEventListenerAsync (  )  [inline, virtual]

Definition at line 93 of file event_listener.h.


Member Function Documentation

void NLMISC::CEventListenerAsync::addToServer ( CEventServer server  ) 
bool NLMISC::CEventListenerAsync::isKeyDown ( TKey  key  )  const

Get a key down instant state.

Parameters:
key is the key to check.

Definition at line 70 of file event_listener.cpp.

References _KeyArray, and NLMISC::CBitSet::get().

Referenced by NL3D::CEvent3dMouseListener::getViewMatrix().

bool NLMISC::CEventListenerAsync::isKeyPushed ( TKey  key,
bool  release = true 
)

Get if a the state of key has pushed since the last call of isKeyPushed with release=true.

Parameters:
key is the key to check.
release if true, the pushed state of the key is released (force to be false). It will return to true next time only if key is released and then re-pushed.
See also:
reset()

Definition at line 76 of file event_listener.cpp.

References _KeyDownArray, _KeyReleaseArray, NLMISC::CBitSet::get(), and NLMISC::CBitSet::set().

Referenced by NL3D::CNELU::screenshot().

void NLMISC::CEventListenerAsync::operator() ( const CEvent event  )  [protected, virtual]
void NLMISC::CEventListenerAsync::removeFromServer ( CEventServer server  ) 
void NLMISC::CEventListenerAsync::reset (  ) 

Clear all the Down states to false.

Useful sometimes when you don't bother what has been pushed before. e.g.: your app listen/test to the key 'A' and 'B' for a certain long period. Then, it test 'C' and 'D' later. If the user has pressed (by mistake) the key 'C' during the first period, this API has record it, and then, at the second period, isKeyDown(KeyC) will return true the first time the key is tested, unless if you do a reset() at the beggining of the second period. Clear all the pushed states to false too.

See also:
isKeyDown()

Definition at line 193 of file event_listener.cpp.

References _KeyArray, _KeyDownArray, _KeyReleaseArray, and NLMISC::CBitSet::clearAll().

Referenced by CEventListenerAsync(), NL3D::CNELU::initEventServer(), and NL3D::CDriverUser::setDisplay().


Member Data Documentation

Definition at line 139 of file event_listener.h.

Referenced by CEventListenerAsync(), isKeyDown(), operator()(), and reset().

Definition at line 141 of file event_listener.h.

Referenced by CEventListenerAsync(), isKeyPushed(), operator()(), and reset().

Definition at line 141 of file event_listener.h.

Referenced by CEventListenerAsync(), isKeyPushed(), operator()(), and reset().


The documentation for this class was generated from the following files:

Generated on Thu Jan 7 08:30:17 2010 for NeL by  doxygen 1.6.1