#include <inputmanager.h>
Inherits Mutex.
Inheritance diagram for InputManager:


Public Member Functions | |
| InputManager () | |
| ~InputManager () | |
| void | addInputAcceptor (InputAcceptor &ia) |
| Add input acceptor to input acceptors list mIAVector. | |
| void | removeInputAcceptor (InputAcceptor &ia) |
| Return input acceptor from input acceptors list. | |
| void | checkSDLEvents () |
| Read input from SDL. | |
| void | processKeys () |
| Process keys stored in queue mKeys. | |
| void | keyDown (SDL_keysym keysym) |
| Proces one key. | |
| void | WantAllInput (bool wanted=true) |
| Send all input to queue for processing and none to netwok. | |
| void | setKeyReceiver (int key, InputAcceptor *receiver) |
| Set forwaring of one key to input acceptor. | |
| void | setNetAcceptor (InputAcceptor *netAcceptor) |
| Set acceptor that receive input from keyDown that nobody wants. Note that mNetAcceptor isn't locked so be sure that only one game thread is running when calling this or call this from network thread. | |
Private Member Functions | |
| InputManager (const InputManager &im) | |
| Disable copying inpit manager. | |
Private Attributes | |
| std::map< int, InputAcceptor * > | mIAVector |
| list of input wanters | |
| std::queue< SDL_keysym > | mKeys |
| InputAcceptor * | mWantedKeys_mainThread [SDLK_LAST] |
| InputAcceptor * | mWantedKeys_netThread [SDLK_LAST] |
| int | mAllInputWanters |
| Number of components that would like to ket full input. | |
| InputAcceptor * | mNetAcceptor |
Definition at line 16 of file inputmanager.h.
|
|
Definition at line 15 of file inputmanager.cpp. References mAllInputWanters, mNetAcceptor, mWantedKeys_mainThread, mWantedKeys_netThread, and TIN. |
|
|
Definition at line 30 of file inputmanager.cpp. |
|
|
Disable copying inpit manager. The InputManager shoudn't be copied. Anyway if you call this private method, the application fails. Definition at line 35 of file inputmanager.cpp. Here is the call graph for this function: ![]() |
|
|
Add input acceptor to input acceptors list mIAVector. Note that InputAcceptor doesn't need to be registered in list unless it needs to get all input at some point.
Definition at line 41 of file inputmanager.cpp. References InputAcceptor::getNice(), LOGT, mIAVector, and TIN. Referenced by Messages::init(), and Console::init(). Here is the call graph for this function: ![]() |
|
|
Read input from SDL. This may be called from separate thread. When engine is running it will be in thread togehter with network. Check against mWantedKeys_netThread and if position with key is != 0, the key is added to queue mKeys with keys waiting for processing. The key is put into queue also when mWantedAllInput is true. Definition at line 55 of file inputmanager.cpp. References Game::endFun(), getAppClient(), ApplicationClient::getGame(), keyDown(), LOGD, and TIN. Referenced by GameClient::run(). Here is the call graph for this function: ![]() |
|
|
Proces one key. If you want to process SDL events on you own and only use this for keys handlidg simply call this when you get new key. Definition at line 92 of file inputmanager.cpp. References InputAcceptor::keyDown(), Mutex::lock(), LOGD, LOGE, mAllInputWanters, mKeys, mNetAcceptor, mWantedKeys_netThread, TIN, and Mutex::unlock(). Referenced by checkSDLEvents(). Here is the call graph for this function: ![]() |
|
|
Process keys stored in queue mKeys. This should be called from engine. Check against mWantedKeys_mainThread and calls input acceptors. Definition at line 134 of file inputmanager.cpp. References InputAcceptor::keyDown(), Mutex::lock(), LOGE, LOGT, mAllInputWanters, mIAVector, mKeys, mWantedKeys_mainThread, TIN, and Mutex::unlock(). Referenced by GameClient::run(). Here is the call graph for this function: ![]() |
|
|
Return input acceptor from input acceptors list.
Definition at line 48 of file inputmanager.cpp. References InputAcceptor::getNice(), mIAVector, and TIN. Referenced by Messages::clean(), and Console::clean(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Set forwaring of one key to input acceptor. Note that the acceptor doesn't need to be rigistered by add InputAcceptor. This will cause forwarding one key to input acceptor. InputAcceptor may call this function more times to receive more keys. Note that this function should be called only when you are sure that the game is only in one thread since it modify mWantedKeys_mainThread and mWantedKeys_netThread.
Definition at line 196 of file inputmanager.cpp. References mWantedKeys_mainThread, and mWantedKeys_netThread. Referenced by Messages::clean(), Console::clean(), Messages::init(), and Console::init(). |
|
|
Set acceptor that receive input from keyDown that nobody wants. Note that mNetAcceptor isn't locked so be sure that only one game thread is running when calling this or call this from network thread.
Definition at line 203 of file inputmanager.cpp. References mNetAcceptor. |
|
|
Send all input to queue for processing and none to netwok. Component that wants all input may set this to true and then all input will go to queue. It also must be in mIAVector if it wants to get the input. mAllInputWanters will automaticly set to 0 when some key will pass all components in mIAVector and noone will want it.
Definition at line 182 of file inputmanager.cpp. References Mutex::lock(), mAllInputWanters, and Mutex::unlock(). Referenced by Messages::keyDown(), and Console::keyDown(). Here is the call graph for this function: ![]() |
|
|
Number of components that would like to ket full input.
Definition at line 134 of file inputmanager.h. Referenced by InputManager(), keyDown(), processKeys(), and WantAllInput(). |
|
|
list of input wanters
Definition at line 118 of file inputmanager.h. Referenced by addInputAcceptor(), processKeys(), and removeInputAcceptor(). |
|
|
list of pressed keys that are waiting for processing. This variable must be locked Definition at line 124 of file inputmanager.h. Referenced by keyDown(), and processKeys(). |
|
|
Definition at line 136 of file inputmanager.h. Referenced by InputManager(), keyDown(), and setNetAcceptor(). |
|
|
Definition at line 127 of file inputmanager.h. Referenced by InputManager(), processKeys(), and setKeyReceiver(). |
|
|
Definition at line 129 of file inputmanager.h. Referenced by InputManager(), keyDown(), and setKeyReceiver(). |
1.4.5