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

OpenTTD Source 15.0-RC2

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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef VIDEO_SDL2_DEFAULT_H
11#define VIDEO_SDL2_DEFAULT_H
12
13#include "sdl2_v.h"
14
16 class VideoDriver_SDL_Default : public VideoDriver_SDL_Base {
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
33 class FVideoDriver_SDL_Default : public DriverFactoryBase {
34public:
35 FVideoDriver_SDL_Default() : DriverFactoryBase(Driver::DT_VIDEO, 5, "sdl", "SDL Video Driver") {}
36 std::unique_ptr<Driver> CreateInstance() const override { return std::make_unique<VideoDriver_SDL_Default>(); }
37};
38
39#endif /* VIDEO_SDL2_DEFAULT_H */
DriverFactoryBase
Base for all driver factories.
Definition driver.h:57
Driver::DT_VIDEO
@ DT_VIDEO
A video driver.
Definition driver.h:42
FVideoDriver_SDL_Default
Factory for the SDL video driver.
Definition sdl2_default_v.h:33
FVideoDriver_SDL_Default::CreateInstance
std::unique_ptr< Driver > CreateInstance() const override
Create an instance of this driver-class.
Definition sdl2_default_v.h:36
VideoDriver_SDL_Base
The SDL video driver.
Definition sdl2_v.h:18
VideoDriver_SDL_Default
The SDL video driver using default SDL backend.
Definition sdl2_default_v.h:16
VideoDriver_SDL_Default::AllocateBackingStore
bool AllocateBackingStore(int w, int h, bool force=false) override
(Re-)create the backing store.
Definition sdl2_default_v.cpp:129
VideoDriver_SDL_Default::ReleaseVideoPointer
void ReleaseVideoPointer() override
Hand video buffer back to the painting backend.
Definition sdl2_default_v.h:25
VideoDriver_SDL_Default::GetVideoPointer
void * GetVideoPointer() override
Get a pointer to the video buffer.
Definition sdl2_default_v.cpp:170
VideoDriver_SDL_Default::Paint
void Paint() override
Paint the window.
Definition sdl2_default_v.cpp:91
VideoDriver_SDL_Default::GetName
std::string_view GetName() const override
Get the name of this driver.
Definition sdl2_default_v.h:18
sdl2_v.h
Base of the SDL2 video driver.