X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Finit.hpp;h=9385d44979b815078f609e332cf9617b08607e3c;hb=fd86376a8e7d3f1b09be3d018f772ef884937238;hp=98a30ed9bcc2986c7ced3a58332033aaf0c8e58f;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/app/init.hpp b/src/app/init.hpp index 98a30ed..9385d44 100644 --- a/src/app/init.hpp +++ b/src/app/init.hpp @@ -1,12 +1,40 @@ #ifndef BLANK_APP_INIT_HPP_ #define BLANK_APP_INIT_HPP_ +#include #include +#include +#include namespace blank { -class GLContext; +class AlutError +: public std::runtime_error { + +public: + explicit AlutError(ALenum); + AlutError(ALenum, const std::string &); + +}; + +class SDLError +: public std::runtime_error { + +public: + SDLError(); + explicit SDLError(const std::string &); + +}; + +class NetError +: public std::runtime_error { + +public: + NetError(); + explicit NetError(const std::string &); + +}; class InitSDL { @@ -21,6 +49,18 @@ public: }; +class InitVideo { + +public: + InitVideo(); + ~InitVideo(); + + InitVideo(const InitVideo &) = delete; + InitVideo &operator =(const InitVideo &) = delete; + +}; + + class InitIMG { public: @@ -33,6 +73,42 @@ public: }; +class InitNet { + +public: + InitNet(); + ~InitNet(); + + InitNet(const InitNet &) = delete; + InitNet &operator =(const InitNet &) = delete; + +}; + + +class InitTTF { + +public: + InitTTF(); + ~InitTTF(); + + InitTTF(const InitTTF &) = delete; + InitTTF &operator =(const InitTTF &) = delete; + +}; + + +class InitAL { + +public: + InitAL(); + ~InitAL() throw(AlutError); + + InitAL(const InitAL &) = delete; + InitAL &operator =(const InitAL &) = delete; + +}; + + class InitGL { public: @@ -59,7 +135,7 @@ public: void GrabMouse(); void ReleaseMouse(); - GLContext CreateContext(); + SDL_Window *Handle() { return handle; } void Flip(); @@ -75,21 +151,11 @@ 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; + SDL_GLContext ctx; }; @@ -104,6 +170,31 @@ public: }; + +struct InitHeadless { + + InitHeadless(); + + InitSDL init_sdl; + InitNet init_net; + +}; + +struct Init { + + Init(bool double_buffer = true, int sample_size = 1); + + InitVideo init_video; + InitIMG init_img; + InitTTF init_ttf; + InitAL init_al; + InitGL init_gl; + Window window; + GLContext ctx; + InitGLEW init_glew; + +}; + } #endif