OpenTTD Source: src/screenshot_type.h Source File

OpenTTD Source 15.3

screenshot_type.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 SCREENSHOT_TYPE_H
11#define SCREENSHOT_TYPE_H
12
13#include "gfx_type.h"
14#include "provider_manager.h"
15
24 using ScreenshotCallback = std::function<void (void *buf, uint y, uint pitch, uint n)>;
25
27 class ScreenshotProvider : public PriorityBaseProvider<ScreenshotProvider> {
28public:
29 ScreenshotProvider(std::string_view name, std::string_view description, int priority) : PriorityBaseProvider<ScreenshotProvider>(name, description, priority)
30 {
31 ProviderManager<ScreenshotProvider>::Register(*this);
32 }
33
34 virtual ~ScreenshotProvider()
35 {
36 ProviderManager<ScreenshotProvider>::Unregister(*this);
37 }
38
39 virtual bool MakeImage(std::string_view name, const ScreenshotCallback &callb, uint w, uint h, int pixelformat, const Colour *palette) const = 0;
40};
41
42#endif /* SCREENSHOT_TYPE_H */
PriorityBaseProvider
Definition provider_manager.h:82
ProviderManager
The ProviderManager manages a single Provider-type.
Definition provider_manager.h:21
ScreenshotProvider
Base interface for a SoundLoader implementation.
Definition screenshot_type.h:27
gfx_type.h
Types related to the graphics and/or input devices.
provider_manager.h
Definition of the ProviderManager.
ScreenshotCallback
std::function< void(void *buf, uint y, uint pitch, uint n)> ScreenshotCallback
Callback function signature for generating lines of pixel data to be written to the screenshot file.
Definition screenshot_type.h:24