Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
letterbox.hpp File Reference

A fixed logical screen scaled into a window of any size, keeping its aspect ratio. More...

#include <aegis2d/core/math.hpp>
#include <aegis2d/render/color.hpp>
#include <aegis2d/render/export.hpp>
#include <cstdint>

Go to the source code of this file.

Classes

struct  aegis2d::render::LogicalScreen
 The game's screen at a fixed size, whatever the window's. More...
 
struct  aegis2d::render::Letterbox
 Where the logical screen goes in the window's framebuffer. More...
 

Namespaces

namespace  aegis2d
 Root namespace of the engine.
 
namespace  aegis2d::render
 OpenGL renderer: sprites, text and camera (client only).
 

Enumerations

enum class  aegis2d::render::ScaleMode : std::uint8_t { aegis2d::render::Fit , aegis2d::render::Integer }
 How a logical screen is scaled to the window. More...
 

Functions

Letterbox aegis2d::render::letterbox (Vec2 logical, int width, int height, ScaleMode mode=ScaleMode::Fit) noexcept
 Fits a logical screen into a framebuffer, centered, keeping its aspect ratio.
 
Vec2 aegis2d::render::to_logical (const Letterbox &box, Vec2 framebuffer) noexcept
 Logical pixel under a point of the framebuffer, such as the mouse.
 

Detailed Description

A fixed logical screen scaled into a window of any size, keeping its aspect ratio.