diff options
author | sfan5 <sfan5@live.de> | 2022-05-21 15:19:57 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-05-21 15:26:38 +0200 |
commit | 593103a26148b7154b159b9ae728fd53b4e7ca84 (patch) | |
tree | e36f3a85315d090d050a681fab10f15c36ffd703 /source/Irrlicht/CSDLManager.h | |
parent | 0732807cc8c52881287c53963b836b2fc445dd9f (diff) | |
download | irrlicht-593103a26148b7154b159b9ae728fd53b4e7ca84.tar.xz |
Refactor SDL device to use the same abstraction as other devices
In particular this makes the OpenGL procedure stuff work.
fixes https://github.com/minetest/minetest/issues/12265
Diffstat (limited to 'source/Irrlicht/CSDLManager.h')
-rw-r--r-- | source/Irrlicht/CSDLManager.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/source/Irrlicht/CSDLManager.h b/source/Irrlicht/CSDLManager.h new file mode 100644 index 0000000..e3ca3d0 --- /dev/null +++ b/source/Irrlicht/CSDLManager.h @@ -0,0 +1,53 @@ +// Copyright (C) 2022 sfan5 +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in Irrlicht.h + +#ifndef __C_SDL_MANAGER_H_INCLUDED__ +#define __C_SDL_MANAGER_H_INCLUDED__ + +#include "IrrCompileConfig.h" + +#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && defined(_IRR_COMPILE_WITH_OPENGL_) + +#include "IContextManager.h" + +namespace irr +{ + class CIrrDeviceSDL; + +namespace video +{ + + // Manager for SDL with OpenGL + class CSDLManager : public IContextManager + { + public: + CSDLManager(CIrrDeviceSDL* device); + + virtual ~CSDLManager() {} + + virtual bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) _IRR_OVERRIDE_; + + virtual void terminate() _IRR_OVERRIDE_ {}; + virtual bool generateSurface() _IRR_OVERRIDE_ { return true; }; + virtual void destroySurface() _IRR_OVERRIDE_ {}; + virtual bool generateContext() _IRR_OVERRIDE_ { return true; }; + virtual void destroyContext() _IRR_OVERRIDE_ {}; + + virtual const SExposedVideoData& getContext() const _IRR_OVERRIDE_; + + virtual bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero=false) _IRR_OVERRIDE_; + + virtual void* getProcAddress(const std::string &procName) _IRR_OVERRIDE_; + + virtual bool swapBuffers() _IRR_OVERRIDE_; + + private: + SExposedVideoData Data; + CIrrDeviceSDL *SDLDevice; + }; +} +} + +#endif +#endif |