diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-09-23 23:53:01 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-09-23 23:53:01 -0500 |
commit | b4a17e3a28f31217c79faa160f5e6abd720da054 (patch) | |
tree | 9e95862b192aa6c14b86a820ef77f290e46969c8 /src/gl_context.hpp | |
parent | cae8b633fc8723bcc35944298335ad48844d2bf0 (diff) |
Applying RAII types
Diffstat (limited to 'src/gl_context.hpp')
-rw-r--r-- | src/gl_context.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gl_context.hpp b/src/gl_context.hpp new file mode 100644 index 0000000..367e50d --- /dev/null +++ b/src/gl_context.hpp @@ -0,0 +1,31 @@ +#ifndef GL_CONTEXT_HPP +#define GL_CONTEXT_HPP + +#include "sdl_main_window.hpp" + +#include <SDL_video.h> + +namespace bookmouse { + +class GlContext { + public: + explicit GlContext(SdlMainWindow& mainWindow); + GlContext(const GlContext&) = delete; + GlContext(GlContext&&) = delete; + ~GlContext(); + + GlContext& operator=(const GlContext&) = delete; + GlContext& operator=(GlContext&&) = delete; + + constexpr SDL_GLContext context() + { + return m_context; + } + + private: + SDL_GLContext m_context{nullptr}; +}; + +} // namespace bookmouse + +#endif |