LibGdx resolutionFileResolver + Assetmanager,文件名? [英] LibGdx resolutionFileResolver + Assetmanager, file names?

查看:239
本文介绍了LibGdx resolutionFileResolver + Assetmanager,文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的分辨率文件解析器来选择一个正确的纹理图集我的应用程序,所以我createa RFR与一对夫妇决议:

 分辨率_568x1136 =新的决议(568,1136,.568x1136);
分辨率_1200x1920 =新的决议(568,1136,.1200x1920);
ResolutionFileResolver解析器=新ResolutionFileResolver(新InternalFileHandleResolver(),_568x1136,_1200x1920);

经理=新AssetManager();
manager.setLoader(TextureAtlas.class,新TextureAtlasLoader(解析));
 

现在我想知道,我怎么命名/位的文件??????

我尝试添加.1200x1920和.568x1136后面两个巴纽和.atlas(.png.568.1136等),但没有奏效。

我也尝试过使用的文件夹(父母/ 568x1136 / file.atlas)。

我尝试加载地图集以下列方式:

  manager.load(数据/图谱/闪屏/ splashscreen.atlas,TextureAtlas.class); //首先确保启动画面
manager.finishLoading(); //加载任何东西之前加载
Assets.splashAtlas = manager.get(数据/图谱/闪屏/ splashscreen.atlas,TextureAtlas.class); // 其他
 

解决方案

  //没有点被用于后缀
分辨率_568x1136 =新的决议(568,1136,568x1136);
分辨率_1200x1920 =新的决议(568,1136,1200x1920);
ResolutionFileResolver解析器=新ResolutionFileResolver(新InternalFileHandleResolver(),_568x1136,_1200x1920);

manager.load(数据/图谱/闪屏/ splashscreen.atlas,TextureAtlas.class);
manager.finishLoading();
Assets.splashAtlas = manager.get(数据/图谱/闪屏/ splashscreen.atlas,TextureAtlas.class);
 

尽管在计算器关于 ResolutionFileResolver ,它实际上的没有的利用文件夹层次结构,以获取正确的图像答案。如果我们假设 568x1136 将是最佳匹配的分辨率,它将搜索数据/图谱/闪屏/ 568x1136 / splashscreen.atlas 现在。如果这个文件不能被发现,回退将是多么数据/图谱/闪屏/ splashscreen.atlas 。如果该文件也不存在,将发生异常。

故得名后缀是不是真的正确了。实施似乎已经随着时间的推移发生变化。的后缀不被追加到文件了。

I want to use the resolution file resolver to select a correct texture atlas for my app, so I createa RFR with a couple of resolutions:

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));

Now I'm wondering, how do I name/place the files??????

I tried adding .1200x1920 and .568x1136 behind BOTH the .png and the .atlas (.png.568.1136, etc), but that didn't work.

I also tried using folders (parent/568x1136/file.atlas).

I try to load the atlas in the following manner:

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 

解决方案

// 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);

Despite other answers on stackoverflow regarding the ResolutionFileResolver, it actually does make use of a folder hierarchy to retrieve the correct images. If we assume that 568x1136 would be the best matching resolution, it will search for data/atlas/splashscreen/568x1136/splashscreen.atlas now. If this file cannot be found, the fallback will be just data/atlas/splashscreen/splashscreen.atlas. If this file also doesn't exist, an exception will occur.

So the name "suffix" is not really correct anymore. The implementation seems to have changed over time. The "suffix" is not being appended to the files anymore.

这篇关于LibGdx resolutionFileResolver + Assetmanager,文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆