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

@@ -109,7 +109,7 @@ class TypewriterGDX(val width: Int, val height: Int, val cols: Int) : Game() {
var initDone = false
var initTimer = 0f
var initTypingCursor = 0
var keystrokeDelay = 0.12f
var keystrokeDelay = 0.08f
fun acceptKey(keycode: Int, force: Boolean = false) {
if (initDone || force) {
@@ -187,13 +187,13 @@ class TypewriterGDX(val width: Int, val height: Int, val cols: Int) : Game() {
initTimer -= keystrokeDelay
if (keyToType == Input.Keys.ENTER)
initTimer -= 0.4f
initTimer -= 0.35f
else if (keyToType == 0x561F71)
initTimer -= 0.2f
else if (keyToType == 0x561F70)
initTimer -= 0.15f
else if (keyToType == 0x561F70)
initTimer -= 0.1f
else
initTimer -= Math.random().toFloat() * 0.08f
initTimer -= Math.random().toFloat() * 0.04f
}
initTimer += Gdx.graphics.deltaTime

Binary file not shown.

Binary file not shown.

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()