本文整理匯總了Java中com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings方法的典型用法代碼示例。如果您正苦於以下問題:Java TexturePacker.Settings方法的具體用法?Java TexturePacker.Settings怎麽用?Java TexturePacker.Settings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.tools.texturepacker.TexturePacker
的用法示例。
在下文中一共展示了TexturePacker.Settings方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSettingsCbChecked
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
@LmlAction("onSettingsCbChecked") void onSettingsCbChecked(VisCheckBox checkBox) {
PackModel pack = getSelectedPack();
if (pack == null) return;
TexturePacker.Settings settings = pack.getSettings();
switch (checkBox.getName()) {
case "cbUseFastAlgorithm": settings.fast = checkBox.isChecked(); break;
case "cbEdgePadding": settings.edgePadding = checkBox.isChecked(); break;
case "cbStripWhitespaceX": settings.stripWhitespaceX = checkBox.isChecked(); break;
case "cbStripWhitespaceY": settings.stripWhitespaceY = checkBox.isChecked(); break;
case "cbAllowRotation": settings.rotation = checkBox.isChecked(); break;
case "cbBleeding": settings.bleed = checkBox.isChecked(); break;
case "cbDuplicatePadding": settings.duplicatePadding = checkBox.isChecked(); break;
case "cbForcePot": settings.pot = checkBox.isChecked(); break;
case "cbUseAliases": settings.alias = checkBox.isChecked(); break;
case "cbIgnoreBlankImages": settings.ignoreBlankImages = checkBox.isChecked(); break;
case "cbDebug": settings.debug = checkBox.isChecked(); break;
case "cbUseIndices": settings.useIndexes = checkBox.isChecked(); break;
case "cbPremultiplyAlpha": settings.premultiplyAlpha = checkBox.isChecked(); break;
case "cbGrid": settings.grid = checkBox.isChecked(); break;
case "cbSquare": settings.square = checkBox.isChecked(); break;
case "cbLimitMemory": settings.limitMemory = checkBox.isChecked(); break;
}
}
示例2: onSettingsIntSpinnerChanged
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
@LmlAction("onSettingsIntSpinnerChanged") void onSettingsIntSpinnerChanged(Spinner spinner) {
PackModel pack = getSelectedPack();
if (pack == null) return;
TexturePacker.Settings settings = pack.getSettings();
IntSpinnerModel model = (IntSpinnerModel) spinner.getModel();
switch (spinner.getName()) {
case "spnMinPageWidth": settings.minWidth = model.getValue(); break;
case "spnMinPageHeight": settings.minHeight = model.getValue(); break;
case "spnMaxPageWidth": settings.maxWidth = model.getValue(); break;
case "spnMaxPageHeight": settings.maxHeight = model.getValue(); break;
case "spnAlphaThreshold": settings.alphaThreshold = model.getValue(); break;
case "spnPaddingX": settings.paddingX = model.getValue(); break;
case "spnPaddingY": settings.paddingY = model.getValue(); break;
}
}
示例3: onSettingsCboChanged
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
@LmlAction("onSettingsCboChanged") void onSettingsCboChanged(VisSelectBox selectBox) {
if (!initialized) return;
PackModel pack = getSelectedPack();
if (pack == null) return;
TexturePacker.Settings settings = pack.getSettings();
Object value = selectBox.getSelected();
switch (selectBox.getName()) {
case "cboEncodingFormat": settings.format = (Pixmap.Format) value; break;
case "cboMinFilter": settings.filterMin = (Texture.TextureFilter) value; break;
case "cboMagFilter": settings.filterMag = (Texture.TextureFilter) value; break;
case "cboWrapX": settings.wrapX = (Texture.TextureWrap) value; break;
case "cboWrapY": settings.wrapY = (Texture.TextureWrap) value; break;
// case "cboOutputFormat": settings.outputFormat = (String) value; break;
}
}
示例4: deleteOldFiles
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
private static void deleteOldFiles(PackModel packModel) throws Exception {
String filename = obtainFilename(packModel);
TexturePacker.Settings settings = packModel.getSettings();
String atlasExtension = settings.atlasExtension == null ? "" : settings.atlasExtension;
atlasExtension = Pattern.quote(atlasExtension);
for (int i = 0, n = settings.scale.length; i < n; i++) {
FileProcessor deleteProcessor = new FileProcessor() {
protected void processFile (Entry inputFile) throws Exception {
Files.delete(inputFile.inputFile.toPath());
}
};
deleteProcessor.setRecursive(false);
String scaledPackFileName = settings.getScaledPackFileName(filename, i);
File packFile = new File(scaledPackFileName);
String prefix = filename;
int dotIndex = prefix.lastIndexOf('.');
if (dotIndex != -1) prefix = prefix.substring(0, dotIndex);
deleteProcessor.addInputRegex("(?i)" + prefix + "\\d*\\.(png|jpg|jpeg|ktx|zktx)");
deleteProcessor.addInputRegex("(?i)" + prefix + atlasExtension);
File outputRoot = new File(packModel.getOutputDir());
String dir = packFile.getParent();
if (dir == null)
deleteProcessor.process(outputRoot, null);
else if (new File(outputRoot + "/" + dir).exists()) //
deleteProcessor.process(outputRoot + "/" + dir, null);
}
}
示例5: prepareProcessingNodes
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
private Array<PackProcessingNode> prepareProcessingNodes(ProjectModel project, Array<PackModel> packs) {
Array<PackProcessingNode> result = new Array<>();
for (PackModel pack : packs) {
for (ScaleFactorModel scaleFactor : pack.getScaleFactors()) {
PackModel newPack = new PackModel(pack);
newPack.setScaleFactors(Array.with(scaleFactor));
TexturePacker.Settings settings = newPack.getSettings();
settings.scaleSuffix[0] = "";
settings.scale[0] = scaleFactor.getFactor();
PackProcessingNode processingNode = new PackProcessingNode(project, newPack);
processingNode.setOrigPack(pack);
result.add(processingNode);
}
}
return result;
}
示例6: copySettingsToAllPacks
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
@LmlAction("copySettingsToAllPacks") public void copySettingsToAllPacks() {
PackModel selectedPack = getSelectedPack();
if (selectedPack == null) return;
TexturePacker.Settings generalSettings = selectedPack.getSettings();
Array<PackModel> packs = getProject().getPacks();
for (PackModel pack : packs) {
if (pack == selectedPack) continue;
pack.setSettings(generalSettings);
}
eventDispatcher.postEvent(new ShowToastEvent()
.message(getString("toastCopyAllSettings"))
.duration(ShowToastEvent.DURATION_SHORT));
}
示例7: main
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
public static void main(String...args) throws Exception{
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.stripWhitespaceX = false;
settings.stripWhitespaceY = false;
TexturePacker.process(settings, "Assets Folder/items/images", "core/assets/items", "item-icons");
TexturePacker.process(settings, "Assets Folder/UI/images", "core/assets/UI", "UI");
TexturePacker.process(settings, "Assets Folder/res/images", "core/assets/res", "res");
}
示例8: perform
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
@Override
public Boolean perform() {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.grid = true;
settings.square = true;
settings.paddingX = 2;
settings.paddingY = 2;
TexturePacker.process(settings, Gdx.files.internal("raw/blocks").path(), Gdx.files.internal("graphics/textures/").path(), "tilemap.atlas");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ForgE.blocks.reload();
return true;
}
示例9: perform
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
@Override
public Boolean perform() {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.grid = true;
settings.square = true;
settings.paddingX = 2;
settings.paddingY = 2;
TexturePacker.process(settings, Gdx.files.internal(RAW_UI_IMAGES_PATH).path(), Gdx.files.internal(UIManager.STORE_PATH).path(), "ui.atlas");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return true;
}
示例10: main
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
public static void main (String[] arg) {
// Create two run configurations
// 1. For texture packing. Pass 'texturepacker' as argument and use desktop/src
// as working directory
// 2. For playing game with android/assets as working directory
if (arg.length == 1 && arg[0].equals("texturepacker")) {
String outdir = "assets";
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.maxWidth = 1024;
settings.maxHeight = 1024;
TexturePacker.process(settings, "images", outdir, "game");
TexturePacker.process(settings, "text-images", outdir, "text_images");
TexturePacker.process(settings, "text-images-de", outdir, "text_images_de");
}
else {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "FruitCatcher";
config.width = 800;
config.height = 480;
new LwjglApplication(new FruitCatcherGame(null, "en"), config);
}
}
示例11: createProject
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
/**
*
* @param projectName
*/
public void createProject(String projectName) {
FileHandle projectFolder = Gdx.files.local("projects").child(projectName);
if (projectFolder.exists() == true) {
game.showNotice("Error", "Project name already in use!", stage);
return;
}
projectFolder.mkdirs();
projectFolder.child("assets").mkdirs();
projectFolder.child("backups").mkdirs();
game.skin.save(projectFolder.child("uiskin.json"));
// Copy assets
FileHandle assetsFolder = Gdx.files.local("resources/raw");
assetsFolder.copyTo(projectFolder.child("assets"));
// Rebuild from raw resources
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.combineSubdirectories = true;
TexturePacker.process(settings, "projects/" + projectName +"/assets/", "projects/" + projectName, "uiskin");
game.showNotice("Operation completed", "New project successfully created.", stage);
refreshProjects();
}
示例12: refreshResources
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
/**
*
*/
public void refreshResources() {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.combineSubdirectories = true;
settings.maxWidth = 2048;
settings.maxHeight = 2048;
TexturePacker.process(settings, "projects/" + currentProject +"/assets/", "projects/" + currentProject, "uiskin");
// Load project skin
if (game.skinProject != null) {
game.skinProject.dispose();
}
game.skinProject = new Skin();
game.skinProject.addRegions(new TextureAtlas(Gdx.files.local("projects/" + currentProject +"/uiskin.atlas")));
game.skinProject.load(Gdx.files.local("projects/" + currentProject +"/uiskin.json"));
}
示例13: main
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
final double ratio = 1080.0/1920.0;
if(DS.app_orientation==DS.ORIENTATION.PORTRAIT) {
config.height = 950;
config.width = (int) (config.height * ratio);
} else {
config.width = 950;
config.height = (int) (config.width * ratio);
}
TexturePacker.Settings settings = new TexturePacker.Settings();
// settings.maxWidth = 2048;
settings.maxWidth = 4096;
settings.maxHeight = 4096;
settings.combineSubdirectories = false;
settings.flattenPaths = true;
// settings.alias = false;
// settings.debug = true;
settings.useIndexes = false;
String input_path = "Z:/hub/coding_projects/libgdx/Ponytron/00_TEXTURES";
String output_path = "Z:/hub/coding_projects/libgdx/Ponytron/android/assets";
TexturePacker.process(settings, input_path, output_path, DS.TEXTURE_ATLAS);
new LwjglApplication(new PonytronGame(), config);
}
示例14: main
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
public static void main(String[] arg) {
if (rebuildAtlas) {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.maxWidth = 2048;
settings.maxHeight = 2048;
settings.debug = drawDebugOutline;
TexturePacker.process(settings, "raw/images", "images", "merlin-images.pack");
}
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new MerlinGame(), config);
}
示例15: main
import com.badlogic.gdx.tools.texturepacker.TexturePacker; //導入方法依賴的package包/類
public static void main(String[] args) {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.combineSubdirectories = true;
TexturePacker.process(settings, "generator/gfx", "android/assets", "gfx");
TexturePacker.process(settings, "generator/world-map", "android/assets", "world-map");
// renamePrefixes("generator/gfx/ui/level-icon", "ui-level-icon-", "");
}