#include <event_listener.h>
Inherits NLMISC::IEventListener.
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 |
Definition at line 87 of file event_listener.h.
| 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.
| void NLMISC::CEventListenerAsync::addToServer | ( | CEventServer & | server | ) |
Register the listener to the server.
Definition at line 56 of file event_listener.cpp.
References NLMISC::CEventServer::addListener(), NLMISC::EventKeyDownId(), NLMISC::EventKeyUpId(), and NLMISC::EventSetFocusId().
Referenced by NL3D::CEvent3dMouseListener::addToServer(), CEGUI::NeLRenderer::NeLInputDriver::addToServer(), NL3D::CNELU::initEventServer(), and NL3D::CDriverUser::setDisplay().
Get a key down instant state.
| 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().
Get if a the state of key has pushed since the last call of isKeyPushed with release=true.
| 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. |
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] |
Call back of the listener.
| event | is the event send to the listener |
Implements NLMISC::IEventListener.
Definition at line 87 of file event_listener.cpp.
References _KeyArray, _KeyDownArray, _KeyReleaseArray, NLMISC::CBitSet::clear(), NLMISC::CBitSet::clearAll(), NLMISC::EventKeyDownId(), NLMISC::EventKeyUpId(), NLMISC::EventSetFocusId(), NLMISC::CEventSetFocus::Get, NLMISC::CBitSet::get(), NLMISC::CEventKeyUp::Key, NLMISC::CEventKeyDown::Key, NLMISC::KeyCONTROL, NLMISC::KeyLCONTROL, NLMISC::KeyLMENU, NLMISC::KeyLSHIFT, NLMISC::KeyMENU, NLMISC::KeyRCONTROL, NLMISC::KeyRMENU, NLMISC::KeyRSHIFT, NLMISC::KeySHIFT, and NLMISC::CBitSet::set().
| void NLMISC::CEventListenerAsync::removeFromServer | ( | CEventServer & | server | ) |
Unregister the listener to the server.
Definition at line 63 of file event_listener.cpp.
References NLMISC::EventKeyDownId(), NLMISC::EventKeyUpId(), NLMISC::EventSetFocusId(), and NLMISC::CEventServer::removeListener().
Referenced by NL3D::CDriverUser::release(), NL3D::CNELU::releaseEventServer(), NL3D::CEvent3dMouseListener::removeFromServer(), and CEGUI::NeLRenderer::NeLInputDriver::removeFromServer().
| 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.
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().
CBitSet NLMISC::CEventListenerAsync::_KeyArray [protected] |
Definition at line 139 of file event_listener.h.
Referenced by CEventListenerAsync(), isKeyDown(), operator()(), and reset().
CBitSet NLMISC::CEventListenerAsync::_KeyDownArray [protected] |
Definition at line 141 of file event_listener.h.
Referenced by CEventListenerAsync(), isKeyPushed(), operator()(), and reset().
CBitSet NLMISC::CEventListenerAsync::_KeyReleaseArray [protected] |
Definition at line 141 of file event_listener.h.
Referenced by CEventListenerAsync(), isKeyPushed(), operator()(), and reset().
1.6.1