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/sdl_context.hpp | |
parent | cae8b633fc8723bcc35944298335ad48844d2bf0 (diff) |
Applying RAII types
Diffstat (limited to 'src/sdl_context.hpp')
-rw-r--r-- | src/sdl_context.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
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 <SDL.h> + +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 |