OpenTTD Source 20241224-master-gee860a5c8e
sdl2_default_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_SDL2_DEFAULT_H
11#define VIDEO_SDL2_DEFAULT_H
12
13#include "sdl2_v.h"
14
17public:
18 std::string_view GetName() const override { return "sdl"; }
19
20protected:
21 bool AllocateBackingStore(int w, int h, bool force = false) override;
22 void *GetVideoPointer() override;
23 void Paint() override;
24
25 void ReleaseVideoPointer() override {}
26
27private:
28 void UpdatePalette();
29 void MakePalette();
30};
31
34public:
35 FVideoDriver_SDL_Default() : DriverFactoryBase(Driver::DT_VIDEO, 5, "sdl", "SDL Video Driver") {}
36 Driver *CreateInstance() const override { return new VideoDriver_SDL_Default(); }
37};
38
39#endif /* VIDEO_SDL2_DEFAULT_H */
Base for all driver factories.
Definition driver.h:57
A driver for communicating with the user.
Definition driver.h:21
@ DT_VIDEO
A video driver.
Definition driver.h:42
Factory for the SDL video driver.
Driver * CreateInstance() const override
Create an instance of this driver-class.
The SDL video driver.
Definition sdl2_v.h:18
The SDL video driver using default SDL backend.
bool AllocateBackingStore(int w, int h, bool force=false) override
(Re-)create the backing store.
void ReleaseVideoPointer() override
Hand video buffer back to the painting backend.
void * GetVideoPointer() override
Get a pointer to the video buffer.
void Paint() override
Paint the window.
std::string_view GetName() const override
Get the name of this driver.
Base of the SDL2 video driver.