]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Video.hh
minor refactoring and state progress
[chaz/yoink] / src / Moof / Video.hh
index bb1fdd48db9b168a086be687c6cc2f51fe55a284..736832f09d0277edb4da88e1a393e327dd934d63 100644 (file)
 
 #include <SDL/SDL.h>
 
+#include <Moof/Exception.hh>
+
 
 namespace Mf {
 
 
+class Video;
+typedef boost::shared_ptr<Video> VideoP;
+
+
 class Video
 {
 public:
+
        struct Attributes
        {
                // OpenGL attributes
@@ -69,6 +76,12 @@ public:
                Attributes();
        };
 
+
+       static VideoP alloc(const std::string& caption, const std::string& icon)
+       {
+               return VideoP(new Video(caption, icon));
+       }
+
        Video();
        explicit Video(const Attributes& attribs);
        explicit Video(const std::string& caption, const std::string& icon);
@@ -102,14 +115,23 @@ public:
        void makeActive();
        void swap();
 
+       int getWidth() const;
+       int getHeight() const;
+
 
-       struct Exception : public std::runtime_error
+       struct Exception : public Mf::Exception
        {
-               explicit Exception(const std::string& what_arg) :
-                       std::runtime_error(what_arg) {}
+               explicit Exception(unsigned error) :
+                       Mf::Exception(error) {}
+
+               void raise()
+               {
+                       throw *this;
+               }
        };
 
 private:
+
        void init(const Attributes& attribs);
 
        void recreateContext();
@@ -117,12 +139,12 @@ private:
 
        void setIcon();
 
-       SDL_Surface* context_;
-       unsigned flags_;
-       Attributes attribs_;
-};
+       // TODO this implementation should be hidden
 
-typedef boost::shared_ptr<Video> VideoPtr;
+       SDL_Surface*    mContext;
+       unsigned                mFlags;
+       Attributes              mAttribs;
+};
 
 
 } // namespace Mf
This page took 0.01965 seconds and 4 git commands to generate.