105void setFontColor(
unsigned char red,
unsigned char green,
unsigned char blue,
106 unsigned char alpha = 255);
109void pushFontColor(
unsigned char red,
unsigned char green,
unsigned char blue);
Contains jngl::Rgb class.
Contains jngl::Rgba class.
Contains jngl::Vec2 class.
Font loaded from a TTF or OTF file.
void print(const Mat3 &modelview, const std::string &text, Rgba color) const
Draw text using modelview in color.
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 std::string &, int x, int y)
Uses the font to print something at x y. The color can be specified using setFontColor.
std::shared_ptr< FontImpl > getImpl()
Internal function.
void print(const std::string &text, Vec2 position) const
Draw text at position. The color can be specified using setFontColor.
Font(const std::string &filename, unsigned int size, float strokePercentage=0)
Creates a font from filename in size px.
void print(const Mat3 &modelview, const std::string &text) const
Draw text using modelview. The color can be specified using setFontColor.
Object representing a RGB color, new version of jngl::Color (which will be deprecated in the future)
Object representing a RGBA color.
double getLineHeight()
Get line height used py print() in scale-independent pixel.
int getFontSize()
Get the font size used by print()
void pushFontColor(unsigned char red, unsigned char green, unsigned char blue)
Pushes the currently active font color on a stack and sets a new one.
void setFontSize(int size)
Change the font size used by print()
void popFontColor()
Resets the font color on the top of stack which is used by jngl::pushFontColor.
void print(const std::string &text, jngl::Vec2 position)
Print text at position.
void setFontColor(Rgba)
Sets the color and alpha value of the currently active font.
void setFontByName(const std::string &name)
Sets the currently active font by a font name.
void setLineHeight(double)
Set line height used by print() in scale-independent pixel.
void setFont(const std::string &filename)
Sets the currently active font to filename.
std::string getFont()
Returns the currently active font name.
jngl::Mat3 modelview()
Returns a copy of the global ModelView matrix.
double getTextWidth(const std::string &text)
Calculates the width of text in scale-independent pixels if it would be drawn with the currently acti...