因此,我正在使用批处理,并在start()
和end()
之间,我试图绘制两个纹理。但是,其中只有一个正在绘制。我尝试删除正在绘制的图像,以查看其他图层是否会绘制,但该特定纹理仍不会绘制。纹理的设置方式完全相同,唯一的区别是没有绘制的纹理包含一些透明度。LibGDX纹理不会绘制
private static Texture bg1 = new Texture(Gdx.files.internal("bg1.png"));
private static Texture bg2 = new Texture(Gdx.files.internal("bg2.png"));
private static int bgx1 = 0, bgx2 = 0;
public static void create() {
bg1.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
bg2.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
}
public static void render() {
bgx1 += 1; bgx2 += 1.7;
Core.batch.draw(bg1, 0, 0, bgx1, 0, Gdx.graphics.getWidth(), bg1.getHeight());
Core.batch.draw(bg2, 0, 0, bgx2, 0, Gdx.graphics.getWidth(), bg2.getHeight());
}
欢迎使用stackoverflow。请检查以下页面,并更新您的问题:http://stackoverflow.com/help/how-to-ask – Xoppa
嗯,我试图添加类的代码,但它格式化可怕 – GiraffeKey
请[编辑您的问题](http: //stackoverflow.com/posts/42588367/edit)包含代码,而不是将代码放在评论中。 – SomethingDark