Hide some things in save screenshots
Save indicator, mouse cursor, CDisplayText and interface particlesmaster
parent
6d363ba887
commit
f90bb63520
|
@ -323,6 +323,9 @@ public:
|
|||
//@}
|
||||
|
||||
bool GetSceneTestMode();
|
||||
|
||||
//! Renders the image in window
|
||||
void Render();
|
||||
|
||||
protected:
|
||||
//! Creates the window's SDL_Surface
|
||||
|
@ -336,8 +339,6 @@ protected:
|
|||
TEST_VIRTUAL Event CreateUpdateEvent();
|
||||
//! Logs debug data for event
|
||||
void LogEvent(const Event& event);
|
||||
//! Renders the image in window
|
||||
void Render();
|
||||
|
||||
//! Opens the joystick device
|
||||
bool OpenJoystick();
|
||||
|
|
|
@ -103,6 +103,7 @@ CEngine::CEngine(CApplication *app, CSystemUtils* systemUtils)
|
|||
m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
m_render = true;
|
||||
m_screenshotMode = false;
|
||||
m_shadowVisible = true;
|
||||
m_groundSpotVisible = true;
|
||||
m_dirty = true;
|
||||
|
@ -551,6 +552,16 @@ void CEngine::SetRenderEnable(bool enable)
|
|||
m_render = enable;
|
||||
}
|
||||
|
||||
void CEngine::SetScreenshotMode(bool screenshotMode)
|
||||
{
|
||||
m_screenshotMode = screenshotMode;
|
||||
}
|
||||
|
||||
bool CEngine::GetScreenshotMode()
|
||||
{
|
||||
return m_screenshotMode;
|
||||
}
|
||||
|
||||
Math::IntPoint CEngine::GetWindowSize()
|
||||
{
|
||||
return m_size;
|
||||
|
@ -3895,7 +3906,10 @@ void CEngine::DrawInterface()
|
|||
m_lastState = -1;
|
||||
SetState(Gfx::ENG_RSTATE_NORMAL);
|
||||
|
||||
m_particle->DrawParticle(SH_INTERFACE); // draws the particles of the interface
|
||||
if (!m_screenshotMode)
|
||||
{
|
||||
m_particle->DrawParticle(SH_INTERFACE); // draws the particles of the interface
|
||||
}
|
||||
|
||||
// 3D objects drawn in front of interface
|
||||
if (m_drawFront)
|
||||
|
|
|
@ -684,6 +684,12 @@ public:
|
|||
|
||||
//! Enables/disables rendering
|
||||
void SetRenderEnable(bool enable);
|
||||
|
||||
//! Management of "screenshot mode" (disables interface particle rendering)
|
||||
//@{
|
||||
void SetScreenshotMode(bool screenshotMode);
|
||||
bool GetScreenshotMode();
|
||||
//@}
|
||||
|
||||
//! Returns current size of viewport window
|
||||
Math::IntPoint GetWindowSize();
|
||||
|
@ -1326,6 +1332,9 @@ protected:
|
|||
//! Rendering enabled?
|
||||
bool m_render;
|
||||
|
||||
//! Screenshot mode?
|
||||
bool m_screenshotMode;
|
||||
|
||||
//! Projection matrix for 3D scene
|
||||
Math::Matrix m_matProj;
|
||||
//! View matrix for 3D scene
|
||||
|
|
|
@ -244,7 +244,6 @@ CRobotMain::CRobotMain()
|
|||
m_autosaveSlots = 3;
|
||||
m_autosaveLast = 0.0f;
|
||||
|
||||
m_shotDelay = 0;
|
||||
m_shotSaving = 0;
|
||||
|
||||
m_cameraPan = 0.0f;
|
||||
|
@ -2521,15 +2520,6 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_shotDelay > 0 && !m_ui->GetDialog()->IsDialog() )
|
||||
{
|
||||
m_shotDelay --;
|
||||
if ( m_shotDelay == 0 )
|
||||
{
|
||||
m_engine->WriteScreenShot(m_shotName);
|
||||
}
|
||||
}
|
||||
|
||||
m_water->EventProcess(event);
|
||||
m_cloud->EventProcess(event);
|
||||
m_lightning->EventProcess(event);
|
||||
|
@ -2661,7 +2651,7 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
{
|
||||
Math::Point pos, dim;
|
||||
|
||||
if (m_shotSaving == 0)
|
||||
if (m_shotSaving <= 0)
|
||||
{
|
||||
dim.x = 10.0f/640.0f;
|
||||
dim.y = 10.0f/480.0f;
|
||||
|
@ -2746,6 +2736,35 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CRobotMain::ShowSaveIndicator(bool show)
|
||||
{
|
||||
Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_SAVING);
|
||||
if (pc != nullptr)
|
||||
{
|
||||
Math::Point pos, dim;
|
||||
|
||||
if (!show)
|
||||
{
|
||||
dim.x = 10.0f/640.0f;
|
||||
dim.y = 10.0f/480.0f;
|
||||
pos.x = -20.0f/640.0f;
|
||||
pos.y = -20.0f/480.0f; // invisible!
|
||||
}
|
||||
else
|
||||
{
|
||||
dim.x = 32.0f/640.0f;
|
||||
dim.y = 32.0f/480.0f;
|
||||
pos.x = (640.0f-24.0f)/640.0f;
|
||||
pos.y = (480.0f-24.0f)/480.0f;
|
||||
|
||||
pos.x -= dim.x/2.0f;
|
||||
pos.y -= dim.y/2.0f;
|
||||
}
|
||||
pc->SetPos(pos);
|
||||
pc->SetDim(dim);
|
||||
}
|
||||
}
|
||||
|
||||
//! Makes the event for all robots
|
||||
bool CRobotMain::EventObject(const Event &event)
|
||||
{
|
||||
|
@ -4962,6 +4981,10 @@ void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj)
|
|||
//! Saves the current game
|
||||
bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::string filescreenshot, char *info)
|
||||
{
|
||||
// Render the indicator to show that we are working
|
||||
ShowSaveIndicator(true);
|
||||
m_app->Render(); // update
|
||||
|
||||
CLevelParser levelParser(filename);
|
||||
CLevelParserLineUPtr line;
|
||||
|
||||
|
@ -5083,10 +5106,20 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s
|
|||
CBotClass::SaveStaticState(file);
|
||||
fClose(file);
|
||||
|
||||
m_shotDelay = 3;
|
||||
m_shotName = CResourceManager::GetSaveLocation() + "/" + filescreenshot; //TODO: Use PHYSFS?
|
||||
ShowSaveIndicator(false); // force hide for screenshot
|
||||
MouseMode oldMouseMode = m_app->GetMouseMode();
|
||||
m_app->SetMouseMode(MOUSE_NONE); // disable the mouse
|
||||
m_displayText->HideText(true); // hide
|
||||
m_engine->SetScreenshotMode(true);
|
||||
|
||||
m_engine->Render(); // update (but don't show, we're not swapping buffers here!)
|
||||
m_engine->WriteScreenShot(CResourceManager::GetSaveLocation() + "/" + filescreenshot); //TODO: Use PHYSFS?
|
||||
m_shotSaving++;
|
||||
|
||||
m_engine->SetScreenshotMode(false);
|
||||
m_displayText->HideText(false);
|
||||
m_app->SetMouseMode(oldMouseMode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -377,6 +377,8 @@ protected:
|
|||
bool EventObject(const Event &event);
|
||||
void InitEye();
|
||||
|
||||
void ShowSaveIndicator(bool show);
|
||||
|
||||
void CreateScene(bool soluce, bool fixScene, bool resetObject);
|
||||
void ResetCreate();
|
||||
|
||||
|
@ -587,9 +589,7 @@ protected:
|
|||
int m_autosaveSlots;
|
||||
float m_autosaveLast;
|
||||
|
||||
unsigned int m_shotDelay;
|
||||
std::string m_shotName;
|
||||
unsigned int m_shotSaving;
|
||||
int m_shotSaving;
|
||||
|
||||
std::deque<CObject*> m_selectionHistory;
|
||||
};
|
||||
|
|
|
@ -222,8 +222,11 @@ void CScreenIO::IOWriteScene()
|
|||
int sel = pl->GetSelect();
|
||||
if ( sel == -1 ) return;
|
||||
|
||||
std::string dir;
|
||||
pe->GetText(info, 100);
|
||||
|
||||
m_interface->DeleteControl(EVENT_WINDOW5);
|
||||
|
||||
std::string dir;
|
||||
if (static_cast<unsigned int>(sel) >= m_saveList.size())
|
||||
{
|
||||
dir = m_main->GetPlayerProfile()->GetSaveFile("save"+clearName(info));
|
||||
|
|
|
@ -153,7 +153,6 @@ bool CScreenIOWrite::EventProcess(const Event &event)
|
|||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
m_main->StopSuspend();
|
||||
IOWriteScene();
|
||||
m_interface->DeleteControl(EVENT_WINDOW5);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace Ui
|
|||
{
|
||||
|
||||
CScreenLoading::CScreenLoading()
|
||||
: m_loadingCounter(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -79,18 +78,14 @@ void CScreenLoading::CreateInterface()
|
|||
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
|
||||
|
||||
SetBackground("textures/interface/interface.png");
|
||||
|
||||
m_loadingCounter = 1; // enough time to display!
|
||||
}
|
||||
|
||||
bool CScreenLoading::EventProcess(const Event &event)
|
||||
{
|
||||
if ( m_loadingCounter == 0 )
|
||||
{
|
||||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
}
|
||||
m_loadingCounter --;
|
||||
return true;
|
||||
m_app->Render(); // render the frame once before we start loading
|
||||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
@ -31,9 +31,6 @@ public:
|
|||
|
||||
void CreateInterface() override;
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
||||
protected:
|
||||
int m_loadingCounter;
|
||||
};
|
||||
|
||||
} // namespace Ui
|
||||
|
|
Loading…
Reference in New Issue