Java 类com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings 实例源码

项目:cgc-art    文件:Textures.java   
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");
}
项目:libgdxjam    文件:DesktopLauncher.java   
public static void main (String[] arg) throws IOException {
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();

    config.width = 1280;
    config.height = 720;

    // Packer settings
    Settings settings = new Settings();
    settings.maxWidth = 2048;
    settings.maxHeight = 2048;
    settings.edgePadding = true;
    settings.paddingX = 0;
    settings.paddingY = 0;

    // Pack textures
    //RuntimeTexturePacker.generateAtlases(settings);

    new LwjglApplication(new LibgdxJam(), config);
}
项目:libgdxjam    文件:RuntimeTexturePacker.java   
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());
    }
}
项目:GDXJam    文件:DesktopLauncher.java   
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);

    }
项目:Protoman-vs-Megaman    文件:DesktopLauncher.java   
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);
}
项目:bar    文件:Main.java   
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);
}
项目:HAW-SE2-projecthorse    文件:Packer.java   
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);
        }
    }

}
项目:aquarria    文件:ContentExtractor.java   
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);
}
项目:KyperBox    文件:AutoPacking.java   
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);
    }
项目:Quilly-s-Castle    文件:TexturePacker.java   
public static void main(String[] arg) {
Settings settings = new Settings();
settings.combineSubdirectories = true;
settings.maxWidth = settings.maxHeight = 2048;

// com.badlogic.gdx.tools.texturepacker.TexturePacker.process(settings, "tmp/ui/skins", "packed/ui/skins/", "uiskin");
// com.badlogic.gdx.tools.texturepacker.TexturePacker.process(settings, "tmp/ui/icons", "../core/assets/skins/icons", "icons");
// com.badlogic.gdx.tools.texturepacker.TexturePacker.process(settings, "tmp/characters", "packed/characters", "characters");
com.badlogic.gdx.tools.texturepacker.TexturePacker.process(settings, "tmp/items", "packed/items", "items");
   }
项目:ShapeClear    文件:DesktopLauncher.java   
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);
}
项目:skin-composer    文件:DesktopLauncher.java   
@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());
}
项目:skin-composer    文件:TexturePackerFileProcessor.java   
public TexturePackerFileProcessor (Settings defaultSettings, String packFileName) {
    this.defaultSettings = defaultSettings;

    if (packFileName.toLowerCase().endsWith(defaultSettings.atlasExtension.toLowerCase()))
        packFileName = packFileName.substring(0, packFileName.length() - defaultSettings.atlasExtension.length());
    this.packFileName = packFileName;

    setFlattenOutput(true);
    addInputSuffix(".png", ".jpg", ".jpeg");
}
项目:skin-composer    文件:TexturePackerFileProcessor.java   
private void merge (Settings settings, File settingsFile) {
    try {
        json.readFields(settings, new JsonReader().parse(new FileReader(settingsFile)));
    } catch (Exception ex) {
        throw new GdxRuntimeException("Error reading settings file: " + settingsFile, ex);
    }
}
项目:skin-composer    文件:ImageProcessor.java   
/** @param rootDir Used to strip the root directory prefix from image file names, can be null. */
public ImageProcessor (File rootDir, Settings settings) {
    this.settings = settings;

    if (rootDir != null) {
        rootPath = rootDir.getAbsolutePath().replace('\\', '/');
        if (!rootPath.endsWith("/")) rootPath += "/";
    }
}
项目:fabulae    文件:DesktopLauncher.java   
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);
}
项目:gdx-texture-packer-gui    文件:ImageProcessor.java   
/** @param rootDir Used to strip the root directory prefix from image file names, can be null. */
public ImageProcessor(File rootDir, Settings settings) {
    this.settings = settings;

    if (rootDir != null) {
        rootPath = rootDir.getAbsolutePath().replace('\\', '/');
        if (!rootPath.endsWith("/")) rootPath += "/";
    }
}
项目:libgdxjam    文件:RuntimeTexturePacker.java   
public static final void generateAtlases(Settings settings)
{
    // Clean atlas files if already exist
    System.out.println("--- Cleaning textures folders...");
    cleanFolder(Env.TEXTURES_FOLDER);

    // Process folders
    System.out.println("--- Packaging textures...");
    processFolder(settings, Env.UI_FOLDER);
    processFolder(settings, Env.TEXTURES_FOLDER);
    System.out.println("--- Packaging done");
}
项目:Kroniax    文件:MyPacker.java   
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");
}
项目:libgdxcn    文件:TexturePackerFileProcessor.java   
public TexturePackerFileProcessor (Settings defaultSettings, String packFileName) {
    this.defaultSettings = defaultSettings;

    if (packFileName.toLowerCase().endsWith(defaultSettings.atlasExtension.toLowerCase()))
        packFileName = packFileName.substring(0, packFileName.length() - defaultSettings.atlasExtension.length());
    this.packFileName = packFileName;

    setFlattenOutput(true);
    addInputSuffix(".png", ".jpg");
}
项目:libgdxcn    文件:TexturePackerFileProcessor.java   
private void merge (Settings settings, File settingsFile) {
    try {
        json.readFields(settings, new JsonReader().parse(new FileReader(settingsFile)));
    } catch (Exception ex) {
        throw new GdxRuntimeException("Error reading settings file: " + settingsFile, ex);
    }
}
项目:libgdxcn    文件:ImageProcessor.java   
/** @param rootDir Used to strip the root directory prefix from image file names, can be null. */
public ImageProcessor (File rootDir, Settings settings) {
    this.settings = settings;

    if (rootDir != null) {
        rootPath = rootDir.getAbsolutePath().replace('\\', '/');
        if (!rootPath.endsWith("/")) rootPath += "/";
    }
}
项目:ShapeOfThingsThatWere    文件:ImagePacker.java   
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");
}
项目:vis-editor    文件:DefaultExporter.java   
private void reloadSettings () {
    settings = settingsIO.load(SETTINGS_FILE_NAME, DefaultExporterSettings.class);
    texturePackerSettings = new Settings();
    texturePackerSettings.filterMag = settings.magTextureFilter;
    texturePackerSettings.filterMin = settings.migTextureFilter;
    texturePackerSettings.maxHeight = MAX_TEXTURE_SIZE;
    texturePackerSettings.maxWidth = MAX_TEXTURE_SIZE;
    texturePackerSettings.combineSubdirectories = true;
    texturePackerSettings.silent = true;
    texturePackerSettings.useIndexes = false;
}
项目:c2d-engine    文件:C2dTestTexturePacker.java   
public static void main(String[] args) {
    Settings settings = new Settings();
    settings.maxHeight = 1024;
    settings.maxHeight = 1024;
    settings.stripWhitespaceX = settings.stripWhitespaceY = false;
    settings.rotation = false;


    TexturePacker.process(settings,
            "c2d-tests-desktop/assets-raw/turkey",
            "c2d-tests-android/assets/data/animationsprite",
            "turkey");
}
项目:c2d-engine    文件:Pack.java   
public static void main(String args[]) throws Exception {
    Settings settings = new Settings();
    settings.alias = true;
    settings.edgePadding = false;
    settings.maxWidth = 1024;
    settings.maxHeight = 1024;

    TexturePacker
            .process(settings,
                    "c2d-box2d-tools/raw",
                    "c2d-box2d-tools/assets/data/",
                    "cb2");
}
项目:ead    文件:GenerateSkinMojo.java   
private void generateMultipleSkins(FileHandle skinRaw, FileHandle skinRoot) {
    FileHandle[] ttfFonts = skinRaw.list(".ttf");
    FileHandle common = skinRaw.child("common");
    for (FileHandle dpi : skinRaw.list()) {
        if (dpi.isDirectory() && !"common".equals(dpi.name())
                && !"svg".equals(dpi.name())
                && !"9patch".equals(dpi.name())) {
            FileHandle skinFolder = skinRoot.child(skinRaw.name() + '-'
                    + dpi.name());
            skinFolder.mkdirs();
            skinRaw.child("skin.json").copyTo(skinFolder);
            FileHandle atlasImagesFolder = skinFolder.child("atlas");
            atlasImagesFolder.mkdirs();

            Settings settings = new Settings();
            settings.limitMemory = false;
            if (dpi.name().contains("xxx")) {
                settings.maxWidth = 2048;
                settings.maxHeight = 2048;
            }

            common.copyTo(atlasImagesFolder);
            dpi.child("images").copyTo(atlasImagesFolder);
            for (FileHandle font : ttfFonts) {
                font.copyTo(skinFolder);
            }

            TexturePacker.process(settings, atlasImagesFolder.file()
                    .getAbsolutePath(),
                    skinFolder.file().getAbsolutePath(), "skin");

            atlasImagesFolder.deleteDirectory();
        }
    }
}
项目:OpenChess    文件:GameTexturePacker.java   
public static void main(String[] args) {
    Settings settings = new Settings();
    String source = "../textures";
    String destination = "../android/assets/atlases";
    String atlasName = "open-chess-atlas";

    settings.maxWidth = 512;
    settings.maxHeight = 512;
    TexturePacker.process(settings, source, destination, atlasName);
}
项目:skin-composer    文件:MaxRectsPacker.java   
public MaxRectsPacker (Settings settings) {
    this.settings = settings;
    if (settings.minWidth > settings.maxWidth) throw new RuntimeException("Page min width cannot be higher than max width.");
    if (settings.minHeight > settings.maxHeight)
        throw new RuntimeException("Page min height cannot be higher than max height.");
}
项目:skin-composer    文件:GridPacker.java   
public GridPacker (Settings settings) {
    this.settings = settings;
}
项目:skin-composer    文件:TexturePackerFileProcessor.java   
public TexturePackerFileProcessor () {
    this(new Settings(), "pack.atlas");
}
项目:skin-composer    文件:ImageProcessor.java   
public ImageProcessor (Settings settings) {
    this(null, settings);
}
项目:gdx-texture-packer-gui    文件:OrderedGridPacker.java   
public OrderedGridPacker(Settings settings) {
    this.settings = settings;
}
项目:gdx-texture-packer-gui    文件:MaxRectsPacker.java   
public MaxRectsPacker (Settings settings) {
    this.settings = settings;
    if (settings.minWidth > settings.maxWidth) throw new RuntimeException("Page min width cannot be higher than max width.");
    if (settings.minHeight > settings.maxHeight)
        throw new RuntimeException("Page min height cannot be higher than max height.");
}
项目:gdx-texture-packer-gui    文件:GridPacker.java   
public GridPacker (Settings settings) {
    this.settings = settings;
}
项目:gdx-texture-packer-gui    文件:ImageProcessor.java   
public ImageProcessor(Settings settings) {
    this(null, settings);
}
项目:gdx-texture-packer-gui    文件:PackModel.java   
public Settings getSettings() {
    return settings;
}
项目:gdx-texture-packer-gui    文件:PackModel.java   
public void setSettings(Settings settings) {
    this.settings.set(settings);
}
项目:libgdxcn    文件:TiledMapPacker.java   
/** Traverse the specified tilesets, optionally lookup the used ids and pass every tile image to the {@link TexturePacker},
 * optionally ignoring unused tile ids */
private void packTilesets (ObjectMap<String, TiledMapTileSet> sets, FileHandle inputDirHandle, File outputDir,
    Settings texturePackerSettings) throws IOException {
    BufferedImage tile;
    Vector2 tileLocation;
    TileSetLayout packerTileSet;
    Graphics g;

    packer = new TexturePacker(texturePackerSettings);

    for (TiledMapTileSet set : sets.values()) {
        String tilesetName = set.getName();
        System.out.println("Processing tileset " + tilesetName);
        IntArray usedIds = this.settings.stripUnusedTiles ? getUsedIdsBucket(tilesetName, -1) : null;

        int tileWidth = set.getProperties().get("tilewidth", Integer.class);
        int tileHeight = set.getProperties().get("tileheight", Integer.class);
        int firstgid = set.getProperties().get("firstgid", Integer.class);
        String imageName = set.getProperties().get("imagesource", String.class);

        TileSetLayout layout = new TileSetLayout(firstgid, set, inputDirHandle);

        for (int gid = layout.firstgid, i = 0; i < layout.numTiles; gid++, i++) {
            if (usedIds != null && !usedIds.contains(gid)) {
                System.out.println("Stripped id #" + gid + " from tileset \"" + tilesetName + "\"");
                continue;
            }

            tileLocation = layout.getLocation(gid);
            tile = new BufferedImage(tileWidth, tileHeight, BufferedImage.TYPE_4BYTE_ABGR);

            g = tile.createGraphics();
            g.drawImage(layout.image, 0, 0, tileWidth, tileHeight, (int)tileLocation.x, (int)tileLocation.y, (int)tileLocation.x
                + tileWidth, (int)tileLocation.y + tileHeight, null);

            if (isBlended(tile)) setBlended(gid);
            System.out.println("Adding " + tileWidth + "x" + tileHeight + " (" + (int)tileLocation.x + ", " + (int)tileLocation.y
                + ")");
            packer.addImage(tile, this.settings.atlasOutputName + "_" + (gid-1));
        }
    }

    File outputDirTilesets = getRelativeFile(outputDir, this.settings.tilesetOutputDirectory);
    outputDirTilesets.mkdirs();
    packer.pack(outputDirTilesets, this.settings.atlasOutputName + ".atlas");
}
项目:libgdxcn    文件:MaxRectsPacker.java   
public MaxRectsPacker (Settings settings) {
    this.settings = settings;
    if (settings.minWidth > settings.maxWidth) throw new RuntimeException("Page min width cannot be higher than max width.");
    if (settings.minHeight > settings.maxHeight)
        throw new RuntimeException("Page min height cannot be higher than max height.");
}