OpenTTD
null_v.cpp
Go to the documentation of this file.
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  */
7 
10 #include "../stdafx.h"
11 #include "../gfx_func.h"
12 #include "../blitter/factory.hpp"
13 #include "null_v.h"
14 
15 #include "../safeguards.h"
16 
19 
20 const char *VideoDriver_Null::Start(const char * const *parm)
21 {
22 #ifdef _MSC_VER
23  /* Disable the MSVC assertion message box. */
24  _set_error_mode(_OUT_TO_STDERR);
25 #endif
26 
27  this->ticks = GetDriverParamInt(parm, "ticks", 1000);
28  _screen.width = _screen.pitch = _cur_resolution.width;
29  _screen.height = _cur_resolution.height;
30  _screen.dst_ptr = nullptr;
31  ScreenSizeChanged();
32 
33  /* Do not render, nor blit */
34  DEBUG(misc, 1, "Forcing blitter 'null'...");
36  return nullptr;
37 }
38 
40 
41 void VideoDriver_Null::MakeDirty(int left, int top, int width, int height) {}
42 
44 {
45  uint i;
46 
47  for (i = 0; i < this->ticks; i++) {
48  GameLoop();
49  UpdateWindows();
50  }
51 }
52 
53 bool VideoDriver_Null::ChangeResolution(int w, int h) { return false; }
54 
55 bool VideoDriver_Null::ToggleFullscreen(bool fs) { return false; }
Factory the null video driver.
Definition: null_v.h:37
uint ticks
Amount of ticks to run.
Definition: null_v.h:18
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
Definition: null_v.cpp:41
void MainLoop() override
Perform the actual drawing.
Definition: null_v.cpp:43
Dimension _cur_resolution
The current resolution.
Definition: driver.cpp:21
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
Definition: null_v.cpp:55
static Blitter * SelectBlitter(const char *name)
Find the requested blitter and return his class.
Definition: factory.hpp:94
Base of the video driver that doesn&#39;t blit.
static FVideoDriver_Null iFVideoDriver_Null
Factory for the null video driver.
Definition: null_v.cpp:18
#define DEBUG(name, level,...)
Output a line of debugging information.
Definition: debug.h:35
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
Definition: null_v.cpp:53
void Stop() override
Stop this driver.
Definition: null_v.cpp:39
int GetDriverParamInt(const char *const *parm, const char *name, int def)
Get an integer parameter the list of parameters.
Definition: driver.cpp:73
const char * Start(const char *const *param) override
Start this driver.
Definition: null_v.cpp:20
void UpdateWindows()
Update the continuously changing contents of the windows, such as the viewports.
Definition: window.cpp:3128