// Copyright (c) 2022 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "display/Color.hpp" #include "display/RenderTarget.hpp" namespace Dawn { class BackBufferRenderTarget final : public RenderTarget { private: float_t width = 1; float_t height = 1; struct Color clearColor = COLOR_CORNFLOWER_BLUE; public: float_t scale = 1.0f; /** * Construct the back buffer render target. */ BackBufferRenderTarget(); float_t getScale() override; float_t getWidth() override; float_t getHeight() override; void setClearColor(const struct Color color) override; void clear(const int32_t) override; void bind() override; /** * Requests to modify the viewport directly. This is mostly to be called * by whatever is setting the window/display resolution, so that the * backbuffer can keep track of what the viewport size is. This should * also be DPI aware, e.g. "4k @ 2xDPI, resulting in a 1080p equiv" should * still call this method with 3840, 2160. * * @param width New width of the back buffer. * @param height New height of the back buffer. */ void setSize(const float_t width, const float_t height); }; }