]> git.tdb.fi Git - libs/gl.git/blob - source/render/windowview.h
Write access can't get into an unary operator from outside
[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/glcontext.h>
6 #include <msp/graphics/window.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         Graphics::GLContext &context;
25
26 public:
27         WindowView(Graphics::Window &, Graphics::GLContext &);
28
29         Graphics::Window &get_window() { return window; }
30         Graphics::GLContext &get_context() { return context; }
31         virtual unsigned get_width() const { return window.get_width(); }
32         virtual unsigned get_height() const { return window.get_height(); }
33
34         using View::render;
35         virtual void render(Renderer &);
36
37 private:
38         void window_resized(unsigned, unsigned);
39 };
40
41 } // namespace GL
42 } // namespace Msp
43
44 #endif