Myt*_*h1c 2 android assets resolution libgdx texture-atlas
我想使用分辨率文件解析器为我的应用程序选择正确的纹理图集,所以我用几个分辨率创建了一个RFR:
Resolution _568x1136 = new Resolution(568, 1136, ".568x1136");
Resolution _1200x1920 = new Resolution(568, 1136, ".1200x1920");
ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), _568x1136, _1200x1920);
manager = new AssetManager();
manager.setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver));
Run Code Online (Sandbox Code Playgroud)
现在我想知道,我如何命名/放置文件??????
我尝试在.png和.atlas(.png.568.1136等)之后添加.1200x1920和.568x1136,但这不起作用.
我也尝试使用文件夹(parent/568x1136/file.atlas).
我尝试以下列方式加载地图集:
manager.load("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class); // First make sure the splash screen
manager.finishLoading(); // is loaded before loading anything
Assets.splashAtlas = manager.get("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class); // else
Run Code Online (Sandbox Code Playgroud)
// no dots were used for the "suffix"
Resolution _568x1136 = new Resolution(568, 1136, "568x1136");
Resolution _1200x1920 = new Resolution(568, 1136, "1200x1920");
ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), _568x1136, _1200x1920);
manager.load("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class);
manager.finishLoading();
Assets.splashAtlas = manager.get("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class);
Run Code Online (Sandbox Code Playgroud)
尽管有关stackoverflow的其他答案ResolutionFileResolver,它实际上确实利用文件夹层次结构来检索正确的图像.如果我们假设这568x1136是最佳匹配分辨率,它将立即搜索data/atlas/splashscreen/568x1136/splashscreen.atlas.如果找不到此文件,则回退将是公正的data/atlas/splashscreen/splashscreen.atlas.如果此文件也不存在,则会发生异常.
因此名称"后缀"不再是正确的.实施似乎随着时间的推移而发生了变化."后缀"不再附加到文件中.
| 归档时间: |
|
| 查看次数: |
2057 次 |
| 最近记录: |