Definition at line 16 of file InputAgent.h.
Public Member Functions | |
void | installHandler (InputHandler *handler) |
KeyBinder * | keyBinder () |
Protected Member Functions | |
virtual void | own_init () |
Enable SDL_UNICODE. | |
virtual void | own_update () |
virtual void | own_shutdown () |
Delete console. |
|
Definition at line 87 of file InputAgent.cpp. 00088 { 00089 if (m_handler) { 00090 m_handler->takePressed(NULL); 00091 m_handler->mouseState(V2(-1, -1), 0); 00092 } 00093 m_handler = handler; 00094 if (m_handler) { 00095 m_handler->takePressed(m_keys); 00096 Uint8 buttons; 00097 V2 mouseLoc = getMouseState(&buttons); 00098 m_handler->mouseState(mouseLoc, buttons); 00099 } 00100 }
|
|
Definition at line 31 of file InputAgent.h. 00031 { return m_keyBinder; }
|
|
Enable SDL_UNICODE. Enable key repeat. Set console handler to ScriptAgent. NOTE: every SDL_InitSubSystem will disable UNICODE hence InputAgent init must be after VideoAgent and SoundAgent. NOTE: KeyConsole() use Path which asks OptionAgent Reimplemented from BaseAgent. Definition at line 33 of file InputAgent.cpp. 00034 { 00035 m_keyBinder = new KeyBinder(); 00036 m_handler = NULL; 00037 m_keys = SDL_GetKeyState(NULL); 00038 00039 SDL_EnableUNICODE(1); 00040 }
|
|
Delete console.
Reimplemented from BaseAgent. Definition at line 81 of file InputAgent.cpp. 00082 {
00083 delete m_keyBinder;
00084 }
|
|
Reimplemented from BaseAgent. Definition at line 43 of file InputAgent.cpp. 00044 { 00045 SDL_Event event; 00046 while (SDL_PollEvent(&event)) { 00047 switch (event.type) { 00048 case SDL_QUIT: 00049 { 00050 BaseMsg *msg = new SimpleMsg(Name::APP_NAME, "quit"); 00051 MessagerAgent::agent()->forwardNewMsg(msg); 00052 break; 00053 } 00054 case SDL_KEYDOWN: 00055 m_keyBinder->keyDown(event.key.keysym); 00056 if (m_handler) { 00057 m_handler->keyEvent(KeyStroke(event.key.keysym)); 00058 } 00059 break; 00060 case SDL_MOUSEBUTTONDOWN: 00061 if (m_handler) { 00062 m_handler->mouseEvent(MouseStroke(event.button)); 00063 } 00064 break; 00065 default: 00066 break; 00067 } 00068 } 00069 00070 if (m_handler) { 00071 Uint8 buttons; 00072 V2 mouseLoc = getMouseState(&buttons); 00073 m_handler->mouseState(mouseLoc, buttons); 00074 } 00075 }
|