gdx font: can customise font spritesheet location

This commit is contained in:
minjaesong
2017-06-16 19:29:40 +09:00
parent 5894cb944a
commit fc9778118f
2 changed files with 3 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ class TestTestTest : ApplicationAdapter() {
batch = SpriteBatch() batch = SpriteBatch()
img = Texture("assets/test_texture.tga") img = Texture("assets/test_texture.tga")
gameFont = GameFontBase(false) gameFont = GameFontBase("assets/graphics/fonts")
//gameFont = BitmapFont() //gameFont = BitmapFont()
} }

View File

@@ -34,7 +34,7 @@ import java.util.zip.GZIPInputStream
* *
* Created by minjaesong on 2017-06-15. * Created by minjaesong on 2017-06-15.
*/ */
class GameFontBase(val noShadow: Boolean = false) : BitmapFont() { class GameFontBase(fontDir: String, val noShadow: Boolean = false) : BitmapFont() {
private fun getHanChosung(hanIndex: Int) = hanIndex / (JUNG_COUNT * JONG_COUNT) private fun getHanChosung(hanIndex: Int) = hanIndex / (JUNG_COUNT * JONG_COUNT)
private fun getHanJungseong(hanIndex: Int) = hanIndex / JONG_COUNT % JUNG_COUNT private fun getHanJungseong(hanIndex: Int) = hanIndex / JONG_COUNT % JUNG_COUNT
@@ -140,7 +140,7 @@ class GameFontBase(val noShadow: Boolean = false) : BitmapFont() {
SHEET_THAI_VARW SHEET_THAI_VARW
) )
private val fontParentDir = "assets/graphics/fonts/" private val fontParentDir = if (fontDir.endsWith('/') || fontDir.endsWith('\\')) fontDir else "$fontDir/"
private val fileList = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!! private val fileList = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!!
"ascii_variable.tga", "ascii_variable.tga",
"hangul_johab.tga", "hangul_johab.tga",