2#ifndef LIBSBX_GRAPHICS_VIEWPORT_HPP_
3#define LIBSBX_GRAPHICS_VIEWPORT_HPP_
9#include <libsbx/math/vector2.hpp>
11namespace sbx::graphics {
17 enum class kind : std::uint8_t {
22 inline static constexpr auto window_name = std::string_view{
"window"};
28 static auto fixed(
const std::uint32_t width,
const std::uint32_t height) ->
viewport {
48 auto size()
const noexcept ->
const std::optional<math::vector2u>& {
52 auto is_fixed()
const noexcept ->
bool {
53 return _kind == kind::fixed;
56 auto is_named()
const noexcept ->
bool {
57 return _kind == kind::named;
60 auto name()
const noexcept ->
const std::string& {
68 _name{std::move(name)},
77 std::optional<math::vector2u> _size;
88 _aspect_ratio{extent.y() == 0u ? 1.0f :
static_cast<std::float_t
>(extent.x()) /
static_cast<std::float_t
>(extent.y())} { }
90 auto operator==(
const render_area& other)
const noexcept ->
bool {
91 return _extent == other._extent && _offset == other._offset;
110 auto aspect_ratio()
const noexcept -> std::float_t {
111 return _aspect_ratio;
114 auto set_aspect_ratio(std::float_t aspect_ratio)
noexcept ->
void {
115 _aspect_ratio = aspect_ratio;
122 std::float_t _aspect_ratio;
Definition: viewport.hpp:81
Definition: viewport.hpp:13
A vector in two-dimensional space.
Definition: vector2.hpp:28