LibGDX's TexturePacker with gradle

后端 未结 1 670
北海茫月
北海茫月 2021-01-02 16:37

I am attempting to create a gradle task which runs TexturePacker according to the instructions here. (Note that I am using Android Studio and its directory structure rather

相关标签:
1条回答
  • 2021-01-02 17:32

    I got it working by adding gdx-tools to my buildscript dependencies:

    buildscript{
        dependencies {
           ...
           classpath 'com.badlogicgames.gdx:gdx-tools:1.5.4'
        }
    }
    

    by doing this, my desktop's build.gradle was able to import the texture packer class:

    import com.badlogic.gdx.tools.texturepacker.TexturePacker
    task texturePacker << {
        if (project.ext.has('texturePacker')) {
            logger.info "Calling TexturePacker: "+ texturePacker
            TexturePacker.process(texturePacker[0], texturePacker[1], texturePacker[2])
        }
    }
    

    please note that your desktop project's ext will need to have texturePacker defined:

    project.ext {
        mainClassName = "your.game.package.DesktopLauncher"
        assetsDir = new File("../android/assets");
        texturePacker = ["../images/sprites", "../android/assets", "sprites"]
    }
    
    0 讨论(0)
提交回复
热议问题