X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Finit.hpp;fp=src%2Fapp%2Finit.hpp;h=98a30ed9bcc2986c7ced3a58332033aaf0c8e58f;hb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;hp=0000000000000000000000000000000000000000;hpb=e53a0e2e711a7d8bd9b0ddacd1360aa14370643f;p=blank.git diff --git a/src/app/init.hpp b/src/app/init.hpp new file mode 100644 index 0000000..98a30ed --- /dev/null +++ b/src/app/init.hpp @@ -0,0 +1,109 @@ +#ifndef BLANK_APP_INIT_HPP_ +#define BLANK_APP_INIT_HPP_ + +#include + + +namespace blank { + +class GLContext; + + +class InitSDL { + +public: + InitSDL(); + ~InitSDL(); + + InitSDL(const InitSDL &) = delete; + InitSDL &operator =(const InitSDL &) = delete; + +}; + + +class InitIMG { + +public: + InitIMG(); + ~InitIMG(); + + InitIMG(const InitIMG &) = delete; + InitIMG &operator =(const InitIMG &) = delete; + +}; + + +class InitGL { + +public: + explicit InitGL(bool double_buffer = true, int sample_size = 1); + + InitGL(const InitGL &) = delete; + InitGL &operator =(const InitGL &) = delete; + +}; + + +class Window { + +public: + Window(); + ~Window(); + + Window(const Window &) = delete; + Window &operator =(const Window &) = delete; + + void GrabInput(); + void ReleaseInput(); + + void GrabMouse(); + void ReleaseMouse(); + + GLContext CreateContext(); + + void Flip(); + +private: + SDL_Window *handle; + +}; + + +class GLContext { + +public: + explicit GLContext(SDL_Window *); + ~GLContext(); + + GLContext(GLContext &&); + GLContext &operator =(GLContext &&); + + GLContext(const GLContext &) = delete; + GLContext &operator =(const GLContext &) = delete; + + static void EnableVSync(); + static void EnableDepthTest() noexcept; + static void EnableBackfaceCulling() noexcept; + + static void Clear() noexcept; + static void ClearDepthBuffer() noexcept; + +private: + SDL_GLContext handle; + +}; + + +class InitGLEW { + +public: + InitGLEW(); + + InitGLEW(const InitGLEW &) = delete; + InitGLEW &operator =(const InitGLEW &) = delete; + +}; + +} + +#endif