]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Video.hh
destroyed global classes; view hierarchy instead
[chaz/yoink] / src / Moof / Video.hh
index 9b1a092332203b3e31291109413cb31e6abaa8bf..d20ce4e5ff58c1d2d0af7dcd0611edd6844195ba 100644 (file)
 #include <boost/shared_ptr.hpp>
 #include <SDL/SDL.h>
 
-#include <Moof/Core.hh>
+#include <Moof/Backend.hh>
+#include <Moof/Dispatch.hh>
 
 
 namespace Mf {
 
+class Settings;
 
 class Video;
 typedef boost::shared_ptr<Video> VideoP;
@@ -34,48 +36,48 @@ public:
        struct Attributes
        {
                // OpenGL attributes
-               long            colorBuffer[4]; // rgba
-               long            frameBuffer;
+               int                     colorBuffer[4]; // rgba
+               int                     frameBuffer;
                bool            doubleBuffer;
-               long            depthBuffer;
-               long            stencilBuffer;
-               long            accumBuffer[4]; // rgba
+               int                     depthBuffer;
+               int                     stencilBuffer;
+               int                     accumBuffer[4]; // rgba
                bool            stereo;
-               long            multisampleBuffers;
-               long            multisampleSamples;
+               int                     multisampleBuffers;
+               int                     multisampleSamples;
                bool            swapControl;
                bool            hardwareOnly;
 
                // Window attributes
                std::string     caption;
                std::string     icon;
-               long            mode[3];                // width, height, bpp
+               int                     mode[3];                // width, height, bpp
                bool            fullscreen;
                bool            resizable;
                bool            cursorVisible;
                bool            cursorGrab;
 
                Attributes();
+               Attributes(const Settings& settings);
 
        private:
 
-               Backend         mBackend;
+               void init();
 
+               Backend         mBackend;
        };
 
 
-       static VideoP alloc(const std::string& caption,
-                                               const std::string& icon)
+       static VideoP alloc(const Attributes& attribs)
        {
-               return VideoP(new Video(caption, icon));
+               return VideoP(new Video(attribs));
        }
 
        Video();
        explicit Video(const Attributes& attribs);
-       Video(const std::string& caption, const std::string& icon);
        ~Video();
 
-       void setVideoMode(const long mode[3]);
+       void setVideoMode(const int mode[3]);
        Attributes getAttributes() const;
 
        void resize(int width, int height);
@@ -107,6 +109,15 @@ public:
        int getWidth() const;
        int getHeight() const;
 
+       static Video* current()
+       {
+               return gCurrentVideo;
+       }
+
+       void makeCurrent() const;
+
+       void setDispatch(Dispatch& dispatch);
+
 private:
 
        void init();
@@ -118,13 +129,13 @@ private:
 
        // TODO this implementation should be hidden
 
-       SDL_Surface*    mContext;
-       unsigned                mFlags;
-       Attributes              mAttribs;
-};
+       SDL_Surface*            mContext;
+       unsigned                        mFlags;
+       Attributes                      mAttribs;
+       Dispatch&                       mDispatch;
 
-
-extern Video* video;
+       static Video*           gCurrentVideo;
+};
 
 
 } // namespace Mf
This page took 0.026645 seconds and 4 git commands to generate.