]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Video.hh
new win32 deps script; using pkgconfig for openal
[chaz/yoink] / src / Moof / Video.hh
index 9b1a092332203b3e31291109413cb31e6abaa8bf..8d8e6f3e16a6b4685746e43a64b17e2eae51d0da 100644 (file)
 #include <boost/shared_ptr.hpp>
 #include <SDL/SDL.h>
 
-#include <Moof/Core.hh>
+#include <Moof/Backend.hh>
 
 
 namespace Mf {
 
 
+class Settings;
+
 class Video;
 typedef boost::shared_ptr<Video> VideoP;
 
@@ -34,49 +36,49 @@ 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]);
-       Attributes getAttributes() const;
+       void setVideoMode(const int mode[3]);
+       Attributes attributes() const;
 
        void resize(int width, int height);
        bool iconify();
@@ -107,6 +109,13 @@ public:
        int getWidth() const;
        int getHeight() const;
 
+       void makeCurrent() const;
+
+       static Video* current()
+       {
+               return gCurrentVideo;
+       }
+
 private:
 
        void init();
@@ -118,13 +127,12 @@ private:
 
        // TODO this implementation should be hidden
 
-       SDL_Surface*    mContext;
-       unsigned                mFlags;
-       Attributes              mAttribs;
-};
+       SDL_Surface*            mContext;
+       unsigned                        mFlags;
+       Attributes                      mAttribs;
 
-
-extern Video* video;
+       static Video*           gCurrentVideo;
+};
 
 
 } // namespace Mf
This page took 0.022047 seconds and 4 git commands to generate.