7#include <aegis2d/render/export.hpp>
52 [[nodiscard]]
constexpr bool empty() const noexcept {
return width <= 0 ||
height <= 0; }
79 Vec2 framebuffer)
noexcept;
RGBA color used by the renderer.
Vector and matrix types of the engine (GLM behind engine names).
OpenGL renderer: sprites, text and camera (client only).
Definition bitmap_font.hpp:16
Letterbox letterbox(Vec2 logical, int width, int height, ScaleMode mode=ScaleMode::Fit) noexcept
Fits a logical screen into a framebuffer, centered, keeping its aspect ratio.
aegis2d::Vec2 Vec2
2D vector of floats, in logical pixels: the engine-wide aegis2d::Vec2.
Definition renderer.hpp:17
ScaleMode
How a logical screen is scaled to the window.
Definition letterbox.hpp:14
@ Fit
As large as the window allows: the whole window is used on one axis.
@ Integer
The largest whole scale (x1, x2, x3...), so every logical pixel covers the same number of window pixe...
Vec2 to_logical(const Letterbox &box, Vec2 framebuffer) noexcept
Logical pixel under a point of the framebuffer, such as the mouse.
RGBA color with components in [0, 1].
Definition color.hpp:10
float r
Red component.
Definition color.hpp:12
Where the logical screen goes in the window's framebuffer.
Definition letterbox.hpp:38
int y
Top edge, in framebuffer pixels from the top.
Definition letterbox.hpp:42
int height
Height in framebuffer pixels.
Definition letterbox.hpp:46
int x
Left edge, in framebuffer pixels from the left.
Definition letterbox.hpp:40
float scale
Framebuffer pixels per logical pixel; 0 when nothing is shown.
Definition letterbox.hpp:48
constexpr bool empty() const noexcept
Tells whether the logical screen covers no pixel (a minimized window).
Definition letterbox.hpp:52
int width
Width in framebuffer pixels.
Definition letterbox.hpp:44
friend constexpr bool operator==(const Letterbox &, const Letterbox &) noexcept=default
Compares the areas.
The game's screen at a fixed size, whatever the window's.
Definition letterbox.hpp:28
Color bars
Color of the bars around the screen.
Definition letterbox.hpp:34
Vec2 size
Width and height in logical pixels, such as 1280 x 720.
Definition letterbox.hpp:30
ScaleMode mode
How the screen is scaled.
Definition letterbox.hpp:32