]> git.tdb.fi Git - libs/gl.git/blob - source/render/windowview.h
031cd49d142534049e96be8dd137fa27c83730ed
[libs/gl.git] / source / render / windowview.h
1 #ifndef MSP_GL_WINDOWVIEW_H_
2 #define MSP_GL_WINDOWVIEW_H_
3
4 #include <sigc++/trackable.h>
5 #include <msp/graphics/window.h>
6 #include "device.h"
7 #include "view.h"
8
9 namespace Msp {
10 namespace GL {
11
12 /**
13 A view targeting a Graphics::Window.
14
15 After rendering, buffers are swapped to show the result in the window.
16
17 The aspect ratio of the view's Camera is automatically updated to match that of
18 the window.
19 */
20 class WindowView: public View, public sigc::trackable
21 {
22 private:
23         Graphics::Window &window;
24         Device &device;
25
26 public:
27         WindowView(Graphics::Window &);
28
29         Graphics::Window &get_window() { return window; }
30         virtual unsigned get_width() const { return window.get_width(); }
31         virtual unsigned get_height() const { return window.get_height(); }
32
33         using View::render;
34         virtual void render(Renderer &);
35
36 private:
37         void window_resized(unsigned, unsigned);
38
39         virtual const Framebuffer &get_target() const;
40 };
41
42 } // namespace GL
43 } // namespace Msp
44
45 #endif