JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
OutlinedFont.hpp
Go to the documentation of this file.
1// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include "font.hpp"
8
9namespace jngl {
10
13public:
15 OutlinedFont(const std::string& filename, unsigned int size, float strokePercentage);
16
18 void print(const Mat3& modelview, const std::string& text, jngl::Rgba innerColor,
19 jngl::Rgba outerColor) const;
20
24
25private:
26 jngl::Font inner;
27 jngl::Font outer;
28};
29
30} // namespace jngl
Font loaded from a TTF or OTF file.
Definition font.hpp:20
3x3 matrix
Definition Mat3.hpp:18
Same as jngl::Font but adds an outline.
double getTextWidth(std::string_view)
Calculates the width of text in scale-independent pixels if it would be drawn with this font.
void print(const Mat3 &modelview, const std::string &text, jngl::Rgba innerColor, jngl::Rgba outerColor) const
Print text using modelview in innerColor and an outline in outerColor.
OutlinedFont(const std::string &filename, unsigned int size, float strokePercentage)
Set strokePercentage to a positive value in %, e.g. 5 to add an outline of 5% to the font.
Object representing a RGBA color.
Definition Rgba.hpp:22
Contains jngl::Font class and related functions.
JNGL's main namespace.
jngl::Mat3 modelview()
Returns a copy of the global ModelView matrix.