PluginManagerPrivate::PluginManagerPrivate(int argc, char **argv) : EventReceiver(LowPriority) { m_argc = argc; m_argv = argv; app_name = *argv; for (argv++, argc--; argc > 0; argv++, argc--){ args.push_back(string(*argv)); } m_base = 0; m_bLoaded = false; m_bInInit = true; QStringList pluginsList; QDir pluginDir(app_file("plugins").c_str()); #ifdef WIN32 pluginsList = pluginDir.entryList("*.dll"); #else pluginsList = pluginDir.entryList("*.so"); #endif m_bAbort = false; for (QStringList::Iterator it = pluginsList.begin(); it != pluginsList.end(); ++it){ QString f = *it; int p = f.findRev('.'); if (p > 0) f = f.left(p); pluginInfo info; info.plugin = NULL; #ifdef WIN32 info.name = strdup(QFile::encodeName(f.lower())); #else info.name = strdup(QFile::encodeName(f)); #endif info.config = NULL; info.bDisabled = false; info.bNoCreate = false; info.bFromCfg = false; info.module = NULL; info.info = NULL; info.base = 0; plugins.push_back(info); } sort(plugins.begin(), plugins.end(), cmp_plugin); for (vector<pluginInfo>::iterator itp = plugins.begin(); itp != plugins.end(); ++itp){ create((*itp)); if (m_bAbort) return; } m_bInInit = false; Event eStart(EventInit); eStart.process(); for (list<string>::iterator it_args = args.begin(); it_args != args.end(); ++it_args){ if ((*it_args).length()){ usage((*it_args).c_str()); break; } } }
void Game::start() { float dt; float prevTime = float( glfwGetTime() ); float curTime; GameEvent eStart( GameEvent::START ); dispatchEvent( eStart ); // Game loop while( !glfwWindowShouldClose( _windowPtr ) ) { // Calculate time difference from last loop iteration curTime = float( glfwGetTime() ); dt = curTime - prevTime; glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); updateMouseMovement(); _mousePos = glm::vec2( _width * 0.5, _height * 0.5 ); glfwSetCursorPos( _windowPtr, _mousePos.x, _mousePos.y ); if( _curScreen != nullptr ) { _curScreen->update( dt ); _curScreen->draw( dt ); } glfwSwapBuffers( _windowPtr ); glfwPollEvents(); // Update time for next loop iteration prevTime = curTime; } GameEvent eClose( GameEvent::CLOSE ); dispatchEvent( eClose ); }