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

OpenTTD Source 15.0-RC2

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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
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 {
17public:
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
34 class FVideoDriver_Dedicated : public DriverFactoryBase {
35public:
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 std::unique_ptr<Driver> CreateInstance() const override { return std::make_unique<VideoDriver_Dedicated>(); }
45};
46
47#endif /* VIDEO_DEDICATED_H */
DriverFactoryBase
Base for all driver factories.
Definition driver.h:57
Driver::DT_VIDEO
@ DT_VIDEO
A video driver.
Definition driver.h:42
FVideoDriver_Dedicated
Factory for the dedicated server video driver.
Definition dedicated_v.h:34
FVideoDriver_Dedicated::CreateInstance
std::unique_ptr< Driver > CreateInstance() const override
Create an instance of this driver-class.
Definition dedicated_v.h:44
VideoDriver_Dedicated
The dedicated server video driver.
Definition dedicated_v.h:16
VideoDriver_Dedicated::Start
std::optional< std::string_view > Start(const StringList &param) override
Start this driver.
Definition dedicated_v.cpp:105
VideoDriver_Dedicated::MainLoop
void MainLoop() override
Perform the actual drawing.
Definition dedicated_v.cpp:194
VideoDriver_Dedicated::Stop
void Stop() override
Stop this driver.
Definition dedicated_v.cpp:136
VideoDriver_Dedicated::GetName
std::string_view GetName() const override
Get the name of this driver.
Definition dedicated_v.h:29
VideoDriver_Dedicated::ToggleFullscreen
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
Definition dedicated_v.cpp:146
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::MakeDirty
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
Definition dedicated_v.cpp:144
VideoDriver_Dedicated::ChangeResolution
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
Definition dedicated_v.cpp:145
VideoDriver
The base of all video drivers.
Definition video_driver.hpp:35
StringList
std::vector< std::string > StringList
Type for a list of strings.
Definition string_type.h:60
video_driver.hpp
Base of all video drivers.