Drawing Text
In this article, we will draw Text to the screen.
We will draw both types of fonts, a TrueType font and a Bitmap font.
This article assumes that you have completed the Textures articles,
plus
Adding a TrueType Font
and
Adding a Bitmap SpriteFont.
Let's get started.
Update Game1 to Draw Your Font
Create two font variables in Game1.cs.
Create two Vector2 variables to store each font's screen position.
A font's position should always be a whole number like 1, 256, or 4096.
Never use a decimal or floating point number with a value after the period, like 1.2, or 256.6, or 4096.5.
Such a number will cause the font to be drawn blurry and significantly degrade the readability.
If you want crisp, legible fonts - always use a whole number for positioning.
Load your fonts in Game1.LoadContent().
Draw your fonts in Game1.Draw().
Notice how similar a font's draw call is to a texture's draw call.
Build your project, and view the results.
Summary
You learned how to load and draw fonts to the game's screen.
The next step is to modify the text's position, color, rotation, scale, origin, and effect.
We'll cover this in the next article Modifying Text.