Actor reference ID on debug window, RefID is now Int, added Japanese on help page

Former-commit-id: 3519b8746d611c4badd65f01644ba05e41d10d04
Former-commit-id: 45bb407c2d932e5d70aab9c9eb4f3ef55ce68d27
This commit is contained in:
Song Minjae
2016-04-16 01:03:19 +09:00
parent f0d2415906
commit 7c6d232ba6
15 changed files with 114 additions and 36 deletions

View File

@@ -156,9 +156,7 @@ constructor() : Font {
override fun getLineHeight() = H
override fun drawString(x: Float, y: Float, s: String) {
drawString(x, y, s, Color.white)
}
override fun drawString(x: Float, y: Float, s: String) = drawString(x, y, s, Color.white)
override fun drawString(x: Float, y: Float, s: String, color: Color) {
GL11.glEnable(GL11.GL_BLEND)
@@ -364,10 +362,13 @@ constructor() : Font {
)*/
sheetKey[prevInstance].getSubImage(sheetX, sheetY).draw(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat() // Interchar: pull punct right next to hangul to the left
+ if (i > 0 && isHangul(s[i - 1])) -3f else 0f,
+ if (i > 0 && isHangul(s[i - 1])) -3f
else 0f,
Math.round(y).toFloat() + (if (prevInstance == SHEET_CJK_PUNCT) -1
else if (prevInstance == SHEET_FW_UNI) (H - H_HANGUL) / 2
else 0).toFloat(),
color
)
}

View File

@@ -0,0 +1,50 @@
package net.torvald.imagefont
import org.newdawn.slick.Color
import org.newdawn.slick.Font
import org.newdawn.slick.SpriteSheet
/**
* Created by minjaesong on 16-04-15.
*/
class SmallNumbers : Font {
internal val fontSheet: SpriteSheet
internal val W = 8
internal val H = 8
private val chars = arrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-')
init {
fontSheet = SpriteSheet("./res/graphics/fonts/numeric_small.png", W, H)
}
override fun getHeight(str: String): Int = H
override fun getWidth(str: String): Int = str.length * W
override fun getLineHeight(): Int = H
override fun drawString(x: Float, y: Float, text: String) = drawString(x, y, text, Color.white)
override fun drawString(x: Float, y: Float, text: String, col: Color) {
for (i in 0..text.length - 1) {
val index = charToSpriteNum(text.codePointAt(i))
if (index != null) {
fontSheet.getSubImage(index, 0).draw(
x + i * W, y, col
)
}
}
}
override fun drawString(x: Float, y: Float, text: String, col: Color, startIndex: Int, endIndex: Int) {
throw UnsupportedOperationException()
}
private fun charToSpriteNum(ch: Int): Int? =
if (ch in '0'.toInt()..'9'.toInt()) ch - '0'.toInt()
else if (ch == '-'.toInt()) 10
else null
}