Skip to content
Snippets Groups Projects
Commit ad9415ed authored by Matyáš Latner's avatar Matyáš Latner
Browse files

#30 Automatic creation of atlases from textures

 * gradle task for automatic creation of atlases from textures
 * refactored texture directory names
parent 99c1a8f2
Branches
Tags
No related merge requests found
Showing
with 28 additions and 7 deletions
import com.badlogic.gdx.tools.texturepacker.TexturePacker
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
...@@ -10,9 +12,13 @@ buildscript { ...@@ -10,9 +12,13 @@ buildscript {
classpath 'de.felixschulze.gradle:gradle-spoon-plugin:2.1' classpath 'de.felixschulze.gradle:gradle-spoon-plugin:2.1'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'com.novoda:gradle-android-command-plugin:1.3.0' classpath 'com.novoda:gradle-android-command-plugin:1.3.0'
classpath "com.badlogicgames.gdx:gdx-tools:1.6.1"
} }
} }
final assetsDirName = "assets"
final atlasesDirName = "atlases"
ext { ext {
assetsChecksumPattern = "\"=======ASSETS_CHECKSUM=======\"" assetsChecksumPattern = "\"=======ASSETS_CHECKSUM=======\""
assetsChecksum = [:] assetsChecksum = [:]
...@@ -53,6 +59,21 @@ allprojects { ...@@ -53,6 +59,21 @@ allprojects {
} }
} }
task texturePacker << {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.maxWidth = 2048;
settings.maxHeight = 2048;
def assetsDir = new File(project(":core").projectDir.absolutePath + "/${assetsDirName}")
assetsDir.eachDir() { langDir ->
langDir.eachDir() { sectionDir ->
sectionDir.eachDir() { atlasdir ->
TexturePacker.process(settings, "${atlasdir}", "${buildDir}/${atlasesDirName}/${langDir.name}/${sectionDir.name}/${atlasdir.name}/", "${atlasdir.name}")
}
}
}
}
def getVersionNameFromGit() { def getVersionNameFromGit() {
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()
exec { exec {
......
...@@ -39,9 +39,9 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> ...@@ -39,9 +39,9 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
public static final String GAME_DIFFICULTY_SCREEN_INFO_LABEL = "Game Difficulty"; public static final String GAME_DIFFICULTY_SCREEN_INFO_LABEL = "Game Difficulty";
private static final int SCREEN_TRANSACTION_FADE_DELAY = 1; private static final int SCREEN_TRANSACTION_FADE_DELAY = 1;
public static final String VICTORYSCREEN_RESULTSBANNER = "application/victoryscreen/resultsbanner.png"; public static final String VICTORYSCREEN_RESULTSBANNER = "game/_global/resultsbanner.png";
public static final String VICTORYSCREEN_RATINGSTAR_DISABLED = "application/victoryscreen/ratingstar_disabled.png"; public static final String VICTORYSCREEN_RATINGSTAR_DISABLED = "game/_global/ratingstar_disabled.png";
public static final String VICTORYSCREEN_RATINGSTAR_ENABLED = "application/victoryscreen/ratingstar_enabled.png"; public static final String VICTORYSCREEN_RATINGSTAR_ENABLED = "game/_global/ratingstar_enabled.png";
private RandomAccess randomAccess; private RandomAccess randomAccess;
private GameDifficulty gameDifficulty; private GameDifficulty gameDifficulty;
......
...@@ -23,7 +23,7 @@ public class ApplicationSoundManager extends TablexiaSoundManager implements IAp ...@@ -23,7 +23,7 @@ public class ApplicationSoundManager extends TablexiaSoundManager implements IAp
instance = null; instance = null;
} }
private static final String APPLICATION_PATH = "application/"; private static final String APPLICATION_PATH = "_global/";
private static final String MAINMENU_PATH = APPLICATION_PATH + "mainmenu/"; private static final String MAINMENU_PATH = APPLICATION_PATH + "mainmenu/";
public static final String MAINMENU_OPEN = MAINMENU_PATH + "mainmenu_open.mp3"; public static final String MAINMENU_OPEN = MAINMENU_PATH + "mainmenu_open.mp3";
......
...@@ -24,12 +24,12 @@ public class ApplicationTextureManager extends TablexiaTextureManager implements ...@@ -24,12 +24,12 @@ public class ApplicationTextureManager extends TablexiaTextureManager implements
} }
public static final class UniversalAssets { public static final class UniversalAssets {
public static final String BACKGROUND_WOODEN = "universal/background_wooden.png"; public static final String BACKGROUND_WOODEN = GLOBAL_PATH + "/universal/background_wooden.png";
} }
private static final String APPLICATION_PATH = "application/"; private static final String GLOBAL_PATH = "_global/";
private static final String MAINMENU_PATH = APPLICATION_PATH + "mainmenu/"; private static final String MAINMENU_PATH = GLOBAL_PATH + "mainmenu/";
public static final String MAINMENU_BACKGROUND = MAINMENU_PATH + "background.png"; public static final String MAINMENU_BACKGROUND = MAINMENU_PATH + "background.png";
public void load() { public void load() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment