mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-06-13 17:24:03 +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")) {
|
if (it.endsWith(".gz")) {
|
||||||
val tmpFileName = "tmp_${it.dropLast(7)}.tga"
|
val tmpFileName = "tmp_${it.dropLast(7)}.tga"
|
||||||
|
|
||||||
val gzi = GZIPInputStream(Gdx.files.internal(fontParentDir + it).read(8192))
|
try {
|
||||||
val wholeFile = gzi.readBytes()
|
val gzi = GZIPInputStream(Gdx.files.internal(fontParentDir + it).read(8192))
|
||||||
gzi.close()
|
val wholeFile = gzi.readBytes()
|
||||||
val fos = BufferedOutputStream(FileOutputStream(tmpFileName))
|
gzi.close()
|
||||||
fos.write(wholeFile)
|
val fos = BufferedOutputStream(FileOutputStream(tmpFileName))
|
||||||
fos.flush()
|
fos.write(wholeFile)
|
||||||
fos.close()
|
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()
|
//File(tmpFileName).delete()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -457,12 +464,16 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
|||||||
pixmap = Pixmap(Gdx.files.internal(fontParentDir + it))
|
pixmap = Pixmap(Gdx.files.internal(fontParentDir + it))
|
||||||
}
|
}
|
||||||
catch (e: GdxRuntimeException) {
|
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
|
// if non-ascii chart is missing, replace it with null sheet
|
||||||
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
||||||
// else, notify by error
|
// 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 {
|
init {
|
||||||
if (!xySwapped) {
|
if (!xySwapped) {
|
||||||
regions = Array<Pixmap>(horizontalCount * verticalCount, {
|
regions = Array<Pixmap>(horizontalCount * verticalCount, {
|
||||||
val region = Pixmap(tileW, tileH, Pixmap.Format.RGBA8888)
|
|
||||||
val rx = (it % horizontalCount * (tileW + hGap)) + hFrame // pixel, not index
|
val rx = (it % horizontalCount * (tileW + hGap)) + hFrame // pixel, not index
|
||||||
val ry = (it / horizontalCount * (tileH + vGap)) + vFrame // 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.setColor(Color.WHITE)
|
||||||
region.drawPixmap(pixmap, 0, 0,
|
region.drawPixmap(pixmap, 0, 0,
|
||||||
rx * (tileW + hGap),
|
rx * (tileW + hGap),
|
||||||
@@ -71,9 +72,6 @@ class PixmapRegionPack(
|
|||||||
|
|
||||||
//println(region.pixels.capacity())
|
//println(region.pixels.capacity())
|
||||||
|
|
||||||
//val bytesBucket = ByteArray(4 * tileW * tileH)
|
|
||||||
//var bytesBucketHead = 0
|
|
||||||
|
|
||||||
for (y in 0 until tileH) {
|
for (y in 0 until tileH) {
|
||||||
//println("${pixmap.width * pixmap.height * 4} ==? ${pixmap.pixels.capacity()}")
|
//println("${pixmap.width * pixmap.height * 4} ==? ${pixmap.pixels.capacity()}")
|
||||||
|
|
||||||
@@ -86,9 +84,25 @@ class PixmapRegionPack(
|
|||||||
|
|
||||||
pixmap.pixels.position(offsetY + offsetX)
|
pixmap.pixels.position(offsetY + offsetX)
|
||||||
pixmap.pixels.get(bytesBuffer, 0, bytesBuffer.size)
|
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)
|
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,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,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