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/sdl_context.hpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/sdl_context.hpp (limited to 'src/sdl_context.hpp') diff --git a/src/sdl_context.hpp b/src/sdl_context.hpp new file mode 100644 index 0000000..7b96df7 --- /dev/null +++ b/src/sdl_context.hpp @@ -0,0 +1,34 @@ +#ifndef SDL_CONTEXT_HPP +#define SDL_CONTEXT_HPP + +#include + +namespace bookmouse { + +class SdlContext { + public: + SdlContext() noexcept(false); + ~SdlContext(); + + int setAttribute(SDL_GLattr attr, int value) const; + + consteval const char* glslVersion() + { +#if defined(IMGUI_IMPL_OPENGL_ES2) + // GL ES 2.0 + GLSL 100 + return "#version 100"; +#elif defined(__APPLE__) + // GL 3.2 Core + GLSL 150 + return "#version 150"; +#else + // GL 3.0 + GLSL 130 + return "#version 130"; +#endif + } + + private: +}; + +} // namespace bookmouse + +#endif -- cgit v1.2.3