Android 尝试读取包文件 ;使用 ;纹理玻璃
这不管用吗Android 尝试读取包文件 ;使用 ;纹理玻璃,android,textures,libgdx,Android,Textures,Libgdx,这不管用吗 TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("data/texture.png")); AtlasRegion region = atlas.findRegion("ape_glad"); Sprite ape= new Sprite(region); 相反,我在O.O上面的第一行得到:com.badlogic.gdx.utils.GdxRuntimeException:Error rea
TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("data/texture.png"));
AtlasRegion region = atlas.findRegion("ape_glad");
Sprite ape= new Sprite(region);
相反,我在O.O上面的第一行得到:com.badlogic.gdx.utils.GdxRuntimeException:Error reading pack file:data/texture.png
谢谢你的帮助 首先,您需要创建一个纹理图集,建议使用libgdx。它将生成纹理图像和另一个文件(包含libgdx
TextureAtlas
所需的信息)
在代码中,您需要向构造函数提供atlas文件,请参见,而不是图像本身:
TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("data/texture.atlas"));
(注意使用“atlas”-文件而不是图像文件)首先,您需要创建纹理图集,建议使用libgdx。它将生成纹理图像和另一个文件(包含libgdx
TextureAtlas
所需的信息)
在代码中,您需要向构造函数提供atlas文件,请参见,而不是图像本身:
TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("data/texture.atlas"));
(请注意使用“atlas”-文件而不是图像文件)没有像texture.pack这样的文件,只有texture.png。没有像texture.pack这样的文件,只有texture.png。