]> git.localhorst.tv Git - blank.git/blobdiff - src/app/init.hpp
cleanup
[blank.git] / src / app / init.hpp
index f0777c85d5e4161b5f4926f37798f70a598a7a12..9385d44979b815078f609e332cf9617b08607e3c 100644 (file)
@@ -1,12 +1,40 @@
 #ifndef BLANK_APP_INIT_HPP_
 #define BLANK_APP_INIT_HPP_
 
+#include <al.h>
 #include <SDL.h>
+#include <stdexcept>
+#include <string>
 
 
 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,18 @@ public:
 };
 
 
+class InitNet {
+
+public:
+       InitNet();
+       ~InitNet();
+
+       InitNet(const InitNet &) = delete;
+       InitNet &operator =(const InitNet &) = delete;
+
+};
+
+
 class InitTTF {
 
 public:
@@ -45,6 +97,18 @@ public:
 };
 
 
+class InitAL {
+
+public:
+       InitAL();
+       ~InitAL() throw(AlutError);
+
+       InitAL(const InitAL &) = delete;
+       InitAL &operator =(const InitAL &) = delete;
+
+};
+
+
 class InitGL {
 
 public:
@@ -71,7 +135,7 @@ public:
        void GrabMouse();
        void ReleaseMouse();
 
-       GLContext CreateContext();
+       SDL_Window *Handle() { return handle; }
 
        void Flip();
 
@@ -87,24 +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 EnableAlphaBlending() noexcept;
-       static void EnableInvertBlending() noexcept;
-       static void DisableBlending() noexcept;
-
-       static void Clear() noexcept;
-       static void ClearDepthBuffer() noexcept;
-
 private:
-       SDL_GLContext handle;
+       SDL_GLContext ctx;
 
 };
 
@@ -119,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