]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/windowview.h
Don't store a View's target framebuffer in the base class
[libs/gl.git] / source / render / windowview.h
index ee7c44dce994268f8b75555b576609e1386221e4..031cd49d142534049e96be8dd137fa27c83730ed 100644 (file)
@@ -1,24 +1,32 @@
 #ifndef MSP_GL_WINDOWVIEW_H_
 #define MSP_GL_WINDOWVIEW_H_
 
-#include <msp/graphics/glcontext.h>
+#include <sigc++/trackable.h>
 #include <msp/graphics/window.h>
+#include "device.h"
 #include "view.h"
 
 namespace Msp {
 namespace GL {
 
-class WindowView: public View
+/**
+A view targeting a Graphics::Window.
+
+After rendering, buffers are swapped to show the result in the window.
+
+The aspect ratio of the view's Camera is automatically updated to match that of
+the window.
+*/
+class WindowView: public View, public sigc::trackable
 {
 private:
        Graphics::Window &window;
-       Graphics::GLContext &context;
+       Device &device;
 
 public:
-       WindowView(Graphics::Window &, Graphics::GLContext &);
+       WindowView(Graphics::Window &);
 
        Graphics::Window &get_window() { return window; }
-       Graphics::GLContext &get_context() { return context; }
        virtual unsigned get_width() const { return window.get_width(); }
        virtual unsigned get_height() const { return window.get_height(); }
 
@@ -27,6 +35,8 @@ public:
 
 private:
        void window_resized(unsigned, unsigned);
+
+       virtual const Framebuffer &get_target() const;
 };
 
 } // namespace GL