mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 11:51:50 +09:00
typewriter: faster typing sound, backspace is working again
This commit is contained in:
@@ -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.
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user