Null video driver: Add driver parameter to run until exit

This commit is contained in:
Jonathan G Rennison
2019-10-02 19:15:04 +01:00
parent 170e71787b
commit 33f5e00700
2 changed files with 15 additions and 6 deletions

View File

@@ -19,6 +19,8 @@
/** Factory for the null video driver. */
static FVideoDriver_Null iFVideoDriver_Null;
extern bool _exit_game;
const char *VideoDriver_Null::Start(const char * const *parm)
{
#ifdef _MSC_VER
@@ -27,6 +29,7 @@ const char *VideoDriver_Null::Start(const char * const *parm)
#endif
this->ticks = GetDriverParamInt(parm, "ticks", 1000);
this->until_exit = GetDriverParamBool(parm, "until_exit");
_screen.width = _screen.pitch = _cur_resolution.width;
_screen.height = _cur_resolution.height;
_screen.dst_ptr = nullptr;
@@ -44,11 +47,16 @@ void VideoDriver_Null::MakeDirty(int left, int top, int width, int height) {}
void VideoDriver_Null::MainLoop()
{
uint i;
for (i = 0; i < this->ticks; i++) {
GameLoop();
UpdateWindows();
if (this->until_exit) {
while (!_exit_game) {
GameLoop();
UpdateWindows();
}
} else {
for (int i = 0; i < this->ticks; i++) {
GameLoop();
UpdateWindows();
}
}
}