At last, Ms released the long-awaited xna1.0 upgrade package on the 24 th. You can click here to download. On the basis of ensuring compatibility with the original version, this package has improved the class library, including fonts, sound effects, and other aspects.
This section mainly describes how to draw a font. In this version, the font Drawing operation can be greatly simplified. You can use any font installed in the system to display text. According to the methods described in the SDK, content papeline will compile the font you specified into one during compilation. when using the xNb file, you only need to create one spritefont class and then load the file, just as simple as loading the texture. Then, you can use the new method drawstring of spritebatch to display text.
It must be noted that the methods described in the SDK are created in the project. in the spiritfont file, the data between the <fontname> tags is the font name you want to use, such as the common "Times New Roman" and "". Of course, make sure that these fonts are installed in your system. The <Start> marker is the starting character or the number of the actual character, and the <End> marker is the ending character. For example:
<Start> & amp; #32; </start>
<End> & #126; </end>
In Unicode, all characters from 32nd to 126 are generated, that is, English ~ Z, a common symbol, and
<Start> 1 </start>
<End> You </end>
All characters between "1" and "you" are generated. Note: When drawstring is used to display text, the displayed characters must be in the range you specified; otherwise, an exception is thrown. In addition, because there are many Chinese characters, content pipleline takes a lot of time to process these characters, so the first buildProgramIt may be very, very, very slow .....