特定的tools.png纹理未显示
Tools.png和TopBanner.png都在我的资产文件夹中,并且是有效文件 这是我的调整大小功能,除了工具以及我的创建和渲染功能之外,其他所有png都可以使用
public Texture resize(String path, int width1, int height1){
Texture final_texture;
Pixmap TL1 = new Pixmap(Gdx.files.internal(path));
Pixmap TL2 = new Pixmap(width1, height1, TL1.getFormat());
TL2.drawPixmap(TL1,
0, 0, TL1.getWidth(), TL1.getHeight(),
0, 0, TL2.getWidth(), TL2.getHeight()
);
final_texture = new Texture(TL2);
TL1.dispose();
TL2.dispose();
return final_texture;
}
public void create () {
//there are other things here too but dont pertain to tools
tools = resize("tools.png", 200, 200);
TLArrow = resize("TLArrow.png", width*5/4, height/8);
}
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
Gdx.gl.glClearColor(0/255f, 255/255f, 140/255f, 1);
batch.begin();
batch.draw(tools,500, 500);
batch.draw(TLArrow,500, 200);
batch.end();
}
TLArrow可以很好地绘制,但是工具不能。我记录了tools.toString(),它返回了一个(看似)有效的存储位置