Movie lock refactoring

master
krzys-h 2015-07-16 20:47:15 +02:00
parent 6dcf4dffa6
commit 2b9811d225
4 changed files with 8 additions and 32 deletions

View File

@ -89,7 +89,6 @@ CEngine::CEngine(CApplication *app)
m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f); m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f);
m_render = true; m_render = true;
m_movieLock = false;
m_shadowVisible = true; m_shadowVisible = true;
m_groundSpotVisible = true; m_groundSpotVisible = true;
m_dirty = true; m_dirty = true;
@ -488,17 +487,19 @@ void CEngine::FrameUpdate()
bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height) bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height)
{ {
void *pixels = m_device->GetFrameBufferPixels(); void *pixels = m_device->GetFrameBufferPixels();
CImage img({width,height}); CImage img({width, height});
img.SetDataPixels(pixels); img.SetDataPixels(pixels);
img.flipVertically(); img.flipVertically();
if ( img.SavePNG(fileName.c_str()) ){ if ( img.SavePNG(fileName.c_str()) )
GetLogger()->Info("Save SceenShot Saved Successfully!\n"); {
GetLogger()->Debug("Save screenshot saved successfully\n");
return true; return true;
} }
else{ else
GetLogger()->Error("%s!\n",img.GetError().c_str()); {
GetLogger()->Error("%s!\n", img.GetError().c_str());
return false; return false;
} }
} }
@ -508,16 +509,6 @@ bool CEngine::GetPause()
return m_pause->GetPause(); return m_pause->GetPause();
} }
void CEngine::SetMovieLock(bool lock)
{
m_movieLock = lock;
}
bool CEngine::GetMovieLock()
{
return m_movieLock;
}
void CEngine::SetShowStats(bool show) void CEngine::SetShowStats(bool show)
{ {
m_showStats = show; m_showStats = show;
@ -5135,4 +5126,3 @@ void CEngine::SetStaticMeshTransparency(int meshHandle, float value)
} }
} // namespace Gfx } // namespace Gfx

View File

@ -731,12 +731,6 @@ public:
//! Get pause mode //! Get pause mode
TEST_VIRTUAL bool GetPause(); TEST_VIRTUAL bool GetPause();
//@{
//! Management of lock for the duration of movie sequence
void SetMovieLock(bool lock);
bool GetMovieLock();
//@}
//@{ //@{
//! Management of displaying statistic information //! Management of displaying statistic information
void SetShowStats(bool show); void SetShowStats(bool show);
@ -1372,8 +1366,6 @@ protected:
std::string m_fpsText; std::string m_fpsText;
//! Rendering enabled? //! Rendering enabled?
bool m_render; bool m_render;
//! Lock for duration of movie?
bool m_movieLock;
//! Projection matrix for 3D scene //! Projection matrix for 3D scene
Math::Matrix m_matProj; Math::Matrix m_matProj;
@ -1544,4 +1536,3 @@ protected:
} // namespace Gfx } // namespace Gfx

View File

@ -81,7 +81,7 @@ bool CLightning::EventProcess(const Event &event)
bool CLightning::EventFrame(const Event &event) bool CLightning::EventFrame(const Event &event)
{ {
if (m_engine->GetPause()) return true; if (m_engine->GetPause()) return true;
if (m_engine->GetMovieLock()) return true; if (CRobotMain::GetInstancePointer()->GetMovieLock()) return true;
m_progress += event.rTime*m_speed; m_progress += event.rTime*m_speed;
@ -417,4 +417,3 @@ CObject* CLightning::SearchObject(Math::Vector pos)
} // namespace Gfx } // namespace Gfx

View File

@ -283,8 +283,6 @@ void CRobotMain::Create(bool loadProfile)
m_engine->SetTerrain(m_terrain); m_engine->SetTerrain(m_terrain);
m_engine->SetMovieLock(m_movieLock);
m_app->SetMouseMode(MOUSE_ENGINE); m_app->SetMouseMode(MOUSE_ENGINE);
m_movie->Flush(); m_movie->Flush();
@ -472,7 +470,6 @@ void CRobotMain::ChangePhase(Phase phase)
m_freePhoto = false; m_freePhoto = false;
m_resetCreate = false; m_resetCreate = false;
m_engine->SetMovieLock(m_movieLock);
ChangePause(PAUSE_NONE); ChangePause(PAUSE_NONE);
FlushDisplayInfo(); FlushDisplayInfo();
m_engine->SetRankView(0); m_engine->SetRankView(0);
@ -5827,7 +5824,6 @@ bool CRobotMain::GetShowMap()
void CRobotMain::SetMovieLock(bool lock) void CRobotMain::SetMovieLock(bool lock)
{ {
m_movieLock = lock; m_movieLock = lock;
m_engine->SetMovieLock(m_movieLock);
CreateShortcuts(); CreateShortcuts();
m_map->ShowMap(!m_movieLock && m_mapShow); m_map->ShowMap(!m_movieLock && m_mapShow);