+++ /dev/null
-
-/*] Copyright (c) 2009-2010, Charles McGarvey [**************************
-**] All rights reserved.
-*
-* vi:ts=4 sw=4 tw=75
-*
-* Distributable under the terms and conditions of the 2-clause BSD license;
-* see the file COPYING for a complete text of the license.
-*
-**************************************************************************/
-
-#ifndef _MOOF_VIDEO_HH_
-#define _MOOF_VIDEO_HH_
-
-#include <string>
-
-#include <boost/shared_ptr.hpp>
-#include <SDL/SDL.h>
-
-#include <Moof/Backend.hh>
-
-
-namespace Mf {
-
-
-class Settings;
-
-class Video;
-typedef boost::shared_ptr<Video> VideoP;
-
-
-class Video
-{
-public:
-
- struct Attributes
- {
- // OpenGL attributes
- int colorBuffer[4]; // rgba
- int frameBuffer;
- bool doubleBuffer;
- int depthBuffer;
- int stencilBuffer;
- int accumBuffer[4]; // rgba
- bool stereo;
- int multisampleBuffers;
- int multisampleSamples;
- bool swapControl;
- bool hardwareOnly;
-
- // Window attributes
- std::string caption;
- std::string icon;
- int mode[3]; // width, height, bpp
- bool fullscreen;
- bool resizable;
- bool cursorVisible;
- bool cursorGrab;
-
- Attributes();
- Attributes(const Settings& settings);
-
- private:
-
- void init();
-
- Backend mBackend;
- };
-
-
- static VideoP alloc(const Attributes& attribs)
- {
- return VideoP(new Video(attribs));
- }
-
- Video();
- explicit Video(const Attributes& attribs);
- ~Video();
-
- void setVideoMode(const int mode[3]);
- Attributes attributes() const;
-
- void resize(int width, int height);
- bool iconify();
-
- void setCaption(const std::string& caption);
- std::string getCaption() const;
-
- const std::string& getIcon() const;
-
- void setFull(bool full);
- void toggleFull();
- bool isFull() const;
-
- void setCursorVisible(bool hasCursor);
- void toggleCursorVisible();
- bool isCursorVisible() const;
-
- void setResizable(bool resizable);
- void toggleResizable();
- bool isResizable() const;
-
- void setCursorGrab(bool cursorGrab);
- void toggleCursorGrab();
- bool isCursorGrab() const;
-
- void swap();
-
- int getWidth() const;
- int getHeight() const;
-
- void makeCurrent() const;
-
- static Video* current()
- {
- return gCurrentVideo;
- }
-
-private:
-
- void init();
-
- void recreateContext();
- void setOpenGLAttributes();
-
- void setIcon();
-
- // TODO this implementation should be hidden
-
- SDL_Surface* mContext;
- unsigned mFlags;
- Attributes mAttribs;
-
- static Video* gCurrentVideo;
-};
-
-
-} // namespace Mf
-
-#endif // _MOOF_VIDEO_HH_
-