LinkHistoryCommand::LinkHistoryCommand(LinkHistoryCommandParams* pParams) : IComando(pParams) { GTRACE(">> ComandoCarga::ComandoCarga(): " << this); m_pLinkParams = pParams; SetId(IDC_INCLUIR); GTRACE("<< ComandoCarga::ComandoCarga(): " << this); }
bool GLoaderState::handleLogicThreadLoop() { if( loadingWasDone ) { GTRACE (4, "Loading was done; at next tick, the state will switch to menu"); GBaseStateManager::getPtr()->setStateNextTick("menu"); return true; } #if LOAD_RESOURCES_IN_LOGIC_THREAD // handle some pre-rendering actions if( guiWasRenderedOnce && !loadingWasDone ) { GTRACE(4, "L\tloading res."); if( engine ) engine->loadResources(); GTRACE(4, "L\tloaded res."); // Load the GUI if( engine ) engine->loadSounds(); GTRACE(4, "L\tloaded sounds."); if( engine ) engine->loadOverlays(); GTRACE(4, "L\tloaded overlays."); loadingWasDone = true; } #endif return true; }
bool Configuration::load(const std::string & fileName) { bool result(false); GTRACE(3, "Configuration - loading from " << fileName); std::string fileExtension = stringutil::GetExtensionFromFileName(fileName); // E.g. "ini"; // Use the loader based on the extension. impl_->loader_ptr_.reset(config::LoaderFactory::getPtr()->CreateObject(fileExtension)); //impl_->loader_ptr_ = config::LoaderFactory::getPtr()->CreateObject(fileExtension); if (!impl_->loader_ptr_) { // No loader for this extension! std::string exception_message("Data cannot be loaded using this extension: \""); exception_message.append(fileExtension); exception_message.append("\". No factory detected"); throw guslib::SimpleException(exception_message.c_str()); } result = impl_->loader_ptr_->load(*this, fileName); GTRACE(5, "Configuration - DONE loading from " << fileName); return result; }
BonusBase * VisualBonusManager::createBonusFromPrototype( const BonusPrototypeBase * prototype ) { GTRACE(4, "VisualBonusManager::createBonusFromPrototype"); if( prototype == NULL ) return NULL; if( !engine ) { GTRACE(1, "ERROR! NULL engine for bonus manager (createBonusFromPrototype)!"); return NULL; } GTRACE(5, "creating new bonus..."); GTRACE(4, "VisualBonusManager proto="<<prototype->getType()); VisualBonus * vibonus = new VisualBonus( this->sceneManager, prototype ); VisualBonusPrototype * viProto = (VisualBonusPrototype *) vibonus->getLinkToPrototype(); vibonus->requestLoading( viProto->getMeshName(), viProto->getMaterialName(), viProto->getStencilMaterialName(), viProto->getRenderGroup(), viProto->getStencilGroup()); vibonus->setAnimRotationVector( viProto->getAnimRotationVector() ); vibonus->setMasterTranslationVector( viProto->getMasterTranslationVector() ); vibonus->setRotationVector( viProto->getRotationVector() ); vibonus->setScalingVector( viProto->getScalingVector() ); vibonus->setTranslationVector( viProto->getTranslationVector() ); GTRACE(4, "VisualBonusManager returning created bonus."); return vibonus; }
void GBaseEngine::loadResources() { #if LOAD_RESOURCES_IN_LOGIC_THREAD #else for (int i = 1; i < 5000 && rendering_; i += 25) { guslib::sleep (25); } #endif loadingRes_ = true; std::vector<std::string> resList = GBaseAppSettings::getPtr ()->setting.res.resources; try { GTRACE(3, "..:: Adding General resource location list ::.."); GBaseMainApp::addResourceLocationList( resList, "General" ); GTRACE(3, "..:: Creating General resource folder list ::.."); ResourceGroupManager::getSingleton().initialiseResourceGroup("General"); ResourceGroupManager::getSingleton().loadResourceGroup("General"); GTRACE(3, "Initialized and loaded General res group"); } catch( Exception & e ) { GTRACE (1, "EXCEPTION: " << e.what ()); } loadingRes_ = false; // TODO: add a listener and a progress bar for the resources. // Repeat for the level load as well, and make sure each mesh is displayed once (behind a fully opaque 2D Gui) //ResourceGroupListener * myListener; }
void GBaseEngine::showLoadingScreen( bool loading ) { guslib::GScopedLock myLock( loadingCmdWriteMutex ); GTRACE(3, "Engine::" << (loading? "showing": "hiding")<<" loading screen."); try { if( loaderOverlay ) { if( loading ) { loaderOverlay->show(); } else { loaderOverlay->hide(); } } else { GTRACE(1, "NULL Overlay!"); } } catch( ... ) { GTRACE(1, "ERROR showing/hiding loading screen!"); } }
void GResourceManagerUtil::doLoadRequest( GOgreRenderable * res ) { if( !res ) return; GTRACE(5, "Requesting resource load... "<<res->getMeshName()<<", "<<res->getMaterialName()); resToLoad.push_back( res ); GTRACE(4, "Requested resource load..."); }
ThumbnailsCommand::ThumbnailsCommand(long file_pk, ThumbnailsNotifier* pNotificador) : IComando(NULL, "GenerarThumbnails") { m_Error = false; GTRACE(">> ThumbnailsCommand::ThumbnailsCommand(): " << this); m_pThumbParams = new ThumbnailsCommandParams(file_pk, pNotificador); m_pParams = m_pThumbParams; SetId(IDC_GENERAR_THUMBNAILS); EsperaA(IDC_GENERAR_THUMBNAILS); EsperaA(IDC_CARGA); GTRACE("<< ThumbnailsCommand::ThumbnailsCommand(): " << this); }
void GBaseEngine::shutDown() { guslib::GScopedLock myLock( exitCmdWriteMutex ); GTRACE(3, "engine received cmd to shutdown"); GTRACE(4, "forwarding cmd to state mgr"); GBaseStateManager::getPtr()->setShutdown(); exitCmdReceived = true; //TODO:XXX: consider the possibility of having to remove the resource groups. //Note that if you try to remove the groups during rendering, the application may freeze. //(this side effect occured randomly while deleting the General group) }
void Configuration::save() { if (nullptr == impl_->loader_ptr_) { GTRACE(3, "Tried to save configuration, but no loader is available"); return; } GTRACE(5, "Configuration - saving"); impl_->loader_ptr_->save(*this); }
void Configuration::saveAs(const std::string& fileName) { if (nullptr == impl_->loader_ptr_) { GTRACE(3, "Tried to save configuration, but no loader is available"); return; } GTRACE(5, "Configuration - saving as..."); impl_->loader_ptr_->save(*this, fileName); }
// This will be called from renderCompleteScene (via fireframe events) bool GBaseEngine::renderScene() { if (loadingRes_) { GTRACE(5, "GBaseEngine: render scene skipping because loading res."); return true; } rendering_ = true; GTRACE(5, "GBaseEngine: render scene entered"); //GBaseStateManager::getPtr()->renderScene(); rendering_ = false; return true; }
void GResourceManagerUtil::processUnloadRequests() { GTRACE(6, "processUnloadRequests getting mutex (loadingMutex)"); guslib::GScopedLock myLock(loadingMutex); GTRACE(5, "Processing unload requests..."); for( std::vector<GOgreRenderable*>::iterator it = resToUnload.begin(); it != resToUnload.end(); ++it ) { (*it)->unload(); delete *it; } resToUnload.clear(); GTRACE(5, "Processed unload requests..."); }
GBaseEngine::~GBaseEngine() { GTRACE(3, "GBaseEngine destructor entered."); #if 0 if( frameListener ) { GTRACE(4, "GBaseEngine releasing self from framelistener"); frameListener->releaseEngine(); // The frame listener is not owned by the engine GTRACE(4, "GBaseEngine released connection to frameListener"); releaseFrameListener(); } #endif GTRACE(3, "GBaseEngine destructor exiting."); }
void GBaseEngine::loadOverlays() { GTRACE(4, "GBaseEngine loading Overlays..."); GTRACE(5, "GBaseEngine: loadOverlays getting lock (loadAndRenderMutex)"); guslib::GScopedLock myLock( loadAndRenderMutex ); GTRACE(5, "GBaseEngine: loadOverlays got mutex (loadAndRenderMutex)"); overlay = OverlayManager::getSingletonPtr()->getByName(c_mainMenuOverlay); //Post init - hide templates and copy them. //overlay->show(); //std::string gsCopyrightNotice = std::string( GUS_COPYRIGHT_NOTICE ) + std::string( GUS_APP_VERSION ); //OverlayManager::getSingleton().getOverlayElement("GS/TAMenuCredits")-> // setCaption(gsCopyrightNotice); //overlay->hide(); }
bool SerpEngine::keyPressed(const OIS::KeyEvent &arg) { if (isExiting()) { return true; } if (arg.key == OIS::KC_ESCAPE) { // TODO: add exit! shutDown(); } // key down utils::CEGUIHelperUtil::injectKeyDown(arg.key); // now character utils::CEGUIHelperUtil::injectChar(arg.text); GTRACE(5, "keyPressed, " << arg.key << " thread : " << boost::this_thread::get_id()); // TODO: this limits the possibilities of subclasses a lot; should consider sending the full event. stateManager_.reactToKeyPress(arg.key); return true; }
void GNC::GCS::ControladorVistas::Destruir(wxWindow* pVentana) { if (pVentana) pVentana->Hide(); //resets inactivity GNC::GCS::InactivityController::Instance()->ResetsInactivity(); // Lock(); GTRACE("ControladorVistas::DestruirVista(wxWindow* pVentana = " << pVentana << ")"); if (pVentana != NULL) { MapaVentanas::iterator it = m_MapaVentanas.find(pVentana); if (it != m_MapaVentanas.end()) { GNC::GCS::IVista* pVista = (*it).second; m_MapaVentanas.erase(it); PropagarVistaDestruida(pVista); } else { //LOG_WARN("Core/ControladorVistas", "Error al destruir ventana: La ventana no estaba registrada. Posible inconsistencia interna"); } } UnLock(); }
void GLoaderState::exit() { // Everything required for the next stage should be loaded; // clear the "Loading..." screen. if( engine ) engine->showLoadingScreen(false); GTRACE(4, "cleared loading screen."); }
void VisualBonus::setLocation( DFLOAT x, DFLOAT y ) { GTRACE(5, "VisualBonus_settingloc"); BonusBase::setLocation(x,y); translationVector.x = x; translationVector.z = y; }
// // Copy constructor. // Impl(const Impl& rhs) : loader_ptr_(rhs.loader_ptr_) , defaultGroup_(rhs.defaultGroup_) , groups_(rhs.groups_) { GTRACE(7, "Config-Internal COPY CTOR"); }
// // Constructor. // Impl() : loader_ptr_(nullptr) , defaultGroup_("general") , groups_(std::map <std::string, PropertyGroup>()) { GTRACE(7, "Config-Internal CTOR"); }
bool GBaseEngine::renderCompleteScene() { // This is basically a copy of the standard OGRE root function "renderOneFrame". // What it does in addition to the aforementioned function is to add a mutex lock for // loading and rendering operations. // The function should be called from the rendering thread! if( ! frameListener ) { return false; } guslib::Timer myTimer; myTimer.reset(); GTRACE(5, "Engine: render complete scene() entered."); GTRACE(6, "GBaseEngine::renderCompleteScene() getting mutex(loadAndRenderMutex)"); guslib::GScopedLock myLock( loadAndRenderMutex ); GTRACE(6, "GBaseEngine::renderCompleteScene() got mutex(loadAndRenderMutex)"); if( isExiting() ) return false; // Trigger the FrameListener's "frameStarted" function to render the 3D scene. if(!root->_fireFrameStarted()) { GTRACE(1, "GBaseEngine::renderCompleteScene received error from _fireFrameStarted"); return false; } if( isExiting() ) return false; try { if( ! root->_updateAllRenderTargets() ) { GTRACE(1, "GBaseEngine::renderCompleteScene received error from _updateAllRenderTargets"); return false; } } catch( Exception & e ) { GTRACE(1, "Exception caught! GBaseEngine::renderCompleteScene(): "<<e.getFullDescription()); } if( isExiting() ) return false; // Trigger the FrameListener's "frameEnded" function. bool returnValue = root->_fireFrameEnded(); GTRACE(5, "Engine: render complete scene() exiting. Render took: "<< myTimer.elapsed()<< " time units."); GTRACE(6, "GBaseEngine::renderCompleteScene() releasing mutex(loadAndRenderMutex)"); return returnValue; }
bool SerpEngine::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) { GTRACE(4, "SerpEngine: pressed mouse button"); utils::CEGUIHelperUtil::injectMouseButtonDown(id); // TODO: this limits the possibilities of subclasses a lot; should consider sending the full event. stateManager_.reactToMousePressed(id, e.state.X.abs, e.state.Y.abs); return true; }
void SerpEngine::shutDown() { GTRACE(3, "SerpEngine: received cmd to shutdown"); stateManager_.setShutdown(); exiting_ = true; // TODO(Augustin Preda, 2014.06.01): consider the possibility of having to remove the resource groups. // Note that if you try to remove the groups during rendering, the application may freeze. // (this side effect occured randomly while deleting the General group) }
void GResourceManagerUtil::doLoadCancelRequest( GOgreRenderable * res ) { GTRACE(5, "Cancelling load request..."); if( !res ) { GTRACE(2, "WARNING: tried to cancel request for NULL ptr!"); return; } for( std::vector<GOgreRenderable *>::iterator it = resToLoad.begin(); it != resToLoad.end(); ++it ) { if( (*it) == res ) { resToLoad.erase( it ); GTRACE(4, "Cancelled load request."); return; } } GTRACE(4, "No match found to cancel load request."); }
/** Constructor. */ SerpEngine::SerpEngine(Ogre::SceneManager * aManager, Ogre::Root * rootElement) : exiting_(false), rootPtr_(rootElement), sceneManagerPtr_(aManager), shadingHelperPtr_(new Serpents::ShadingHelper()), frameListenerPtr_(0), cameraPtr_(0), cameraSecPtr_(0) { GTRACE(3, "SerpEngine created."); }
// This will be called from renderCompleteScene (via fireframe events) bool GBaseEngine::renderOverlay() { if (loadingRes_) { GTRACE(5, "GBaseEngine: render Overlay skipping because loading res."); return true; } rendering_ = true; GTRACE(5, "GBaseEngine: render overlay entered"); if( frameListener == NULL ) { rendering_ = false; return false; } GTRACE(5, "GBaseEngine: calling state gui render."); GBaseStateManager::getPtr()->renderGUI(); rendering_ = false; return true; }
void SerpEngine::setFrameListener(SerpFrameListener * ptr) { GTRACE(3, "SerpEngine: received frame listener"); if (frameListenerPtr_) { // there is a listener already; replacement required rootPtr_->removeFrameListener(frameListenerPtr_); } frameListenerPtr_ = ptr; rootPtr_->addFrameListener(frameListenerPtr_); }
bool GBaseEngine::loadBootResources() { if( bBootResourcesWereLoaded ) { GTRACE(1, "Warning: received command to load boot resources again! (Ignoring)"); return false; } ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap"); ResourceGroupManager::getSingleton().loadResourceGroup("Bootstrap"); Ogre::OverlayManager * overlayManager = OverlayManager::getSingletonPtr(); if( ! overlayManager ) { GTRACE(3, "ERROR! OverlayManager is NULL!"); return false; } loaderOverlay = overlayManager->getByName("GusApp/Loader4_3"); bool result = (loaderOverlay != NULL); bBootResourcesWereLoaded = result; return result; }
bool SerpEngine::keyReleased(const OIS::KeyEvent &arg) { GTRACE(5, "keyReleased, " << arg.key); if (isExiting()) { return true; } utils::CEGUIHelperUtil::injectKeyUp(arg.key); // TODO: this limits the possibilities of subclasses a lot; should consider sending the full event. stateManager_.reactToKeyRelease(arg.key); return true; }