我很难接受来自texturepacker2的libgdx。我试图使用textureAtlas创建texturepakcer2,以便创建动画图像。但是我不能用
过程(输入目录路径,输出目录路径,texture_file);
因为它不能识别TexturePacker2。即使我在libs中导入libs文件并通过Project -> Properties -> Java Build Path -> Libraries -> Add jars添加了库,它仍然无法解析或识别gdx-tool.jar。
如何使用TexturePakcer2创建纹理地图集?我听说有一种方法可以使用libgdx的夜间构建来创建,我怎么做呢?当我解压缩最新的夜间构建有这么多的jar,但我只能运行安装-ui。
发布于 2014-02-17 16:08:55
有几种方法。我过去常常把它实现到我的桌面应用程序中。每当我启动它时,都会生成Atlas。(如果我在里面换了什么)。
public class Main
{
public static void main(String[] args)
{
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "MyApp";
cfg.useGL20 = true;
cfg.fullscreen = false;
// switch for fullscreen
if (cfg.fullscreen)
{
cfg.width = Toolkit.getDefaultToolkit().getScreenSize().width;
cfg.height = Toolkit.getDefaultToolkit().getScreenSize().height;
}
else
{
cfg.width = 1280;
cfg.height = 720;
}
cfg.addIcon("data/appiconWindows.png", FileType.Internal);
// automatic packing of the textures and images and so on
Settings settings = new Settings();
settings.maxWidth = 2048;
settings.maxHeight = 2048;
settings.paddingX = 0;
settings.paddingY = 0;
TexturePacker2.process(settings, "directory with the files",
"output dir", "name of Atlas"); //third is outputdir
new LwjglApplication(new MainClass(), cfg);
}
}不要忘记将工具库添加到桌面项目中。来自夜间或马厩的gdx-tools.jar。
否则你可以用控制台来调用它。如下所示:
java -cp gdx.jar;extensions/gdx-tools/gdx-tools.jar com.badlogic.gdx.tools.texturepacker.TexturePacker inputDir [outputDir] [packFileName]发布于 2015-07-01 05:54:45
使用TexturePacker from com.badlogic.gdx.tools.imagepacker.TexturePacker,然后创建一个类,如下所示:
public class TextureSetup {
public static void main(String[] args) {
//TexturePacker; using default settings
TexturePacker.Settings packSettings = new TexturePacker.Settings();
TexturePacker.process(packSettings, "input-folder", "output-folder", "textures.pack");
}
}https://stackoverflow.com/questions/21820974
复制相似问题