我有一个SelectBox可以获取基本上封装了图像和一些更多细节的对象列表。我想显示那个TextureRegion,而不是显示文本。在Libgdx/Scene2D中查看图像SelectBox
我怎么会去吗?就我所见,默认情况下,SelectBox显示toString()。
所以我的课看起来像(有点简单化了):
public class Image
{
private Vector2 position;
private TextureRegion sprite;
public Image(Vector2 position) {...}
public void render(SpriteBatch batch) { batch.draw{this.sprite, this.position.x ...}
public String toString() { return "Position: " + position; }
}
SelectBox<Image> selectBox = ... // fetch data
我需要创建自己的SelectBoxStyle?如果是这样,我怎么能覆盖它绘制TextureRegion而不是文本?
您是否找到解决方案? –
@BillLin:我不再在这个项目上工作了,但也许看看可用的一个答案 – Sorona