如何使用位图字体作为场景2d演员? [英] How to use Bitmap font as scene 2d actor?
问题描述
我正在使用libgdx框架开发游戏.如何在位图字体对象上实现scene2d动作?这样我就可以写一些诸如乐谱,消息之类的文本,并执行诸如scene2d actor之类的动作.
I am developing a game using libgdx framework. How can i achieve scene2d action on bitmap font object ? so that i can write some text like score,message and run action like scene2d actor.
推荐答案
看看 LabelStyle .初始化LabelStyle时,可以提供BitmapFont.
Take a look at the Label class, particularly the constructor that takes a CharSequence and a LabelStyle. When you initialize your LabelStyle you can supply a BitmapFont.
请注意,如果您想缩放或旋转标签,则需要将其包装在表并启用了setTransform(). (这会刷新SpriteBatch,因此请明智地使用它.)
Please note, if you'd like to scale or rotate the label you'll need to wrap it in a Container or add it to Table with setTransform() enabled. (This flushes the SpriteBatch so use it wisely.)
这篇关于如何使用位图字体作为场景2d演员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!