#include <SDL/SDL.h>
+#include <Moof/Exception.hh>
+
namespace Mf {
typedef boost::shared_ptr<Video> VideoP;
-struct Video
+class Video
{
+public:
+
struct Attributes
{
// OpenGL attributes
};
-private:
-
- void init(const Attributes& attribs);
-
- void recreateContext();
- void setOpenGLAttributes();
-
- void setIcon();
-
- SDL_Surface* context_;
- unsigned flags_;
- Attributes attribs_;
-
-public:
-
- inline static VideoP alloc(const std::string& caption,
- const std::string& icon)
+ static VideoP alloc(const std::string& caption, const std::string& icon)
{
return VideoP(new Video(caption, icon));
}
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();
+ void setOpenGLAttributes();
+
+ void setIcon();
+
+ // TODO this implementation should be hidden
+
+ SDL_Surface* mContext;
+ unsigned mFlags;
+ Attributes mAttribs;
};