[英]Text rotation in slick2d
How can I rotate the text drawing with Unicodefont. 如何使用Unicodefont旋转文本绘图。 I can draw text using any font in this way.
我可以通过这种方式使用任何字体绘制文本。
UnicodeFont font = new UnicodeFont(fontpath,fontsize, false, false);
font.drawString(0,0,"hoge");
But I can not find any rotation method. 但是我找不到任何旋转方法。 If I can convert the drawing text to Image object, I can rotate.
如果可以将图形文本转换为Image对象,则可以旋转。
Kenichi. 健一。 To rotate the text, you must do the following.
要旋转文本,您必须执行以下操作。
Add the following line to the top of your file in the imports: 将以下行添加到导入文件的顶部:
import static org.lwjgl.opengl.GL11.*;
After this, you must modify your code to say this: 之后,您必须修改您的代码以这样说:
UnicodeFont font = new UnicodeFont(fontpath,fontsize, false, false);
glRotatef(90, 0, 0, 1);
font.drawString(0,0,"hoge");
The glRotatef(float, float, float, float)
method is part of LWJGL and rotates on the Z axis 90 degrees. glRotatef(float, float, float, float)
方法是LWJGL的一部分,并在Z轴上旋转90度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.