如何使用/设置TexturePacker2 libgdx [英] How to use/setup TexturePacker2 libgdx
问题描述
我从 libgdx
与 texturepacker2
困难。我试图用texturepakcer2,这样我可以创建动态影像创建 textureAtlas
。但是我不能使用
I have a difficulty with texturepacker2
from libgdx
. I was trying to create textureAtlas
using texturepakcer2 so that I can create animated images. However I could not use
TexturePacker2.process(输入目录路径,输出目录路径,texture_file);
TexturePacker2.process(Input Directory Path", "Output Directory Path", "texture_file");
由于它无法识别TexturePacker2。
甚至认为我输入 GDX-tool.jar
文件库
,并通过还增加了图书馆内项目 - >属性 - > Java构建路径 - >库 - >添加罐
,它仍然无法解决,也不承认 GDX-tool.jar
。
Because it could not recognize TexturePacker2.
Even thought I import gdx-tool.jar
file inside libs
and also added libraries through
Project -> Properties -> Java Build Path -> Libraries -> Add jars
, it still cannot resolve nor recognize the gdx-tool.jar
.
我如何使用创建的纹理地图 TexturePakcer2
?我听说有一种方法创建一个使用夜间的构建从 libgdx
,我该怎么办呢?当我解压最新的夜间,建立有那么多的罐子,但我只运行安装程序的用户界面。
How can I create texture atlas using TexturePakcer2
? I heard there is a way to create using nightly-build from libgdx
, how can I do it? When I unzip latest nightly-build there were so many jar, but I could only run setup-ui.
推荐答案
有几种方法。我曾经把它落实到我的桌面应用程序的方式。每当我启动它,则产生的地图集。 (如果我在它改变的东西)。
There are several ways. I used to take the way of implementing it into my Desktop application. Whenever i start it, the Atlas is generated. (If i changed something in it).
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);
}
}
不要忘记添加工具lib添加到桌面的项目。 GDX-的tools.jar
从夜间或稳定。
否则,你可以使用控制台调用它。像这样的:
Else you can call it with the console. Like this:
java -cp gdx.jar;extensions/gdx-tools/gdx-tools.jar com.badlogic.gdx.tools.texturepacker.TexturePacker inputDir [outputDir] [packFileName]
这篇关于如何使用/设置TexturePacker2 libgdx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!