LibGdx resolutionFileResolver + Assetmanager, file names?

后端 未结 1 1287
自闭症患者
自闭症患者 2020-12-11 11:28

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          


        
相关标签:
1条回答
  • 2020-12-11 12:06
    // 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.

    0 讨论(0)
提交回复
热议问题