public static void main(String[] args) { Settings settings = new Settings(); settings.maxWidth = 2048; settings.maxHeight = 2048; // We will assume that this code runs from // [art] // Raw assets live in // [art]/assets/[sheetname] // Thus, all asset source paths should be prefixed with // assets // and all asset destination paths should be prefixed with // package TexturePacker.process(settings, "assets/images", "package/assets", "main"); TexturePacker.process(settings, "assets/characters", "package/assets", "characters"); TexturePacker.process(settings, "assets/titleScreen", "package/assets", "titlescreen"); TexturePacker.process(settings, "assets/menuControls", "package/assets", "menu"); TexturePacker.process(settings, "assets/creditslogos", "package/assets", "credits"); }
@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; } }
@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; } }
@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; } }
private void performPacking(PackModel packModel, PageFileWriter pageFileWriter) throws Exception { Array<ImageEntry> imageEntries = collectImageFiles(packModel); if (imageEntries.size == 0) { throw new IllegalStateException("No images to pack"); } deleteOldFiles(packModel); String filename = obtainFilename(packModel); TexturePacker packer = new TexturePacker(packModel.getSettings(), pageFileWriter); for (ImageEntry image : imageEntries) { if (image.ninePatch) { packer.addImage(image.fileHandle.file(), image.name, image.splits, image.pads); } else { packer.addImage(image.fileHandle.file(), image.name); } } packer.pack(new File(packModel.getOutputDir()), filename); }
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); } }
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; }
@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)); }
private static final void processFolder(Settings settings, String path) { File folderToProcess = new File(path); boolean folderRequiresProcess = false; for(File childFile : folderToProcess.listFiles()) { if(childFile.isDirectory()) { processFolder(settings, childFile.getAbsolutePath()); } else { // It is a file, we need to pack!! folderRequiresProcess = true; } } // Perform actual pack now that we know that it's required if(folderRequiresProcess) { TexturePacker.process(settings, path, path, folderToProcess.getName()); } }
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"); }
public static void main(String[] arg) { if (Assets.rebuildAtlas) { Settings settings = new Settings(); settings.maxWidth = 2048; settings.maxHeight = 2048; settings.debug = Assets.drawDebugOutline; try { TexturePacker.process(settings, "assets-raw", "../android/assets", "assets"); } catch (Exception e) { e.printStackTrace(); } } LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = 1280; config.height = 720; config.addIcon("icon128.png", FileType.Internal); config.addIcon("icon32.png", FileType.Internal); config.addIcon("icon16.png", FileType.Internal); new LwjglApplication(new Main(), config); }
public static void main(String[] arg) throws FileNotFoundException, IOException { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = GameConstants.WINDOW_TITLE; config.addIcon("gameicon.png", FileType.Internal); config.width = GameConstants.GAME_WIDTH; config.height = GameConstants.GAME_HEIGHT; config.fullscreen = false; readConfigFromPreference(config); config.vSyncEnabled = config.fullscreen; // check debug/run configuration ENVIRONMENT tab // if the "DEVEOPMENT" flag is true, then the graphics will be packed together // set the flag to false before exporting the jar String getenv = System.getenv("DEVELOPMENT"); if (getenv != null && "true".equals(getenv)) { Settings settings = new Settings(); settings.combineSubdirectories = true; TexturePacker.process(settings, "../core/assets/graphics/hud", "../core/assets/packedGraphics", "hud"); TexturePacker.process(settings, "../core/assets/graphics/game", "../core/assets/packedGraphics", "gameGraphics"); TexturePacker.process(settings, "../core/assets/graphics/menu", "../core/assets/packedGraphics", "menuGraphics"); } new LwjglApplication(new GDXGame(), config); }
@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; }
@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; }
public static void main(String args[]){ if(resolver == null){ resolver = new Main(); } boolean hacer_packer = false; if(hacer_packer){ Settings settings = new Settings(); settings.pot = false; settings.maxHeight = 1024; settings.maxWidth = 1024; settings.paddingX = 1; settings.paddingY = 1; settings.filterMin = TextureFilter.Linear; settings.filterMag = TextureFilter.Linear; TexturePacker.process(settings, "dataPC/screens/play/", "data/screens/play/", "play"); TexturePacker.process(settings, "dataPC/screens/background/", "data/screens/background", "bg"); } new LwjglApplication(new Bar(resolver), "Bar", 480, 854, true); }
public static void packImages() { File dir = new File(root); String inputDir = ""; String outputDir = ""; String outputFile = ""; String[] content = dir.list(); Settings settings = new Settings(); settings.maxWidth = 2048; settings.maxHeight = 2048; settings.pot = false; for (int i = 0; i < content.length; i++) { if (new File(root + filesep + content[i]).isDirectory()) { inputDir = root + filesep + content[i]; outputDir = root + filesep + content[i]; outputFile = content[i] + ".atlas"; TexturePacker.processIfModified(settings, inputDir, outputDir, outputFile); } } }
private void createAtlas(FileHandle directory, String atlasName) { Settings settings = new Settings(); settings.minWidth = 32; settings.minHeight = 32; settings.maxWidth = 2048; settings.maxHeight = 2048; settings.pot = true; settings.paddingX = 0; settings.paddingY = 0; String inputDirectory = directory.path(); String outputDirectory = directory.path(); String packFileName = atlasName; TexturePacker.process(settings, inputDirectory, outputDirectory, packFileName); }
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); } }
/** * * @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(); }
/** * */ 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")); }
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); }
public static void pack(String input_asset_folder,String output_asset_folder,String output_file_name) { Settings settings = new Settings(); settings.useIndexes = use_index; settings.pot = true; settings.maxWidth = size; settings.maxHeight = size; settings.alias = false; // settings.stripWhitespaceX = strip_whitespace;// // settings.stripWhitespaceY = strip_whitespace; settings.atlasExtension = extension; TexturePacker.process(settings, input_folder+"/"+input_asset_folder,output_folder+output_asset_folder, output_file_name); }
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); }
public static void main (String[] arg) { final boolean needToPackTexture=false; if(needToPackTexture) { // for high resolution (1280x720) Settings settings=new Settings(); settings.maxHeight=2048; settings.maxWidth=2048; settings.filterMin=TextureFilter.MipMapLinearLinear; settings.filterMag=TextureFilter.Linear; settings.fast=true; settings.duplicatePadding=true; settings.scale=new float[]{1,0.5f}; settings.scaleSuffix=new String[]{"e","e_small"}; TexturePacker.process(settings, "../../images", ".", "gam"); // for lower resolution settings.maxHeight=1024; settings.maxWidth=1024; //TexturePacker.process(settings, "../../images_small", ".", "game_small"); } LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width=482; config.height=320; //config.width=320; //config.height=480; config.useGL30 = false; ShapeClearGame game=new ShapeClearGame(); game.platformSpecific=new DesktopSpecific(); new LwjglApplication(game, config); }
@Override public void texturePack(Array<FileHandle> handles, FileHandle localFile, FileHandle targetFile) { //copy defaults.json to temp folder if it doesn't exist FileHandle fileHandle = Gdx.files.local("texturepacker/defaults.json"); if (!fileHandle.exists()) { Gdx.files.internal("defaults.json").copyTo(fileHandle); } Json json = new Json(); Settings settings = json.fromJson(Settings.class, fileHandle); TexturePacker p = new TexturePacker(settings); for (FileHandle handle : handles) { if (handle.exists()) { p.addImage(handle.file()); } else { if (localFile != null) { FileHandle localHandle = localFile.sibling(localFile.nameWithoutExtension() + "_data/" + handle.name()); if (localHandle.exists()) { p.addImage(localHandle.file()); } else { Gdx.app.error(getClass().getName(), "File does not exist error while creating texture atlas: " + handle.path()); } } else { Gdx.app.error(getClass().getName(), "File does not exist error while creating texture atlas: " + handle.path()); } } } p.pack(targetFile.parent().file(), targetFile.nameWithoutExtension()); }
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-", ""); }
public static void main(String[] args) { if (rebuildAtlas) { TexturePacker.Settings settings = new TexturePacker.Settings(); settings.maxWidth = 1024; settings.maxHeight = 1024; settings.debug = drawDebugOutline; TexturePacker.process(settings, "hud", "hud", "status-ui"); } }
public static void main (String[] arg) { boolean shouldPack = arg.length == 1 && "pack".equals(arg[0]); boolean shouldCompile = arg.length == 2 && "compile".equals(arg[0]); if (shouldCompile) { String folderName = arg[1]; ScriptCompiler compiler = new ScriptCompiler(folderName); compiler.run(); return; } if (shouldPack) { Settings settings = new Settings(); settings.maxHeight = 2048; settings.maxWidth = 4096; TexturePacker.process("bin/images", "bin", "uiStyle"); TexturePacker.process(settings, "bin/modules/showcase/ui/images/startGameMenu", "bin/modules/showcase/ui/", "startGameMenuStyle"); TexturePacker.process(settings, "bin/modules/showcase/ui/images/partyCreation", "bin/modules/showcase/ui/", "partyCreationStyle"); TexturePacker.process("bin/modules/showcase/ui/images/game", "bin/modules/showcase/ui/", "uiStyle"); TexturePacker.process("bin/modules/showcase/perks/images/small", "bin/modules/showcase/perks/images/", "perkImages"); TexturePacker.process("bin/modules/showcase/spells/images/small", "bin/modules/showcase/spells/images/", "spellImages"); } Configuration.createConfiguration(new LwjglFiles()); LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.title = "Fabulae"; cfg.width = Configuration.getScreenWidth(); cfg.height = Configuration.getScreenHeight(); cfg.fullscreen = Configuration.isFullscreen(); new LwjglApplication(new FishchickenGame(), cfg).setLogLevel(Application.LOG_DEBUG); }
@Override public void saveToFile(TexturePacker.Settings settings, BufferedImage image, File file) throws IOException { FileHandle tmpPngFile = new FileHandle(File.createTempFile(file.getName(), null)); FileHandle output = new FileHandle(file); super.saveToFile(settings, image, tmpPngFile.file()); KtxEtc1Processor.process(tmpPngFile, output, alphaChannel); tmpPngFile.delete(); if (zipping) { FileUtils.packGzip(output); } }
@Override public void saveToFile(TexturePacker.Settings settings, BufferedImage image, File file) throws IOException { FileHandle tmpPngFile = new FileHandle(File.createTempFile(file.getName(), null)); FileHandle output = new FileHandle(file); super.saveToFile(settings, image, tmpPngFile.file()); KtxEtc2Processor.process(tmpPngFile, output, pixelFormat); tmpPngFile.delete(); if (zipping) { FileUtils.packGzip(output); } }
public static void main(String[] args) throws Exception { Settings settings = new Settings(); settings.maxWidth = 1024; settings.maxHeight = 1024; TexturePacker.process(settings, "../images", "../android/assets/data/skins/", "menu"); TexturePacker.process("../../images/", "/textures/", "default"); }
/** * @param arg * String array */ public static void main(final String[] arg) { if (DesktopLauncher.REBUILD_ALTLAS) { final TexturePacker.Settings settings = new TexturePacker.Settings(); settings.edgePadding = true; settings.maxWidth = 1024; // must be a power or 2, for performance reasons settings.maxHeight = 1024; // must be a power or 2, for performance reasons settings.debug = false; settings.duplicatePadding = true; TexturePacker.process(settings, Constants.ASSETS_RAW, Constants.ATLAS_FOLDER, Constants.ATLAS_NAME); } final LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.fullscreen = false; config.useGL30 = false; config.backgroundFPS = 10; // TODO objects behave strange, if less than config.foregroundFPS config.title = "TheGame - Version_0.3_2015.07.13 - Created by Herkt Kevin, Ferdinand Koeppen and Philip Polczer"; // size of the screen-window, not of the camera config.height = Constants.SCREEN_HEIGHT_IN_PIXEL; config.width = Constants.SCREEN_WIDTH_IN_PIXEL; config.resizable = false; config.foregroundFPS = Constants.MAX_FAMES; System.out.println("Starting game: " + config.width + " x " + config.height + " with ViewPort: " + Constants.VIEWPORT_WIDTH_IN_METER + "x" + Constants.VIEWPORT_HEIGHT_IN_METER + " in meter"); @SuppressWarnings("unused") final LwjglApplication lwjglApplication = new LwjglApplication(new GameTitle(), config); }
/** * Generate atlases from images. Should be used only when images are updated */ private static void regenerateAtlases(String dataDir) { TexturePacker.Settings settings = new TexturePacker.Settings(); settings.maxWidth = 2048; settings.maxHeight = 2048; try { log.info("Packing files at: " + Paths.get(dataDir).toAbsolutePath().toString()); TexturePacker.process(settings, dataDir + "/img", dataDir + "/imgpacked", "packed"); } catch (RuntimeException e) { log.error("Error while generating atlas: ", e); throw e; } }
public static void run() { TexturePacker.Settings settings = new TexturePacker.Settings(); settings.filterMin = Texture.TextureFilter.Nearest; settings.filterMag = Texture.TextureFilter.Nearest; settings.pot = false; settings.combineSubdirectories = true; TexturePacker.process(settings, "../assetsRaw/texture", "textures", "tile"); }
public static void run() { Settings settings = new Settings(); settings.filterMin = Texture.TextureFilter.Linear; settings.filterMag = Texture.TextureFilter.Linear; settings.pot = false; TexturePacker.process(settings, "textures/characters", "resources/textures", "characters"); TexturePacker.process(settings, "textures/maptiles", "resources/textures", "maptiles"); TexturePacker.process(settings, "textures/uiskin", "resources/uiskin", "uiskin"); }
private static void createPacker() { /* Automatic packing */ for (String folder: new String[]{}) { // Added new folders here // Remove old pack for (String ext : new String[]{".png", ".pack"}) { File file = new File("../android/assets/" + folder + ext); file.delete(); } // Create new pack TexturePacker.process("../assets/" + folder, "../android/assets/", folder + ".pack"); } }
static public void process (TexturePacker.Settings settings, String input, String output, String packFileName, FilenameFilter filter) { try { TexturePackerFileProcessor processor = new TexturePackerFileProcessor(settings, packFileName); processor.setInputFilter(filter); // Sort input files by name to avoid platform-dependent atlas output changes. processor.setComparator((file1, file2) -> file1.getName().compareTo(file2.getName())); processor.process(new File(input), new File(output)); } catch (Exception ex) { throw new RuntimeException("Error packing images.", ex); } }
@Override public void create() { opt = new OptionalChecker(); fm = new SystemFonts(); fm.refreshFonts(); // Create projects folder if not already here FileHandle dirProjects = new FileHandle("projects"); if (dirProjects.isDirectory() == false) { dirProjects.mkdirs(); } // Rebuild from raw resources, kind of overkill, might disable it for production TexturePacker.Settings settings = new TexturePacker.Settings(); settings.combineSubdirectories = true; TexturePacker.process(settings, "resources/raw/", ".", "resources/uiskin"); batch = new SpriteBatch(); skin = new Skin(); atlas = new TextureAtlas(Gdx.files.internal("resources/uiskin.atlas")); skin.addRegions(new TextureAtlas(Gdx.files.local("resources/uiskin.atlas"))); skin.load(Gdx.files.local("resources/uiskin.json")); screenMain = new MainScreen(this); screenWelcome = new WelcomeScreen(this); setScreen(screenWelcome); }