mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-14 23:16:08 +09:00
little diagnose print
This commit is contained in:
@@ -440,16 +440,23 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
if (it.endsWith(".gz")) {
|
||||
val tmpFileName = "tmp_${it.dropLast(7)}.tga"
|
||||
|
||||
val gzi = GZIPInputStream(Gdx.files.internal(fontParentDir + it).read(8192))
|
||||
val wholeFile = gzi.readBytes()
|
||||
gzi.close()
|
||||
val fos = BufferedOutputStream(FileOutputStream(tmpFileName))
|
||||
fos.write(wholeFile)
|
||||
fos.flush()
|
||||
fos.close()
|
||||
try {
|
||||
val gzi = GZIPInputStream(Gdx.files.internal(fontParentDir + it).read(8192))
|
||||
val wholeFile = gzi.readBytes()
|
||||
gzi.close()
|
||||
val fos = BufferedOutputStream(FileOutputStream(tmpFileName))
|
||||
fos.write(wholeFile)
|
||||
fos.flush()
|
||||
fos.close()
|
||||
|
||||
pixmap = Pixmap(Gdx.files.internal(tmpFileName))
|
||||
pixmap = Pixmap(Gdx.files.internal(tmpFileName))
|
||||
}
|
||||
catch (e: GdxRuntimeException) {
|
||||
//e.printStackTrace()
|
||||
System.err.println("[TerrarumSansBitmap] said texture not found, skipping...")
|
||||
|
||||
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
||||
}
|
||||
//File(tmpFileName).delete()
|
||||
}
|
||||
else {
|
||||
@@ -457,12 +464,16 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
pixmap = Pixmap(Gdx.files.internal(fontParentDir + it))
|
||||
}
|
||||
catch (e: GdxRuntimeException) {
|
||||
e.printStackTrace()
|
||||
//e.printStackTrace()
|
||||
System.err.println("[TerrarumSansBitmap] said texture not found, skipping...")
|
||||
|
||||
// if non-ascii chart is missing, replace it with null sheet
|
||||
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
||||
// else, notify by error
|
||||
if (index != 0) System.exit(1)
|
||||
if (index == 0) {
|
||||
System.err.println("[TerrarumSansBitmap] The ASCII sheet is gone, something is wrong.")
|
||||
System.exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,10 +55,11 @@ class PixmapRegionPack(
|
||||
init {
|
||||
if (!xySwapped) {
|
||||
regions = Array<Pixmap>(horizontalCount * verticalCount, {
|
||||
val region = Pixmap(tileW, tileH, Pixmap.Format.RGBA8888)
|
||||
val rx = (it % horizontalCount * (tileW + hGap)) + hFrame // pixel, not index
|
||||
val ry = (it / horizontalCount * (tileH + vGap)) + vFrame // pixel, not index
|
||||
|
||||
val region = Pixmap(tileW, tileH, Pixmap.Format.RGBA8888)
|
||||
|
||||
/*region.setColor(Color.WHITE)
|
||||
region.drawPixmap(pixmap, 0, 0,
|
||||
rx * (tileW + hGap),
|
||||
@@ -71,9 +72,6 @@ class PixmapRegionPack(
|
||||
|
||||
//println(region.pixels.capacity())
|
||||
|
||||
//val bytesBucket = ByteArray(4 * tileW * tileH)
|
||||
//var bytesBucketHead = 0
|
||||
|
||||
for (y in 0 until tileH) {
|
||||
//println("${pixmap.width * pixmap.height * 4} ==? ${pixmap.pixels.capacity()}")
|
||||
|
||||
@@ -86,9 +84,25 @@ class PixmapRegionPack(
|
||||
|
||||
pixmap.pixels.position(offsetY + offsetX)
|
||||
pixmap.pixels.get(bytesBuffer, 0, bytesBuffer.size)
|
||||
|
||||
// test print bytesbuffer
|
||||
bytesBuffer.forEachIndexed { index, it ->
|
||||
if (index % 4 == 3) {
|
||||
if (it == 255.toByte()) print("█") else print("·")
|
||||
}
|
||||
}
|
||||
println()
|
||||
|
||||
region.pixels.put(bytesBuffer)
|
||||
}
|
||||
|
||||
|
||||
println()
|
||||
|
||||
//val region = Pixmap(5, 20, Pixmap.Format.RGBA8888)
|
||||
//region.pixels.rewind()
|
||||
//region.pixels.put(byteArrayOf(-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1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