Codechange: Avoid unnecessary re-reads/seeks in RandomAccessFile::ReadBlock
[openttd-github.git] / src / video / sdl2_default_v.h
blob066aa5e0569264e29c9da76f93f0146d8c877f54
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 */
8 /** @file sdl2_default_v.h Default backend of the SDL2 video driver. */
10 #ifndef VIDEO_SDL2_DEFAULT_H
11 #define VIDEO_SDL2_DEFAULT_H
13 #include "sdl2_v.h"
15 /** The SDL video driver using default SDL backend. */
16 class VideoDriver_SDL_Default : public VideoDriver_SDL_Base {
17 public:
18 std::string_view GetName() const override { return "sdl"; }
20 protected:
21 bool AllocateBackingStore(int w, int h, bool force = false) override;
22 void *GetVideoPointer() override;
23 void Paint() override;
25 void ReleaseVideoPointer() override {}
27 private:
28 void UpdatePalette();
29 void MakePalette();
32 /** Factory for the SDL video driver. */
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(); }
39 #endif /* VIDEO_SDL2_DEFAULT_H */