XNA文字绘制

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012278016/article/details/83384672

使用SpriteFontX 库:

链接:https://pan.baidu.com/s/1vlLEz0EXE3KRF9i9_XoJpQ 
提取码:n2sw

例子:

SpriteFontX spriteFontX1;
spriteFontX1 = new SpriteFontX(new System.Drawing.Font("宋体", 12f),  //设定字体,样式,大小
                GraphicsDeviceService,
                System.Drawing.Text.TextRenderingHint.AntiAliasGridFit);  //影响文字绘制质量(反锯齿等)根据情况自行选择
spriteFontX1.Spacing.X = 1f; //字间距设置

// string contect; 为要输出的内容		
spriteFontX.Draw(spriteBatch, contect.ToCharArray(), pos, new Vector2(600, 0), new Vector2(1f, 1f), color);	

猜你喜欢

转载自blog.csdn.net/u012278016/article/details/83384672