summaryrefslogtreecommitdiff
path: root/src/sdl_context.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdl_context.hpp')
-rw-r--r--src/sdl_context.hpp34
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