OpenTTD Source  20241121-master-g67a0fccfad
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 
17 public:
18  std::optional<std::string_view> 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  std::string_view GetName() const override { return "dedicated"; }
30  bool HasGUI() const override { return false; }
31 };
32 
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 */
Base for all driver factories.
Definition: driver.h:57
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description)
Construct a new DriverFactory.
Definition: driver.cpp:244
A driver for communicating with the user.
Definition: driver.h:21
@ DT_VIDEO
A video driver.
Definition: driver.h:42
Factory for the dedicated server video driver.
Definition: dedicated_v.h:34
Driver * CreateInstance() const override
Create an instance of this driver-class.
Definition: dedicated_v.h:44
The dedicated server video driver.
Definition: dedicated_v.h:16
std::optional< std::string_view > Start(const StringList &param) override
Start this driver.
void MainLoop() override
Perform the actual drawing.
void Stop() override
Stop this driver.
std::string_view GetName() const override
Get the name of this driver.
Definition: dedicated_v.h:29
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
bool HasGUI() const override
Whether the driver has a graphical user interface with the end user.
Definition: dedicated_v.h:30
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
The base of all video drivers.
std::vector< std::string > StringList
Type for a list of strings.
Definition: string_type.h:60
Base of all video drivers.