2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file null_v.cpp The video driver that doesn't blit. */
10 #include "../stdafx.h"
11 #include "../gfx_func.h"
12 #include "../blitter/factory.hpp"
13 #include "../saveload/saveload.h"
14 #include "../window_func.h"
17 #include "../safeguards.h"
19 /** Factory for the null video driver. */
20 static FVideoDriver_Null iFVideoDriver_Null
;
22 const char *VideoDriver_Null::Start(const StringList
&parm
)
25 /* Disable the MSVC assertion message box. */
26 _set_error_mode(_OUT_TO_STDERR
);
29 this->UpdateAutoResolution();
31 this->ticks
= GetDriverParamInt(parm
, "ticks", 1000);
32 _screen
.width
= _screen
.pitch
= _cur_resolution
.width
;
33 _screen
.height
= _cur_resolution
.height
;
34 _screen
.dst_ptr
= nullptr;
37 /* Do not render, nor blit */
38 Debug(misc
, 1, "Forcing blitter 'null'...");
39 BlitterFactory::SelectBlitter("null");
43 void VideoDriver_Null::Stop() { }
45 void VideoDriver_Null::MakeDirty(int, int, int, int) {}
47 void VideoDriver_Null::MainLoop()
51 for (i
= 0; i
< this->ticks
; i
++) {
57 /* If requested, make a save just before exit. The normal exit-flow is
58 * not triggered from this driver, so we have to do this manually. */
59 if (_settings_client
.gui
.autosave_on_exit
) {
64 bool VideoDriver_Null::ChangeResolution(int, int) { return false; }
66 bool VideoDriver_Null::ToggleFullscreen(bool) { return false; }