Definition at line 13 of file Application.h.
Public Member Functions | |
Application () | |
virtual | ~Application () |
virtual const char * | getName () const |
void | init (int argc, char *argv[]) |
void | run () |
void | shutdown () |
virtual void | receiveSimple (const SimpleMsg *msg) |
Handle incoming message. | |
virtual void | receiveString (const StringMsg *msg) |
Handle incoming message. |
|
Definition at line 36 of file Application.cpp. 00037 { 00038 m_quit = false; 00039 Random::init(); 00040 Font::init(); 00041 00042 m_agents = new AgentPack(); 00043 //NOTE: MessagerAgent is added by AgentPack 00044 //NOTE: creating order is not significant, names are significant, 00045 // like rc.d scripts 00046 m_agents->addAgent(new ScriptAgent()); 00047 m_agents->addAgent(new OptionAgent()); 00048 m_agents->addAgent(new VideoAgent()); 00049 00050 m_agents->addAgent(new InputAgent()); 00051 00052 m_agents->addAgent(new SubTitleAgent()); 00053 m_agents->addAgent(new GameAgent()); 00054 00055 m_agents->addAgent(new TimerAgent()); 00056 }
|
|
Definition at line 58 of file Application.cpp. 00059 { 00060 delete m_agents; 00061 Font::shutdown(); 00062 }
|
|
Implements INamed. Definition at line 26 of file Application.h. 00026 { return Name::APP_NAME; }
|
|
Definition at line 65 of file Application.cpp. 00066 { 00067 MessagerAgent::agent()->addListener(this); 00068 m_agents->init(Name::VIDEO_NAME); 00069 prepareLogLevel(); 00070 prepareOptions(argc, argv); 00071 customizeGame(); 00072 00073 m_agents->init(Name::INPUT_NAME); 00074 addSoundAgent(); 00075 00076 m_agents->init(); 00077 }
|
|
Handle incoming message. Messages:
Reimplemented from BaseListener. Definition at line 196 of file Application.cpp. 00197 { 00198 if (msg->equalsName("quit")) { 00199 m_quit = true; 00200 } 00201 else if (msg->equalsName("inc_loglevel")) { 00202 int level = Log::getLogLevel() + 1; 00203 if (level <= Log::LEVEL_DEBUG) { 00204 OptionAgent::agent()->setParam("loglevel", level); 00205 } 00206 } 00207 else if (msg->equalsName("dec_loglevel")) { 00208 int level = Log::getLogLevel() - 1; 00209 if (level >= Log::LEVEL_ERROR) { 00210 OptionAgent::agent()->setParam("loglevel", level); 00211 } 00212 } 00213 else { 00214 LOG_WARNING(ExInfo("unknown msg") 00215 .addInfo("msg", msg->toString())); 00216 } 00217 }
|
|
Handle incoming message. Messages:
Reimplemented from BaseListener. Definition at line 225 of file Application.cpp. 00226 { 00227 if (msg->equalsName("param_changed")) { 00228 std::string param = msg->getValue(); 00229 if ("loglevel" == param) { 00230 Log::setLogLevel(OptionAgent::agent()->getAsInt("loglevel")); 00231 } 00232 } 00233 else { 00234 LOG_WARNING(ExInfo("unknown msg") 00235 .addInfo("msg", msg->toString())); 00236 } 00237 }
|
|
Definition at line 80 of file Application.cpp. 00081 { 00082 while (!m_quit) { 00083 m_agents->update(); 00084 } 00085 }
|
|
Definition at line 88 of file Application.cpp. 00089 { 00090 m_agents->shutdown(); 00091 }
|