OpenTTD Source  1.11.2
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 "../window_func.h"
14 #include "null_v.h"
15 
16 #include "../safeguards.h"
17 
20 
21 const char *VideoDriver_Null::Start(const StringList &parm)
22 {
23 #ifdef _MSC_VER
24  /* Disable the MSVC assertion message box. */
25  _set_error_mode(_OUT_TO_STDERR);
26 #endif
27 
28  this->UpdateAutoResolution();
29 
30  this->ticks = GetDriverParamInt(parm, "ticks", 1000);
31  _screen.width = _screen.pitch = _cur_resolution.width;
32  _screen.height = _cur_resolution.height;
33  _screen.dst_ptr = nullptr;
34  ScreenSizeChanged();
35 
36  /* Do not render, nor blit */
37  DEBUG(misc, 1, "Forcing blitter 'null'...");
39  return nullptr;
40 }
41 
43 
44 void VideoDriver_Null::MakeDirty(int left, int top, int width, int height) {}
45 
47 {
48  uint i;
49 
50  for (i = 0; i < this->ticks; i++) {
51  ::GameLoop();
52  ::InputLoop();
54  }
55 }
56 
57 bool VideoDriver_Null::ChangeResolution(int w, int h) { return false; }
58 
59 bool VideoDriver_Null::ToggleFullscreen(bool fs) { return false; }
BlitterFactory::SelectBlitter
static Blitter * SelectBlitter(const std::string &name)
Find the requested blitter and return his class.
Definition: factory.hpp:98
VideoDriver_Null::ToggleFullscreen
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
Definition: null_v.cpp:59
VideoDriver_Null::Start
const char * Start(const StringList &param) override
Start this driver.
Definition: null_v.cpp:21
VideoDriver_Null::ticks
uint ticks
Amount of ticks to run.
Definition: null_v.h:18
UpdateWindows
void UpdateWindows()
Update the continuously changing contents of the windows, such as the viewports.
Definition: window.cpp:3140
VideoDriver::InputLoop
virtual void InputLoop()
Handle input logic, is CTRL pressed, should we fast-forward, etc.
Definition: video_driver.hpp:254
iFVideoDriver_Null
static FVideoDriver_Null iFVideoDriver_Null
Factory for the null video driver.
Definition: null_v.cpp:19
DEBUG
#define DEBUG(name, level,...)
Output a line of debugging information.
Definition: debug.h:35
StringList
std::vector< std::string > StringList
Type for a list of strings.
Definition: string_type.h:58
VideoDriver_Null::ChangeResolution
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
Definition: null_v.cpp:57
null_v.h
GetDriverParamInt
int GetDriverParamInt(const StringList &parm, const char *name, int def)
Get an integer parameter the list of parameters.
Definition: driver.cpp:73
VideoDriver::UpdateAutoResolution
void UpdateAutoResolution()
Apply resolution auto-detection and clamp to sensible defaults.
Definition: video_driver.hpp:239
VideoDriver_Null::MakeDirty
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
Definition: null_v.cpp:44
FVideoDriver_Null
Factory the null video driver.
Definition: null_v.h:37
VideoDriver_Null::Stop
void Stop() override
Stop this driver.
Definition: null_v.cpp:42
VideoDriver_Null::MainLoop
void MainLoop() override
Perform the actual drawing.
Definition: null_v.cpp:46
_cur_resolution
Dimension _cur_resolution
The current resolution.
Definition: driver.cpp:25