+#include "device.h"
+#include "windowview.h"
#include "windowview_backend.h"
namespace Msp {
namespace GL {
+void OpenGLWindowView::render(Renderer &renderer)
+{
+ View::render(renderer);
+ Device &device = static_cast<WindowView *>(this)->device;
+ device.get_context().swap_buffers();
+}
+
void OpenGLWindowView::resize_framebuffer(unsigned w, unsigned h)
{
sys_framebuf.resize(w, h);
OpenGLWindowView() = default;
+ virtual void render(Renderer &);
virtual const Framebuffer &get_target() const { return sys_framebuf; }
void resize_framebuffer(unsigned, unsigned);
window_resized(window.get_width(), window.get_height());
}
-void WindowView::render(Renderer &renderer)
-{
- View::render(renderer);
- device.get_context().swap_buffers();
-}
-
void WindowView::window_resized(unsigned w, unsigned h)
{
resize_framebuffer(w, h);
/**
A view targeting a Graphics::Window.
-After rendering, buffers are swapped to show the result in the window.
+After rendering, the result is presented in the window.
The aspect ratio of the view's Camera is automatically updated to match that of
the window.
*/
class WindowView: public WindowViewBackend, public sigc::trackable
{
+ friend WindowViewBackend;
+
private:
Graphics::Window &window;
Device &device;
virtual unsigned get_height() const { return window.get_height(); }
using View::render;
- virtual void render(Renderer &);
private:
void window_resized(unsigned, unsigned);