Codechange: be consistent in naming the paint function Paint()
[openttd-github.git] / src / video / sdl_v.h
bloba51062d850aa780b2507e0bbee4de35ffc74e57f
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 sdl_v.h Base of the SDL video driver. */
10 #ifndef VIDEO_SDL_H
11 #define VIDEO_SDL_H
13 #include "video_driver.hpp"
15 /** The SDL video driver. */
16 class VideoDriver_SDL : public VideoDriver {
17 public:
18 const char *Start(const StringList &param) override;
20 void Stop() override;
22 void MakeDirty(int left, int top, int width, int height) override;
24 void MainLoop() override;
26 bool ChangeResolution(int w, int h) override;
28 bool ToggleFullscreen(bool fullscreen) override;
30 bool AfterBlitterChange() override;
32 void AcquireBlitterLock() override;
34 void ReleaseBlitterLock() override;
36 bool ClaimMousePointer() override;
38 const char *GetName() const override { return "sdl"; }
40 protected:
41 void InputLoop() override;
42 bool LockVideoBuffer() override;
43 void UnlockVideoBuffer() override;
44 void Paint() override;
45 void PaintThread() override;
47 private:
48 std::unique_lock<std::recursive_mutex> draw_lock;
50 int PollEvent();
51 bool CreateMainSurface(uint w, uint h);
52 void SetupKeyboard();
54 static void PaintThreadThunk(VideoDriver_SDL *drv);
57 /** Factory for the SDL video driver. */
58 class FVideoDriver_SDL : public DriverFactoryBase {
59 public:
60 FVideoDriver_SDL() : DriverFactoryBase(Driver::DT_VIDEO, 5, "sdl", "SDL Video Driver") {}
61 Driver *CreateInstance() const override { return new VideoDriver_SDL(); }
64 #endif /* VIDEO_SDL_H */