From b4a17e3a28f31217c79faa160f5e6abd720da054 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Mon, 23 Sep 2024 23:53:01 -0500 Subject: Applying RAII types --- src/gl_context.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/gl_context.hpp (limited to 'src/gl_context.hpp') 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 + +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 -- cgit v1.2.3