OpenTTD Source: src/video/dedicated_v.h Source File

OpenTTD Source 12.2

dedicated_v.h
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 #ifndef VIDEO_DEDICATED_H
11 #define VIDEO_DEDICATED_H
12
13 #include "video_driver.hpp"
14
16 class VideoDriver_Dedicated : public VideoDriver {
17 public:
18 const char *Start(const StringList &param) override;
19
20 void Stop() override;
21
22 void MakeDirty(int left, int top, int width, int height) override;
23
24 void MainLoop() override;
25
26 bool ChangeResolution(int w, int h) override;
27
28 bool ToggleFullscreen(bool fullscreen) override;
29 const char *GetName() const override { return "dedicated"; }
30 bool HasGUI() const override { return false; }
31 };
32
34 class FVideoDriver_Dedicated : public DriverFactoryBase {
35 public:
36 #ifdef DEDICATED
37 /* Automatically select this dedicated driver when making a dedicated
38 * server build. */
39 static const int PRIORITY = 10;
40 #else
41 static const int PRIORITY = 0;
42 #endif
43 FVideoDriver_Dedicated() : DriverFactoryBase(Driver::DT_VIDEO, PRIORITY, "dedicated", "Dedicated Video Driver") {}
44 Driver *CreateInstance() const override { return new VideoDriver_Dedicated(); }
45 };
46
47 #endif /* VIDEO_DEDICATED_H */
FVideoDriver_Dedicated::CreateInstance
Driver * CreateInstance() const override
Create an instance of this driver-class.
Definition: dedicated_v.h:44
VideoDriver
The base of all video drivers.
Definition: video_driver.hpp:35
DriverFactoryBase::DriverFactoryBase
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description)
Construct a new DriverFactory.
Definition: driver.cpp:216
VideoDriver_Dedicated
The dedicated server video driver.
Definition: dedicated_v.h:16
VideoDriver_Dedicated::GetName
const char * GetName() const override
Get the name of this driver.
Definition: dedicated_v.h:29
FVideoDriver_Dedicated
Factory for the dedicated server video driver.
Definition: dedicated_v.h:34
StringList
std::vector< std::string > StringList
Type for a list of strings.
Definition: string_type.h:58
VideoDriver_Dedicated::MakeDirty
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
Definition: dedicated_v.cpp:179
VideoDriver_Dedicated::Start
const char * Start(const StringList &param) override
Start this driver.
Definition: dedicated_v.cpp:137
VideoDriver_Dedicated::HasGUI
bool HasGUI() const override
Whether the driver has a graphical user interface with the end user.
Definition: dedicated_v.h:30
VideoDriver_Dedicated::ChangeResolution
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
Definition: dedicated_v.cpp:180
video_driver.hpp
Driver::DT_VIDEO
@ DT_VIDEO
A video driver.
Definition: driver.h:44
VideoDriver_Dedicated::MainLoop
void MainLoop() override
Perform the actual drawing.
Definition: dedicated_v.cpp:237
VideoDriver_Dedicated::Stop
void Stop() override
Stop this driver.
Definition: dedicated_v.cpp:171
Driver
A driver for communicating with the user.
Definition: driver.h:23
VideoDriver_Dedicated::ToggleFullscreen
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
Definition: dedicated_v.cpp:181
DriverFactoryBase
Base for all driver factories.
Definition: driver.h:59