我有一张背景图片,想在上面画文字,但它不起作用。屏幕上只有图片。
private SpriteBatch spriteBatch;
private Texture splsh;
private BitmapFont font;
public void render(float arg0)
{
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
spriteBatch.begin();
spriteBatch.draw(splsh, 0, 0);
font.draw(spriteBatch, "test", 10, 480);
spriteBatch.end();
}
public void show()
{
spriteBatch = new SpriteBatch();
splsh = new Texture(Gdx.files.internal("bg2.png"));
font = new BitmapFont();
font.setColor(Color.RED);
}