/** * @brief * Restarts the game */ void Application67::Restart() { // Get the scene container SceneContainer *pSceneContainer = GetScene(); if (pSceneContainer) { // Clean up your scene container pSceneContainer->Clear(); // Create the camera (we need the camera to control the post processing) SceneNode *pCamera = pSceneContainer->Create("PLScene::SNCamera", "FixedCamera"); if (pCamera && pCamera->IsInstanceOf("PLScene::SNCamera")) { // Add a post process scene node modifier from the 'PLPostProcessEffects'-plugin pCamera->AddModifier("PLPostProcessEffects::SNMPostProcessOldFilm", "Flags='Inactive'"); // Make this to our main scene camera SetCamera(reinterpret_cast<SNCamera*>(pCamera)); } // Create an UFO from mars attacking the earth :D pSceneContainer->Create("SNUFO", "Ufo"); // Create the gun (the player) pSceneContainer->Create("SNGun", "Gun", "Position=\"157 155\""); } }
/** * @brief * Clears the scene, after calling this method the scene is empty */ void EngineApplication::ClearScene() { // Get the scene container holding our scene SceneContainer *pContainer = GetScene(); if (pContainer) { // Clear the old scene pContainer->Clear(); // Cleanup the scene context right now to ensure that all 'delete this'-marked scene nodes are really gone! // If this is not done, we may get problems with for example the names of dynamic textures because there may // occur name conflicts if multiple render-to-texture scene containers want to render into a same named texture... // Topics like 'the new scene is using resources that are already loaded in' must be handled on another level, e.g. // by delaying the unloading of currently unreferenced resources. if (m_pSceneContext) m_pSceneContext->Cleanup(); } }