typewriter: faster typing sound, backspace is working again

This commit is contained in:
minjaesong
2021-11-26 16:58:54 +09:00
parent 1fce4055d7
commit 87012d7671
4 changed files with 15 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
package net.torvald.terrarumtypewriterbitmap.gdx
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.Batch
@@ -206,9 +207,13 @@ class TerrarumTypewriterBitmap(
val codeStartX = cellX + binaryCodeOffset
val codeStartY = cellY
val width = (0..4).fold(0) { acc, y -> acc or ((pixmap.getPixel(codeStartX, codeStartY + y).and(255) != 0).toInt() shl y) }
var width = (0..4).fold(0) { acc, y -> acc or ((pixmap.getPixel(codeStartX, codeStartY + y).and(255) != 0).toInt() shl y) }
val isLowHeight = (pixmap.getPixel(codeStartX, codeStartY + 5).and(255) != 0)
if (code in 0xF2000..0xF3FFF && code and 127 == Input.Keys.BACKSPACE) {
width *= -1
}
// Keming machine parameters
val kerningBit1 = pixmap.getPixel(codeStartX, codeStartY + 6).tagify()
val kerningBit2 = pixmap.getPixel(codeStartX, codeStartY + 7).tagify()