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

OpenTTD Source 12.0-beta1

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
16 class VideoDriver_SDL_Default : public VideoDriver_SDL_Base {
17 public:
18 const char *GetName() const override { return "sdl"; }
19
20 protected:
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
27 private:
28 void UpdatePalette();
29 void MakePalette();
30 };
31
33 class FVideoDriver_SDL_Default : public DriverFactoryBase {
34 public:
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 */
FVideoDriver_SDL_Default
Factory for the SDL video driver.
Definition: sdl2_default_v.h:33
VideoDriver_SDL_Default::GetName
const char * GetName() const override
Get the name of this driver.
Definition: sdl2_default_v.h:18
DriverFactoryBase::DriverFactoryBase
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description)
Construct a new DriverFactory.
Definition: driver.cpp:216
sdl2_v.h
VideoDriver_SDL_Default::ReleaseVideoPointer
void ReleaseVideoPointer() override
Hand video buffer back to the painting backend.
Definition: sdl2_default_v.h:25
VideoDriver_SDL_Default::AllocateBackingStore
bool AllocateBackingStore(int w, int h, bool force=false) override
(Re-)create the backing store.
Definition: sdl2_default_v.cpp:131
Driver::DT_VIDEO
@ DT_VIDEO
A video driver.
Definition: driver.h:44
VideoDriver_SDL_Base
The SDL video driver.
Definition: sdl2_v.h:18
VideoDriver_SDL_Default::Paint
void Paint() override
Paint the window.
Definition: sdl2_default_v.cpp:93
VideoDriver_SDL_Default
The SDL video driver using default SDL backend.
Definition: sdl2_default_v.h:16
VideoDriver_SDL_Default::GetVideoPointer
void * GetVideoPointer() override
Get a pointer to the video buffer.
Definition: sdl2_default_v.cpp:172
Driver
A driver for communicating with the user.
Definition: driver.h:23
FVideoDriver_SDL_Default::CreateInstance
Driver * CreateInstance() const override
Create an instance of this driver-class.
Definition: sdl2_default_v.h:36
DriverFactoryBase
Base for all driver factories.
Definition: driver.h:59