]> git.tdb.fi Git - libs/gl.git/blob - source/view.h
Add some accessors to View
[libs/gl.git] / source / view.h
1 #ifndef MSP_GL_VIEW_H_
2 #define MSP_GL_VIEW_H_
3
4 #include <list>
5 #include <msp/graphics/glcontext.h>
6 #include <msp/graphics/window.h>
7
8 namespace Msp {
9 namespace GL {
10
11 class Camera;
12 class Framebuffer;
13 class Renderable;
14
15 /**
16 Manages the presentation of rendering results on the screen.
17 */
18 class View
19 {
20 private:
21         Graphics::Window &window;
22         Graphics::GLContext &context;
23         Framebuffer &target;
24         const Renderable *content;
25         std::list<Camera *> synced_cameras;
26
27 public:
28         View(Graphics::Window &, Graphics::GLContext &);
29
30         Graphics::Window &get_window() { return window; }
31         Graphics::GLContext &get_context() { return context; }
32         unsigned get_width() const { return window.get_width(); }
33         unsigned get_height() const { return window.get_height(); }
34
35         void set_content(const Renderable *);
36         void synchronize_camera_aspect(Camera &);
37
38         void render();
39
40 private:
41         void window_resized(unsigned, unsigned);
42 };
43
44 } // namespace GL
45 } // namespace Msp
46
47 #endif