]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Video.hh
refactoring needed for win32 crash
[chaz/yoink] / src / Moof / Video.hh
index a76dca268ef052f136124bc425769d6f65a32f72..0199bc51dc43e3a38508fae9da2d81149b4a7ac0 100644 (file)
 
 #include <SDL/SDL.h>
 
+#include <Moof/Core.hh>
+
 
 namespace Mf {
 
 
+class Video;
+typedef boost::shared_ptr<Video> VideoP;
+
+
 class Video
 {
 public:
+
        struct Attributes
        {
                // OpenGL attributes
-               long    colorBuffer[4]; // rgba
-               long    frameBuffer;
-               bool    doubleBuffer;
-               long    depthBuffer;
-               long    stencilBuffer;
-               long    accumBuffer[4]; // rgba
-               bool    stereo;
-               long    multisampleBuffers;
-               long    multisampleSamples;
-               bool    swapControl;
-               bool    hardwareonly;
+               long            colorBuffer[4]; // rgba
+               long            frameBuffer;
+               bool            doubleBuffer;
+               long            depthBuffer;
+               long            stencilBuffer;
+               long            accumBuffer[4]; // rgba
+               bool            stereo;
+               long            multisampleBuffers;
+               long            multisampleSamples;
+               bool            swapControl;
+               bool            hardwareonly;
 
                // Window attributes
-               long    mode[3];                // width, height, bpp
-               bool    fullscreen;
-               bool    resizable;
-               bool    cursorVisible;
-               bool    cursorGrab;
+               std::string     caption;
+               std::string     icon;
+               long            mode[3];                // width, height, bpp
+               bool            fullscreen;
+               bool            resizable;
+               bool            cursorVisible;
+               bool            cursorGrab;
 
                Attributes();
+
+       private:
+
+               Backend         backend;
        };
 
+
+       static VideoP alloc(const std::string& caption, const std::string& icon)
+       {
+               return VideoP(new Video(caption, icon));
+       }
+
        Video();
-       Video(const Attributes& attribs);
-       Video(const Attributes& attribs, const std::string& caption);
-       Video(const std::string& caption);
+       explicit Video(const Attributes& attribs);
+       Video(const std::string& caption, const std::string& icon);
        ~Video();
 
        void setVideoMode(const long mode[3]);
@@ -82,6 +100,8 @@ public:
        void setCaption(const std::string& caption);
        std::string getCaption() const;
 
+       const std::string& getIcon() const;
+
        void setFull(bool full);
        void toggleFull();
        bool isFull() const;
@@ -98,27 +118,29 @@ public:
        void toggleCursorGrab();
        bool isCursorGrab() const;
 
-       void makeActive();
        void swap();
 
-
-       struct Exception : public std::runtime_error
-       {
-               explicit Exception(const std::string& what_arg) :
-                       std::runtime_error(what_arg) {}
-       };
+       int getWidth() const;
+       int getHeight() const;
 
 private:
-       void init(const Attributes& attribs, const std::string& caption);
+
+       void init(const Attributes& attribs);
+
        void recreateContext();
        void setOpenGLAttributes();
 
-       SDL_Surface* context_;
-       unsigned flags_;
-       Attributes attribs_;
+       void setIcon();
+
+       // TODO this implementation should be hidden
+
+       SDL_Surface*    mContext;
+       unsigned                mFlags;
+       Attributes              mAttribs;
 };
 
-typedef boost::shared_ptr<Video> VideoPtr;
+
+extern Video* video;
 
 
 } // namespace Mf
This page took 0.020778 seconds and 4 git commands to generate.