Null video driver: Add driver parameter to run until exit
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
/** Factory for the null video driver. */
|
/** Factory for the null video driver. */
|
||||||
static FVideoDriver_Null iFVideoDriver_Null;
|
static FVideoDriver_Null iFVideoDriver_Null;
|
||||||
|
|
||||||
|
extern bool _exit_game;
|
||||||
|
|
||||||
const char *VideoDriver_Null::Start(const char * const *parm)
|
const char *VideoDriver_Null::Start(const char * const *parm)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -27,6 +29,7 @@ const char *VideoDriver_Null::Start(const char * const *parm)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->ticks = GetDriverParamInt(parm, "ticks", 1000);
|
this->ticks = GetDriverParamInt(parm, "ticks", 1000);
|
||||||
|
this->until_exit = GetDriverParamBool(parm, "until_exit");
|
||||||
_screen.width = _screen.pitch = _cur_resolution.width;
|
_screen.width = _screen.pitch = _cur_resolution.width;
|
||||||
_screen.height = _cur_resolution.height;
|
_screen.height = _cur_resolution.height;
|
||||||
_screen.dst_ptr = nullptr;
|
_screen.dst_ptr = nullptr;
|
||||||
@@ -44,11 +47,16 @@ void VideoDriver_Null::MakeDirty(int left, int top, int width, int height) {}
|
|||||||
|
|
||||||
void VideoDriver_Null::MainLoop()
|
void VideoDriver_Null::MainLoop()
|
||||||
{
|
{
|
||||||
uint i;
|
if (this->until_exit) {
|
||||||
|
while (!_exit_game) {
|
||||||
for (i = 0; i < this->ticks; i++) {
|
GameLoop();
|
||||||
GameLoop();
|
UpdateWindows();
|
||||||
UpdateWindows();
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < this->ticks; i++) {
|
||||||
|
GameLoop();
|
||||||
|
UpdateWindows();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
/** The null video driver. */
|
/** The null video driver. */
|
||||||
class VideoDriver_Null : public VideoDriver {
|
class VideoDriver_Null : public VideoDriver {
|
||||||
private:
|
private:
|
||||||
uint ticks; ///< Amount of ticks to run.
|
int ticks; ///< Amount of ticks to run.
|
||||||
|
bool until_exit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const char *Start(const char * const *param) override;
|
const char *Start(const char * const *param) override;
|
||||||
|
Reference in New Issue
Block a user