Fix #12973: Don't exclude high score after using sandbox
[openttd-github.git] / src / video / cocoa / cocoa_ogl.h
bloba238fbce6386b9155e4d890e77e63a3e23b751b7
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 cocoa_ogl.h The Cocoa OpenGL video driver. */
10 #ifndef VIDEO_COCOA_OGL_H
11 #define VIDEO_COCOA_OGL_H
13 #include "cocoa_v.h"
15 @class OTTD_OpenGLView;
17 class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa {
18 CGLContextObj gl_context;
20 uint8_t *anim_buffer; ///< Animation buffer from OpenGL back-end.
21 std::string driver_info; ///< Information string about selected driver.
23 std::optional<std::string_view> AllocateContext(bool allow_software);
25 public:
26 VideoDriver_CocoaOpenGL() : VideoDriver_Cocoa(true), gl_context(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {}
28 std::optional<std::string_view> Start(const StringList &param) override;
29 void Stop() override;
31 bool HasEfficient8Bpp() const override { return true; }
33 bool UseSystemCursor() override { return true; }
35 void ClearSystemSprites() override;
37 void PopulateSystemSprites() override;
39 bool HasAnimBuffer() override { return true; }
40 uint8_t *GetAnimBuffer() override { return this->anim_buffer; }
42 /** Return driver name */
43 std::string_view GetName() const override { return "cocoa-opengl"; }
45 std::string_view GetInfoString() const override { return this->driver_info; }
47 void AllocateBackingStore(bool force = false) override;
49 protected:
50 void Paint() override;
52 void *GetVideoPointer() override;
53 void ReleaseVideoPointer() override;
55 NSView *AllocateDrawView() override;
58 class FVideoDriver_CocoaOpenGL : public DriverFactoryBase {
59 public:
60 FVideoDriver_CocoaOpenGL() : DriverFactoryBase(Driver::DT_VIDEO, 9, "cocoa-opengl", "Cocoa OpenGL Video Driver") {}
61 Driver *CreateInstance() const override { return new VideoDriver_CocoaOpenGL(); }
63 protected:
64 bool UsesHardwareAcceleration() const override { return true; }
67 #endif /* VIDEO_COCOA_OGL_H */