Allow keeping target name after changing resolution

This commit is contained in:
Benau 2017-03-22 12:44:32 +08:00
parent 9a69859c8f
commit 41e66bef37
3 changed files with 9 additions and 6 deletions

View File

@ -1912,8 +1912,8 @@ void IrrDriver::setRecording(bool val)
{
std::string track_name = World::getWorld() != NULL ?
race_manager->getTrackName() : "menu";
AVIWriter::getInstance()->setRecordingTarget(file_manager
->getScreenshotDir() + track_name);
AVIWriter::setRecordingTarget(file_manager->getScreenshotDir() +
track_name);
AVIWriter::getInstance()->resetFrameBufferImage();
MessageQueue::add(MessageQueue::MT_GENERIC,
_("Video recording started."));

View File

@ -28,6 +28,7 @@
#include <jpeglib.h>
#include <cstring>
Synchronised<std::string> AVIWriter::m_recording_target("");
// ----------------------------------------------------------------------------
AVIWriter::AVIWriter() : m_idle(true)
{

View File

@ -167,7 +167,7 @@ class AVIWriter : public CanBeDeleted, public NoCopy,
private:
FILE* m_file;
Synchronised<std::string> m_recording_target;
static Synchronised<std::string> m_recording_target;
std::string m_filename;
@ -241,6 +241,11 @@ public:
// ------------------------------------------------------------------------
static void* startRoutine(void *obj);
// ------------------------------------------------------------------------
static void setRecordingTarget(const std::string& name)
{
m_recording_target.setAtomic(name);
}
// ------------------------------------------------------------------------
void captureFrameBufferImage(float dt);
// ------------------------------------------------------------------------
void resetFrameBufferImage();
@ -248,9 +253,6 @@ public:
void resetCaptureFormat();
// ------------------------------------------------------------------------
void stopRecording() { addFrameBufferImage(NULL, -1); }
// ------------------------------------------------------------------------
void setRecordingTarget(const std::string& name)
{ m_recording_target.setAtomic(name); }
};