View::View(Framebuffer &t):
target(t),
camera(0),
- content(0)
+ content(0),
+ internal_renderer(0)
{ }
+View::~View()
+{
+ delete internal_renderer;
+}
+
void View::set_camera(Camera *c)
{
camera = c;
void View::render()
{
- Renderer renderer;
- render(renderer);
+ if(!internal_renderer)
+ internal_renderer = new Renderer;
+ render(*internal_renderer);
}
void View::render(Renderer &renderer)
Framebuffer ⌖
Camera *camera;
Renderable *content;
+ Renderer *internal_renderer;
View(Framebuffer &);
-
public:
+ virtual ~View();
+
virtual unsigned get_width() const { return target.get_width(); }
virtual unsigned get_height() const { return target.get_height(); }
float get_aspect_ratio() const { return static_cast<float>(get_width())/get_height(); }