且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在资源使用文件载入纹理libgdx机器人?

更新时间:2023-11-08 23:06:28

您应该看看libgdx的ResolutionFileResolver,并且还用AssetManager(这将减轻对你的一切)。

You should look into libgdx's ResolutionFileResolver, and also use AssetManager (it will ease everything for you).

您提供它的分辨率和适当的文件夹使用,然后libgdx自动地选择与***匹配的文件夹。

You supply it resolutions and the proper folder to use, and then libgdx automagically selects the folder with the best match.

Resolution[] resolutions = { new Resolution(320, 480, ".320480"),
                          new Resolution(480, 800, ".480800"),
                          new Resolution(480, 856, ".480854") };
ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions);
manager = new AssetManager();

这是做在libgdx的方式,你不应该接触到资源文件夹。

This is the way to do it in libgdx, you shouldn't touch the res folder.