Add: Overlay cargo icon in vehicle/depot list when holding shift+ctrl. (#12938)
[openttd-github.git] / src / video / null_v.cpp
blobe3a032d71fac4c819a22595bef30c53ddc403b65
1 /*
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/>.
6 */
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"
15 #include "null_v.h"
17 #include "../safeguards.h"
19 /** Factory for the null video driver. */
20 static FVideoDriver_Null iFVideoDriver_Null;
22 std::optional<std::string_view> VideoDriver_Null::Start(const StringList &parm)
24 #ifdef _MSC_VER
25 /* Disable the MSVC assertion message box. */
26 _set_error_mode(_OUT_TO_STDERR);
27 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
28 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
29 #endif
31 this->UpdateAutoResolution();
33 this->ticks = GetDriverParamInt(parm, "ticks", 1000);
34 _screen.width = _screen.pitch = _cur_resolution.width;
35 _screen.height = _cur_resolution.height;
36 _screen.dst_ptr = nullptr;
37 ScreenSizeChanged();
39 /* Do not render, nor blit */
40 Debug(misc, 1, "Forcing blitter 'null'...");
41 BlitterFactory::SelectBlitter("null");
42 return std::nullopt;
45 void VideoDriver_Null::Stop() { }
47 void VideoDriver_Null::MakeDirty(int, int, int, int) {}
49 void VideoDriver_Null::MainLoop()
51 uint i;
53 for (i = 0; i < this->ticks; i++) {
54 ::GameLoop();
55 ::InputLoop();
56 ::UpdateWindows();
59 /* If requested, make a save just before exit. The normal exit-flow is
60 * not triggered from this driver, so we have to do this manually. */
61 if (_settings_client.gui.autosave_on_exit) {
62 DoExitSave();
66 bool VideoDriver_Null::ChangeResolution(int, int) { return false; }
68 bool VideoDriver_Null::ToggleFullscreen(bool) { return false; }