为什么我的 UnicodeFont (Slick2D) 不绘制?
所以我尝试使用 Slick2D 的 UnicodeFont 绘制字体。加载字体的代码:
Font font = new Font("Arial", Font.BOLD, 20);
UnicodeFont uFont = new UnicodeFont(font);
uFont.addAsciiGlyphs();
uFont.getEffects().add(new ColorEffect(java.awt.Color.BLACK));
uFont.loadGlyphs();
它或多或少是从 wiki 复制和粘贴的。接下来,在一个帧中,我使用 gluOrtho2d() 并重置投影和模型视图矩阵。然后我调用
this.font.drawString(100, 50, "some text goes here");
实际绘制文本。但我得到的只是一个空屏幕,没有任何错误。
So I am trying to draw a font using Slick2D's UnicodeFont. The code that loads the font:
Font font = new Font("Arial", Font.BOLD, 20);
UnicodeFont uFont = new UnicodeFont(font);
uFont.addAsciiGlyphs();
uFont.getEffects().add(new ColorEffect(java.awt.Color.BLACK));
uFont.loadGlyphs();
It's more or less copied and pasted from the wiki. Next, during a frame I use gluOrtho2d() and reset the projection and modelview matrices. Then I call
this.font.drawString(100, 50, "some text goes here");
to actually draw the text. But all I get is an empty screen, an no errors of any kind.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑到 UnicodeFonts 在当前版本的 slick 2d 中已被弃用,我建议您按照我的步骤在这个相关问题上使用 AngelCodeFonts:Slick2D 字体不起作用
Considering that UnicodeFonts are depreciated in the current version of slick 2d, I recomend you folow my steps for using AngelCodeFonts on this related question: Slick2D Fonts don't work