7#include <aegis2d/render/export.hpp>
99 [[nodiscard]] const
GlyphGrid& grid() const noexcept;
104 [[nodiscard]]
float line_height(
float scale = 1.0F) const noexcept;
112 [[nodiscard]]
Vec2 measure(
std::string_view text,
float scale = 1.0F) const noexcept;
122 [[nodiscard]]
std::
string wrap(
std::string_view text,
float width,
float scale = 1.0F) const;
Monospaced font whose glyphs are cells of a texture, drawn as sprites.
Definition bitmap_font.hpp:68
static Image builtin_image()
Atlas image of the built-in font.
static GlyphGrid builtin_grid() noexcept
Layout of the built-in font's atlas.
static BitmapFont builtin(TextureManager &textures)
The engine's built-in font: printable ASCII, 5 x 8 pixel glyphs (descenders included),...
BitmapFont(TextureId atlas, const GlyphGrid &grid)
Uses an atlas texture laid out as grid.
What the game draws with, whatever the graphics API behind it.
Definition renderer.hpp:81
The game's textures, each loaded once and found by a name such as "player".
Definition texture_manager.hpp:33
RGBA color used by the renderer.
Images in memory: loaded from files, generated by the engine, saved as PNG.
Vector and matrix types of the engine (GLM behind engine names).
OpenGL renderer: sprites, text and camera (client only).
Definition bitmap_font.hpp:16
aegis2d::Vec2 Vec2
2D vector of floats, in logical pixels: the engine-wide aegis2d::Vec2.
Definition renderer.hpp:17
std::uint32_t TextureId
Identifier of a texture loaded by the resource manager.
Definition renderer.hpp:32
Definition endpoint.hpp:85
Backend-independent renderer interface and the sprite it draws.
RGBA color with components in [0, 1].
Definition color.hpp:10
float r
Red component.
Definition color.hpp:12
Layout of a font's atlas: a grid of cells holding consecutive characters.
Definition bitmap_font.hpp:21
int glyph_width
Width of the drawn part of a cell, in pixels.
Definition bitmap_font.hpp:33
char fallback
Character drawn for those the font does not have.
Definition bitmap_font.hpp:45
char last
Character of the last cell.
Definition bitmap_font.hpp:43
int cell_height
Height of a cell, in pixels.
Definition bitmap_font.hpp:31
char first
Character of the first cell.
Definition bitmap_font.hpp:41
int columns
Cells per row of the atlas.
Definition bitmap_font.hpp:27
int cell_width
Width of a cell, in pixels.
Definition bitmap_font.hpp:29
int atlas_height
Height of the atlas, in pixels.
Definition bitmap_font.hpp:25
int advance
Distance from one character to the next on a line, in pixels.
Definition bitmap_font.hpp:37
int atlas_width
Width of the atlas, in pixels.
Definition bitmap_font.hpp:23
int line_height
Distance from one line to the next, in pixels.
Definition bitmap_font.hpp:39
int glyph_height
Height of the drawn part of a cell, in pixels.
Definition bitmap_font.hpp:35
RGBA image with 8 bits per channel, ready to become a texture.
Definition image.hpp:25
How a text is drawn.
Definition bitmap_font.hpp:49
float scale
Size of a font pixel on screen, in logical pixels: 1 for the font's own size.
Definition bitmap_font.hpp:51
std::int32_t layer
Layer of the text's sprites.
Definition bitmap_font.hpp:55
Color color
Color of the text, multiplied with the atlas.
Definition bitmap_font.hpp:53
Textures loaded once and found by name.