egolib_rv CameraSystem::renderAll(std::function<void(std::shared_ptr<Camera>, std::shared_ptr<Ego::Graphics::TileList>, std::shared_ptr<Ego::Graphics::EntityList>)> renderFunction) { if ( NULL == renderFunction ) { return rv_error; } if ( !isInitialized() ) { return rv_fail; } //Store main camera to restore std::shared_ptr<Camera> storeMainCam = _mainCamera; for(const std::shared_ptr<Camera> &camera : _cameraList) { // set the "global" camera pointer to this camera _mainCamera = camera; // has this camera already rendered this frame? if ( camera->getLastFrame() >= 0 && static_cast<uint32_t>(camera->getLastFrame()) >= game_frame_all ) { continue; } // set up everything for this camera beginCameraMode(camera); // render the world for this camera renderFunction(camera, camera->getTileList(), camera->getEntityList()); // undo the camera setup endCameraMode(); //Set last update frame camera->setLastFrame(game_frame_all); } // reset the "global" camera pointer to whatever it was _mainCamera = storeMainCam; return rv_success; }
void ViewportManager::emitEndCameraMode(Viewport* vp, QMouseEvent* e, bool* overrideDefault) { LOG_INFO("Emitting event - [endCameraMode]"); emit endCameraMode(vp, e, overrideDefault); }