diff --git a/lib/TerrarumSansBitmap.jar b/lib/TerrarumSansBitmap.jar index 1bd90e0fb..62e91097d 100644 Binary files a/lib/TerrarumSansBitmap.jar and b/lib/TerrarumSansBitmap.jar differ diff --git a/src/net/torvald/terrarum/gamecontroller/IME.kt b/src/net/torvald/terrarum/gamecontroller/IME.kt index f988d05ee..3d432bbc4 100644 --- a/src/net/torvald/terrarum/gamecontroller/IME.kt +++ b/src/net/torvald/terrarum/gamecontroller/IME.kt @@ -241,6 +241,7 @@ object IME { TerrarumIMEConf(name, copying, lang, candidatesCount, if (keysymtable == null) keysyms else null, if (keysymtable == null) null else keysymtable, mode), { headkey, shifted, alted, lowLayerKeysym -> val a = jsval.invokeMember("accept", headkey, shifted, alted, lowLayerKeysym) +// println(a.getArrayElement(0).asString().map { it.code.toString(16) }) a.getArrayElement(0).asString().toCanditates() to a.getArrayElement(1).asString() }, { jsval.invokeMember("backspace").asString().toCanditates() diff --git a/src/net/torvald/terrarum/gamecontroller/IMEProviderDelegate.kt b/src/net/torvald/terrarum/gamecontroller/IMEProviderDelegate.kt index 0b7a27af8..0cfb80173 100644 --- a/src/net/torvald/terrarum/gamecontroller/IMEProviderDelegate.kt +++ b/src/net/torvald/terrarum/gamecontroller/IMEProviderDelegate.kt @@ -29,7 +29,7 @@ class IMEDictionary(private val filename: String) { private var dictLoaded = false private fun loadDict() { - val reader = FileReader(File("assets/keylayout/", filename)) + val reader = FileReader(File("assets/keylayout/", filename), Charsets.UTF_8) reader.forEachLine { if (it.contains(',')) { val (key, value) = it.split(',') diff --git a/src/net/torvald/terrarum/modulebasegame/ui/Notification.kt b/src/net/torvald/terrarum/modulebasegame/ui/Notification.kt index a4ec9880d..a3eae9157 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/Notification.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/Notification.kt @@ -74,7 +74,7 @@ class Notification : UICanvas() { message.forEachIndexed { index, s -> val xoff = 6 + (displayedTextWidth - realTextWidth) / 2 val y = -textHeight + App.fontGame.lineHeight * index - App.fontGame.draw(batch, s, LRmargin + xoff, y) + App.fontGame.draw(batch, s, LRmargin + xoff, y ) } diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIGraphicsControlPanel.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIGraphicsControlPanel.kt index bb9f2e40c..11ec92628 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIGraphicsControlPanel.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIGraphicsControlPanel.kt @@ -180,7 +180,7 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() { else drawX + width/2 - panelgap - labelWidth // right aligned at the middle of the panel, offsetted by panelgap - App.fontGame.draw(batch, label, xpos.toFloat(), drawY + optionsYpos[index].toFloat()) + App.fontGame.draw(batch, label, xpos.toFloat(), drawY + optionsYpos[index] - 2f) // draw hrule if (mode == "h1") { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIIMEConfig.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIIMEConfig.kt index 942c76ae7..99ca02d03 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIIMEConfig.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIIMEConfig.kt @@ -350,7 +350,7 @@ private class UIItemInputKeycap( batch.draw(labels.get(21,2), (posX + (width - 20) / 2).toFloat(), posY + 4f) else { val keysymw = App.fontGame.getWidth(keysym) - App.fontGame.draw(batch, keysym, posX + (width - keysymw) / 2, posY + 4) + App.fontGame.draw(batch, keysym, posX + (width - keysymw) / 2, posY + 2) } } diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt index 16cf431b6..cdb196910 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt @@ -416,17 +416,17 @@ class UIItemControlPaletteBaloon(val parent: UIKeyboardControlPanel, initialX: I // texts. Sorted in the same way as UIItemControlPaletteBaloon.iconButtons batch.color = Color.WHITE - App.fontGame.draw(batch, Lang["GAME_ACTION_MOVE_VERB"], col0 + 72, posY + 43) - App.fontGame.draw(batch, Lang["GAME_ACTION_JUMP"], col1 + 40, posY + 43) + App.fontGame.draw(batch, Lang["GAME_ACTION_MOVE_VERB"], col0 + 72, posY + 41) + App.fontGame.draw(batch, Lang["GAME_ACTION_JUMP"], col1 + 40, posY + 41) - App.fontGame.draw(batch, Lang["GAME_INVENTORY"], col0 + 40, row1) - App.fontGame.draw(batch, Lang["GAME_CRAFTING"], col0 + 40, row2) - App.fontGame.draw(batch, Lang["GAME_ACTION_GRAPPLE"], col0 + 40, row3) - App.fontGame.draw(batch, Lang["GAME_ACTION_QUICKSEL"], col0 + 40, row4) + App.fontGame.draw(batch, Lang["GAME_INVENTORY"], col0 + 40, row1 - 2) + App.fontGame.draw(batch, Lang["GAME_CRAFTING"], col0 + 40, row2 - 2) + App.fontGame.draw(batch, Lang["GAME_ACTION_GRAPPLE"], col0 + 40, row3 - 2) + App.fontGame.draw(batch, Lang["GAME_ACTION_QUICKSEL"], col0 + 40, row4 - 2) - App.fontGame.draw(batch, Lang["GAME_ACTION_ZOOM"], col1 + 40, row1) - App.fontGame.draw(batch, Lang["MENU_LABEL_IME_TOGGLE"], col1 + 40, row2) - App.fontGame.draw(batch, Lang["MENU_LABEL_MENU"], col1 + 40, row3) + App.fontGame.draw(batch, Lang["GAME_ACTION_ZOOM"], col1 + 40, row1 - 2) + App.fontGame.draw(batch, Lang["MENU_LABEL_IME_TOGGLE"], col1 + 40, row2 - 2) + App.fontGame.draw(batch, Lang["MENU_LABEL_MENU"], col1 + 40, row3 - 2) } diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadDemoSavefiles.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadDemoSavefiles.kt index 9bc2f660c..baaf7ac52 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UILoadDemoSavefiles.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadDemoSavefiles.kt @@ -636,10 +636,10 @@ class UIItemPlayerCells( // texts batch.color = highlightTextCol val playTimeTextLen = App.fontGame.getWidth(totalPlayTime) - App.fontGame.draw(batch, playerName, x + 146f, y + height - 82f) - App.fontGame.draw(batch, worldName, x + 146f, y + height - 53f) - App.fontGame.draw(batch, lastPlayTime, x + 146f, y + height - 24f) - App.fontGame.draw(batch, totalPlayTime, x + width - 5f - playTimeTextLen, y + height - 24f) + App.fontGame.draw(batch, playerName, x + 146f, y + height - 84f) + App.fontGame.draw(batch, worldName, x + 146f, y + height - 55f) + App.fontGame.draw(batch, lastPlayTime, x + 146f, y + height - 26f) + App.fontGame.draw(batch, totalPlayTime, x + width - 5f - playTimeTextLen, y + height - 26f) // icons batch.draw(icons.get(24,0), x + 120f, y + height - 82f) // player name batch.draw(icons.get(12,0), x + 119f, y + height - 53f) // world map @@ -808,7 +808,7 @@ class UIItemWorldCells( App.fontSmallNumbers.draw(batch, "${skimmer.diskFile.length().ushr(10)} KiB", x + 3f, y + height - 16f) // savegame name if (saveDamaged) batch.color = colourBad - App.fontGame.draw(batch, saveName, x + 3f, y + 1f) + App.fontGame.draw(batch, saveName, x + 3f, y + -1f) super.render(batch, camera) batch.color = Color.WHITE diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UITooltip.kt b/src/net/torvald/terrarum/modulebasegame/ui/UITooltip.kt index e0fc73a72..269c56ca8 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UITooltip.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UITooltip.kt @@ -35,10 +35,10 @@ class UITooltip : UICanvas() { val textMarginX = 4 override var width: Int - get() = msgWidth + (textMarginX + Toolkit.baloonTile.tileW) * 2 + get() = msgWidth + (textMarginX + 36) * 2 set(value) { throw Error("You are not supposed to set the width of the tooltip manually.") } override var height: Int - get() = Toolkit.baloonTile.tileH * 2 + font.lineHeight.toInt() + get() = 36 * 2 + font.lineHeight.toInt() set(value) { throw Error("You are not supposed to set the height of the tooltip manually.") } override fun renderUI(batch: SpriteBatch, camera: Camera) { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalListing.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalListing.kt index 864f303bd..329cfc4f3 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalListing.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalListing.kt @@ -387,9 +387,9 @@ class UIItemWorldCellsSimple( // draw texts batch.color = tcol batch.draw(icons.get(0, 1), posX + 4f, posY + 1f) - App.fontGame.draw(batch, worldName ?: "$EMDASH", posX + 32, posY + 1) + App.fontGame.draw(batch, worldName ?: "$EMDASH", posX + 32, posY - 1) batch.draw(icons.get(1, 1), posX + 4f, posY + 25f) - App.fontGame.draw(batch, if (worldInfo?.seed == null) "$EMDASH" else "${(if (worldInfo.seed > 0) "+" else "")}${worldInfo.seed}" , posX + 32, posY + 25) + App.fontGame.draw(batch, if (worldInfo?.seed == null) "$EMDASH" else "${(if (worldInfo.seed > 0) "+" else "")}${worldInfo.seed}" , posX + 32, posY + 23) // text separator batch.color = bcol.cpy().sub(0f,0f,0f,0.65f) Toolkit.fillArea(batch, posX + 2, posY + 23, width - 4, 1) diff --git a/src/net/torvald/terrarum/ui/Toolkit.kt b/src/net/torvald/terrarum/ui/Toolkit.kt index c4d3616a4..d87547176 100644 --- a/src/net/torvald/terrarum/ui/Toolkit.kt +++ b/src/net/torvald/terrarum/ui/Toolkit.kt @@ -21,6 +21,7 @@ object Toolkit : Disposable { object Theme { val COL_INVENTORY_CELL_BORDER = Color(1f, 1f, 1f, 0.25f) val COL_CELL_FILL = Color(0x282828C8) + val COL_CELL_FILL_OPAQUE = Color(0x282828FF) val COL_LIST_DEFAULT = Color.WHITE // white val COL_INACTIVE = Color.LIGHT_GRAY @@ -50,7 +51,7 @@ object Toolkit : Disposable { private lateinit var blurWriteQuad2: Mesh private lateinit var blurWriteQuad4: Mesh - val baloonTile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36) +// val baloonTile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36) val textureWhiteSquare = Texture(Gdx.files.internal("assets/graphics/ortho_line_tex_2px.tga")) val textureWhiteCircle = Texture(Gdx.files.internal("assets/graphics/circle_512.tga")) @@ -70,7 +71,7 @@ object Toolkit : Disposable { private val rng = HQRNG() override fun dispose() { - baloonTile.dispose() +// baloonTile.dispose() textureWhiteSquare.dispose() textureWhiteCircle.dispose() @@ -251,7 +252,7 @@ object Toolkit : Disposable { fun drawBaloon(batch: SpriteBatch, x: Float, y: Float, w: Float, h: Float) { // centre area - batch.draw(baloonTile.get(1, 1), x, y, w, h) + /*batch.draw(baloonTile.get(1, 1), x, y, w, h) // edges batch.draw(baloonTile.get(1, 0), x, y - baloonTile.tileH, w, baloonTile.tileH.toFloat()) @@ -263,7 +264,13 @@ object Toolkit : Disposable { batch.draw(baloonTile.get(0, 0), x - baloonTile.tileW, y - baloonTile.tileH) batch.draw(baloonTile.get(2, 0), x + w, y - baloonTile.tileH) batch.draw(baloonTile.get(2, 2), x + w, y + h) - batch.draw(baloonTile.get(0, 2), x - baloonTile.tileW, y + h) + batch.draw(baloonTile.get(0, 2), x - baloonTile.tileW, y + h)*/ + + + batch.color = Theme.COL_CELL_FILL_OPAQUE + fillArea(batch, x - 4, y - 4, w + 8, h + 8) + batch.color = Theme.COL_INACTIVE + drawBoxBorder(batch, x - 4, y - 4, w + 8, h + 8) } private var init = false diff --git a/src/net/torvald/terrarum/ui/UIItemInlineRadioButtons.kt b/src/net/torvald/terrarum/ui/UIItemInlineRadioButtons.kt index 1a70ba7ae..6f6f9a11c 100644 --- a/src/net/torvald/terrarum/ui/UIItemInlineRadioButtons.kt +++ b/src/net/torvald/terrarum/ui/UIItemInlineRadioButtons.kt @@ -72,7 +72,7 @@ class UIItemInlineRadioButtons( val xpos = getCellX(i) val text = labelfuns[i]() val tw = App.fontGame.getWidth(text) - App.fontGame.draw(batch, text, xpos + (cellWidth - tw) / 2, posY + 2) + App.fontGame.draw(batch, text, xpos + (cellWidth - tw) / 2, posY) } } @@ -83,7 +83,7 @@ class UIItemInlineRadioButtons( Toolkit.drawBoxBorder(batch, xpos - 1, posY - 1, cellWidth + 2, height + 2) val text = labelfuns[mouseOnSelection]() val tw = App.fontGame.getWidth(text) - App.fontGame.draw(batch, text, xpos + (cellWidth - tw) / 2, posY + 2) + App.fontGame.draw(batch, text, xpos + (cellWidth - tw) / 2, posY) } // selection borders and text @@ -92,7 +92,7 @@ class UIItemInlineRadioButtons( Toolkit.drawBoxBorder(batch, xpos - 1, posY - 1, cellWidth + 2, height + 2) val text = labelfuns[selection]() val tw = App.fontGame.getWidth(text) - App.fontGame.draw(batch, text, xpos + (cellWidth - tw) / 2, posY + 2) + App.fontGame.draw(batch, text, xpos + (cellWidth - tw) / 2, posY) super.render(batch, camera) diff --git a/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt b/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt index 190fae4c3..e96d390d9 100644 --- a/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt +++ b/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt @@ -85,12 +85,12 @@ class UIItemModuleInfoCell( batch.draw(modIcon, initialX + 35f, initialY + 12f) batch.shader = null batch.color = Color.WHITE - App.fontGame.draw(batch, "$ccZero${modName.toUpperCase()}$ccNum $modVer", initialX + 86f + 3f, initialY + 2f) + App.fontGame.draw(batch, "$ccZero${modName.toUpperCase()}$ccNum $modVer", initialX + 86f + 3f, initialY.toFloat()) if (modErrored) - App.fontGame.draw(batch, "$emphRed${modErrors.first().cause?.message}", initialX + 86f + 3f, initialY + 26f) + App.fontGame.draw(batch, "$emphRed${modErrors.first().cause?.message}", initialX + 86f + 3f, initialY + 24f) else - App.fontGame.draw(batch, "$ccDesc$modDesc", initialX + 86f + 3f, initialY + 26f) - App.fontGame.draw(batch, "$ccZero2$modAuthor$ccNum2 $modDate", initialX + 86f + 3f, initialY + 50f) + App.fontGame.draw(batch, "$ccDesc$modDesc", initialX + 86f + 3f, initialY + 24f) + App.fontGame.draw(batch, "$ccZero2$modAuthor$ccNum2 $modDate", initialX + 86f + 3f, initialY + 48f) if (modErrored) { batch.draw(CommonResourcePool.getAsTextureRegion("basegame_errored_icon32"), initialX + width - 40f, initialY + 8f + 12f) diff --git a/src/net/torvald/terrarum/ui/UIItemSpinner.kt b/src/net/torvald/terrarum/ui/UIItemSpinner.kt index 78e77eb19..849dbc88c 100644 --- a/src/net/torvald/terrarum/ui/UIItemSpinner.kt +++ b/src/net/torvald/terrarum/ui/UIItemSpinner.kt @@ -158,7 +158,7 @@ class UIItemSpinner( // draw text batch.color = UIItemTextLineInput.TEXTINPUT_COL_TEXT // batch.draw(fbo.colorBufferTexture, posX + buttonW + 3f, posY + 2f, fbo.width.toFloat(), fbo.height.toFloat()) - App.fontGame.draw(batch, textCache, posX + buttonW + 3f + (fboWidth - textCacheLen).div(2), posY + 2f) + App.fontGame.draw(batch, textCache, posX + buttonW + 3f + (fboWidth - textCacheLen).div(2), posY.toFloat()) super.render(batch, camera) } diff --git a/src/net/torvald/terrarum/ui/UIItemTextButton.kt b/src/net/torvald/terrarum/ui/UIItemTextButton.kt index 41b6861d6..4b7a90c3b 100644 --- a/src/net/torvald/terrarum/ui/UIItemTextButton.kt +++ b/src/net/torvald/terrarum/ui/UIItemTextButton.kt @@ -81,7 +81,7 @@ open class UIItemTextButton( Alignment.LEFT -> posX + paddingLeft Alignment.RIGHT -> width - paddingRight - textW } - val fontY = posY + 2 + (hitboxSize - font.lineHeight.toInt()) / 2 + val fontY = posY + (hitboxSize - font.lineHeight.toInt()) / 2 // draw background diff --git a/src/net/torvald/terrarum/ui/UIItemTextLineInput.kt b/src/net/torvald/terrarum/ui/UIItemTextLineInput.kt index 6885546a7..decc660df 100644 --- a/src/net/torvald/terrarum/ui/UIItemTextLineInput.kt +++ b/src/net/torvald/terrarum/ui/UIItemTextLineInput.kt @@ -517,7 +517,7 @@ class UIItemTextLineInput( 0 // TODO support alignment-right - App.fontGameFBO.draw(it, text, -1f*cursorDrawScroll + textDrawOffset, 0f) + App.fontGameFBO.draw(it, text, -1f*cursorDrawScroll + textDrawOffset, -2f) } } textCommitListener(getTextOrPlaceholder()) } @@ -587,7 +587,8 @@ class UIItemTextLineInput( batch.draw(labels.get(8,2), btn2PosX + 2f, posY + 2f) // state of the candidates are concurrently changing, so we buffer them - val localCandidates = ArrayList(); candidates.forEach { localCandidates.add(it) } + val localCandidates = ArrayList() + candidates.forEach { localCandidates.add(it) } // draw candidates view if (localCandidates.isNotEmpty() && ime != null) { @@ -618,7 +619,7 @@ class UIItemTextLineInput( val candidateNum = listOf(i+48,46,32) App.fontGame.draw(batch, CodepointSequence(candidateNum + localCandidates[i]), candidatePosX + (i / halfcount) * (longestCandidateW + 3) + 2, - candidatePosY + (i % halfcount) * 20 // using hard-coded 20 instead of the actual font height of 24 + candidatePosY + (i % halfcount) * 20 - 2 // using hard-coded 20 instead of the actual font height of 24 ) } @@ -639,7 +640,7 @@ class UIItemTextLineInput( Toolkit.drawBoxBorder(batch, candidatePosX - 1, candidatePosY - 1, candidateWinW + 2, candidateWinH + 2) val previewTextWidth = textWidths[0] - App.fontGame.draw(batch, localCandidates[0], candidatePosX + (candidateWinW - previewTextWidth) / 2, candidatePosY) + App.fontGame.draw(batch, localCandidates[0], candidatePosX + (candidateWinW - previewTextWidth) / 2, candidatePosY - 2) } } diff --git a/src/net/torvald/terrarum/ui/UIItemTextSelector.kt b/src/net/torvald/terrarum/ui/UIItemTextSelector.kt index 6b945ac07..34cb8501b 100644 --- a/src/net/torvald/terrarum/ui/UIItemTextSelector.kt +++ b/src/net/torvald/terrarum/ui/UIItemTextSelector.kt @@ -197,7 +197,7 @@ class UIItemTextSelector( val t = labelCache[selection] val tw = App.fontGame.getWidth(t) // batch.draw(fbo.colorBufferTexture, posX + buttonW + 3f, posY + 2f, fbo.width.toFloat(), fbo.height.toFloat()) - App.fontGame.draw(batch, t, posX + buttonW + 3 + (fboWidth - tw) / 2, posY + 2) + App.fontGame.draw(batch, t, posX + buttonW + 3 + (fboWidth - tw) / 2, posY) } // palette else { @@ -226,7 +226,7 @@ class UIItemTextSelector( val tw = App.fontGame.getWidth(t) App.fontGame.draw(batch, t, palX + (palW - tw) / 2, - getPalItemPosY(index) + getPalItemPosY(index) - 2 ) } }