/*] Copyright (c) 2009-2010, Charles McGarvey [**************************
**] All rights reserved.
*
-* vi:ts=8 sw=4 tw=75
+* 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.
#include <string>
#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;
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();
int getWidth() const;
int getHeight() const;
+ void makeCurrent() const;
+
+ static Video* current()
+ {
+ return gCurrentVideo;
+ }
+
private:
void init();
// 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