recording improvements
remove 'r' record shortcut add tpt.record function. Still gives the user a confirm prompt recordings now go into recordings/<timestamp>/, where timestamp is the time the recording was started. <timestamp> is returned by the tpt.record function. Each new recording starts the filenames over at 0 again. you probably still need a lua script to use the recording feature, this should make it easier for those
This commit is contained in:
parent
e4089a276a
commit
6bd068713e
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ Saves/*
|
|||||||
scripts/*
|
scripts/*
|
||||||
generated/*
|
generated/*
|
||||||
includes/*
|
includes/*
|
||||||
|
recordings/
|
||||||
font/*
|
font/*
|
||||||
generate
|
generate
|
||||||
Makefile.me
|
Makefile.me
|
||||||
|
@ -1571,6 +1571,11 @@ std::string GameController::WallName(int type)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GameController::Record(bool record)
|
||||||
|
{
|
||||||
|
return gameView->Record(record);
|
||||||
|
}
|
||||||
|
|
||||||
void GameController::NotifyAuthUserChanged(Client * sender)
|
void GameController::NotifyAuthUserChanged(Client * sender)
|
||||||
{
|
{
|
||||||
User newUser = sender->GetAuthUser();
|
User newUser = sender->GetAuthUser();
|
||||||
|
@ -149,6 +149,7 @@ public:
|
|||||||
std::string ElementResolve(int type, int ctype);
|
std::string ElementResolve(int type, int ctype);
|
||||||
bool IsValidElement(int type);
|
bool IsValidElement(int type);
|
||||||
std::string WallName(int type);
|
std::string WallName(int type);
|
||||||
|
int Record(bool record);
|
||||||
|
|
||||||
void ResetAir();
|
void ResetAir();
|
||||||
void ResetSpark();
|
void ResetSpark();
|
||||||
|
@ -186,8 +186,9 @@ GameView::GameView():
|
|||||||
introTextMessage(introTextData),
|
introTextMessage(introTextData),
|
||||||
|
|
||||||
doScreenshot(false),
|
doScreenshot(false),
|
||||||
recording(false),
|
|
||||||
screenshotIndex(0),
|
screenshotIndex(0),
|
||||||
|
recording(false),
|
||||||
|
recordingFolder(0),
|
||||||
recordingIndex(0),
|
recordingIndex(0),
|
||||||
currentPoint(ui::Point(0, 0)),
|
currentPoint(ui::Point(0, 0)),
|
||||||
lastPoint(ui::Point(0, 0)),
|
lastPoint(ui::Point(0, 0)),
|
||||||
@ -1044,28 +1045,31 @@ void GameView::screenshot()
|
|||||||
doScreenshot = true;
|
doScreenshot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameView::record()
|
int GameView::Record(bool record)
|
||||||
{
|
{
|
||||||
if(recording)
|
if (!record)
|
||||||
{
|
{
|
||||||
recording = false;
|
recording = false;
|
||||||
|
recordingIndex = 0;
|
||||||
|
recordingFolder = 0;
|
||||||
}
|
}
|
||||||
else
|
else if (!recording)
|
||||||
{
|
{
|
||||||
class RecordingConfirmation: public ConfirmDialogueCallback {
|
// block so that the return value is correct
|
||||||
public:
|
bool record = ConfirmPrompt::Blocking("Recording", "You're about to start recording all drawn frames. This will use a load of disk space.");
|
||||||
GameView * v;
|
if (record)
|
||||||
RecordingConfirmation(GameView * v): v(v) {}
|
{
|
||||||
virtual void ConfirmCallback(ConfirmPrompt::DialogueResult result) {
|
time_t startTime = time(NULL);
|
||||||
if (result == ConfirmPrompt::ResultOkay)
|
recordingFolder = startTime;
|
||||||
{
|
std::stringstream recordingDir;
|
||||||
v->recording = true;
|
recordingDir << "recordings" << PATH_SEP << recordingFolder;
|
||||||
}
|
Client::Ref().MakeDirectory("recordings");
|
||||||
}
|
Client::Ref().MakeDirectory(recordingDir.str().c_str());
|
||||||
virtual ~RecordingConfirmation() { }
|
recording = true;
|
||||||
};
|
recordingIndex = 0;
|
||||||
new ConfirmPrompt("Recording", "You're about to start recording all drawn frames. This may use a load of hard disk space.", new RecordingConfirmation(this));
|
}
|
||||||
}
|
}
|
||||||
|
return recordingFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameView::updateToolButtonScroll()
|
void GameView::updateToolButtonScroll()
|
||||||
@ -1496,8 +1500,6 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
case 'r':
|
case 'r':
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
c->ReloadSim();
|
c->ReloadSim();
|
||||||
else
|
|
||||||
record();
|
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
c->OpenElementSearch();
|
c->OpenElementSearch();
|
||||||
@ -2233,6 +2235,7 @@ void GameView::OnDraw()
|
|||||||
std::vector<char> data = format::VideoBufferToPPM(screenshot);
|
std::vector<char> data = format::VideoBufferToPPM(screenshot);
|
||||||
|
|
||||||
std::stringstream filename;
|
std::stringstream filename;
|
||||||
|
filename << "recordings" << PATH_SEP << recordingFolder << PATH_SEP;
|
||||||
filename << "frame_";
|
filename << "frame_";
|
||||||
filename << std::setfill('0') << std::setw(6) << (recordingIndex++);
|
filename << std::setfill('0') << std::setw(6) << (recordingIndex++);
|
||||||
filename << ".ppm";
|
filename << ".ppm";
|
||||||
|
@ -66,8 +66,9 @@ private:
|
|||||||
std::string introTextMessage;
|
std::string introTextMessage;
|
||||||
|
|
||||||
bool doScreenshot;
|
bool doScreenshot;
|
||||||
bool recording;
|
|
||||||
int screenshotIndex;
|
int screenshotIndex;
|
||||||
|
bool recording;
|
||||||
|
int recordingFolder;
|
||||||
int recordingIndex;
|
int recordingIndex;
|
||||||
|
|
||||||
ui::Point currentPoint, lastPoint;
|
ui::Point currentPoint, lastPoint;
|
||||||
@ -117,7 +118,6 @@ private:
|
|||||||
void SetSaveButtonTooltips();
|
void SetSaveButtonTooltips();
|
||||||
|
|
||||||
void screenshot();
|
void screenshot();
|
||||||
void record();
|
|
||||||
|
|
||||||
void enableShiftBehaviour();
|
void enableShiftBehaviour();
|
||||||
void disableShiftBehaviour();
|
void disableShiftBehaviour();
|
||||||
@ -147,6 +147,7 @@ public:
|
|||||||
void ExitPrompt();
|
void ExitPrompt();
|
||||||
SelectMode GetSelectMode() { return selectMode; }
|
SelectMode GetSelectMode() { return selectMode; }
|
||||||
void BeginStampSelection();
|
void BeginStampSelection();
|
||||||
|
int Record(bool record);
|
||||||
|
|
||||||
//all of these are only here for one debug lines
|
//all of these are only here for one debug lines
|
||||||
bool GetMouseDown() { return isMouseDown; }
|
bool GetMouseDown() { return isMouseDown; }
|
||||||
|
@ -2032,4 +2032,14 @@ int luatpt_screenshot(lua_State* l)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int luatpt_record(lua_State* l)
|
||||||
|
{
|
||||||
|
if (!lua_isboolean(l, -1))
|
||||||
|
return luaL_typerror(l, 1, lua_typename(l, LUA_TBOOLEAN));
|
||||||
|
bool record = lua_toboolean(l, -1);
|
||||||
|
int recordingFolder = luacon_controller->Record(record);
|
||||||
|
lua_pushinteger(l, recordingFolder);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,6 +131,7 @@ int luatpt_getscript(lua_State* l);
|
|||||||
int luatpt_setwindowsize(lua_State* l);
|
int luatpt_setwindowsize(lua_State* l);
|
||||||
|
|
||||||
int luatpt_screenshot(lua_State* l);
|
int luatpt_screenshot(lua_State* l);
|
||||||
|
int luatpt_record(lua_State* l);
|
||||||
|
|
||||||
|
|
||||||
#endif /* LUASCRIPTHELPER_H_ */
|
#endif /* LUASCRIPTHELPER_H_ */
|
||||||
|
@ -202,6 +202,7 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
|||||||
{"setwindowsize",&luatpt_setwindowsize},
|
{"setwindowsize",&luatpt_setwindowsize},
|
||||||
{"watertest",&luatpt_togglewater},
|
{"watertest",&luatpt_togglewater},
|
||||||
{"screenshot",&luatpt_screenshot},
|
{"screenshot",&luatpt_screenshot},
|
||||||
|
{"record",&luatpt_record},
|
||||||
{"element",&luatpt_getelement},
|
{"element",&luatpt_getelement},
|
||||||
{"element_func",&luatpt_element_func},
|
{"element_func",&luatpt_element_func},
|
||||||
{"graphics_func",&luatpt_graphics_func},
|
{"graphics_func",&luatpt_graphics_func},
|
||||||
|
Reference in New Issue
Block a user