32 bit warning sign

This commit is contained in:
minjaesong
2021-10-05 21:56:14 +09:00
parent a8b04fcff1
commit da81de6258
8 changed files with 60 additions and 17 deletions

View File

@@ -8,5 +8,8 @@
"MENU_CREDIT_GPL_DNT" : "GPL",
"GAME_ACTION_MOVE_VERB" : "Move",
"GAME_ACTION_ZOOM" : "Zoom",
"MENU_LABEL_RESET" : "Reset"
"MENU_LABEL_RESET" : "Reset",
"GAME_32BIT_WARNING1": "It looks like youre running a 32-Bit version of Java.",
"GAME_32BIT_WARNING2": "Please download and install the latest 64-Bit Java at:",
"GAME_32BIT_WARNING3": "https://www.java.com/en/download/"
}

View File

@@ -7,5 +7,8 @@
"MENU_MODULES" : "모듈",
"GAME_ACTION_MOVE_VERB" : "이동하기",
"GAME_ACTION_ZOOM" : "확대·축소",
"MENU_LABEL_RESET" : "재설정"
"MENU_LABEL_RESET" : "재설정",
"GAME_32BIT_WARNING1": "32비트 버전의 Java를 사용중인 것 같습니다.",
"GAME_32BIT_WARNING2": "아래 링크에서 최신 64비트 Java를 내려받아 설치해주세요.",
"GAME_32BIT_WARNING3": "https://www.java.com/ko/download/"
}

View File

@@ -591,7 +591,7 @@ public class App implements ApplicationListener {
setCameraPosition(0f, 0f);
int safetyTextLen = fontGame.getWidth(Lang.INSTANCE.get("APP_WARNING_HEALTH_AND_SAFETY"));
int safetyTextLen = fontGame.getWidth(Lang.INSTANCE.get("APP_WARNING_HEALTH_AND_SAFETY", true));
int logoPosX = (scr.getWidth() - logo.getRegionWidth() - safetyTextLen) >>> 1;
int logoPosY = Math.round(scr.getHeight() / 15f);
int textY = logoPosY + logo.getRegionHeight() - 16;
@@ -620,7 +620,7 @@ public class App implements ApplicationListener {
logoBatch.draw(logo, logoPosX, logoPosY);
logoBatch.setColor(new Color(0x282828ff));
fontGame.draw(logoBatch, Lang.INSTANCE.get("APP_WARNING_HEALTH_AND_SAFETY"),
fontGame.draw(logoBatch, Lang.INSTANCE.get("APP_WARNING_HEALTH_AND_SAFETY", true),
logoPosX + logo.getRegionWidth(),
textY
);
@@ -628,7 +628,7 @@ public class App implements ApplicationListener {
// some chinese stuff
if (GAME_LOCALE.contentEquals("zhCN")) {
for (int i = 1; i <= 4; i++) {
String s = Lang.INSTANCE.get("APP_CHINESE_HEALTHY_GAME_MSG_" + i);
String s = Lang.INSTANCE.get("APP_CHINESE_HEALTHY_GAME_MSG_" + i, true);
fontGame.draw(logoBatch, s,
(scr.getWidth() - fontGame.getWidth(s)) >>> 1,

View File

@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.jme3.math.FastMath
import net.torvald.random.HQRNG
@@ -20,13 +21,16 @@ import net.torvald.terrarum.gameactors.ai.ActorAI
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.gameworld.WorldTime
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.IngameRenderer
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.ui.UIRemoCon
import net.torvald.terrarum.modulebasegame.ui.UITitleRemoConYaml
import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.serialise.ReadWorld
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextButton
import net.torvald.terrarum.weather.WeatherMixer
import net.torvald.terrarum.worlddrawer.WorldCamera
import java.io.IOException
@@ -113,11 +117,17 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
val uiContainer = UIContainer()
internal lateinit var uiRemoCon: UICanvas
internal lateinit var uiRemoCon: UIRemoCon
internal lateinit var uiFakeBlurOverlay: UICanvas
private lateinit var worldFBO: FrameBuffer
private val warning32bitJavaIcon = TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/32_bit_warning.tga")))
init {
warning32bitJavaIcon.flip(false, true)
}
private fun loadThingsWhileIntroIsVisible() {
printdbg(this, "Intro pre-load")
@@ -322,6 +332,21 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
App.fontGame.draw(batch, PostProcessor.thisIsDebugStr, 5f, App.scr.height - 24f)
batch.color = Color.WHITE
if (App.is32BitJVM && uiRemoCon.currentRemoConContents.parent == null) {
val linegap = 4
val imgTxtGap = 10
val yoff = App.scr.height - App.scr.tvSafeGraphicsHeight - 64 - (3*(20+linegap)) - imgTxtGap - 9
Toolkit.drawCentered(batch, warning32bitJavaIcon, yoff)
for (i in 0..2) {
val text = Lang.get("GAME_32BIT_WARNING${i+1}", (i != 2))
if (i == 2) batch.color = UIItemTextButton.defaultHighlightCol
App.fontGame.draw(batch, text, ((App.scr.width - App.fontGame.getWidth(text)) / 2).toFloat(), yoff + imgTxtGap + 64f + linegap + i*(20+linegap))
}
}
}
override fun pause() {
@@ -356,6 +381,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
override fun dispose() {
uiRemoCon.dispose()
demoWorld.dispose()
warning32bitJavaIcon.texture.dispose()
}

View File

@@ -120,19 +120,21 @@ object Lang {
}
operator fun get(key: String): String {
return get(key, App.GAME_LOCALE) ?: get(key, FALLBACK_LANG_CODE) ?: "$$key"
operator fun get(key: String, capitalise: Boolean = true): String {
return getByLocale(key, App.GAME_LOCALE, capitalise) ?: getByLocale(key, FALLBACK_LANG_CODE, capitalise) ?: "$$key"
}
fun get(key: String, locale: String): String? {
fun getByLocale(key: String, locale: String, capitalise: Boolean): String? {
val ret = langpack["${key}_$locale"] ?: return null
fun String.CAP() = if (capitalise) this.capitalize() else this
return if (locale.startsWith("bg"))
"${App.fontGame.charsetOverrideBulgarian}${ret.capitalize()}${App.fontGame.charsetOverrideDefault}"
"${App.fontGame.charsetOverrideBulgarian}${ret.CAP()}${App.fontGame.charsetOverrideDefault}"
else if (locale.startsWith("sr"))
"${App.fontGame.charsetOverrideSerbian}${ret.capitalize()}${App.fontGame.charsetOverrideDefault}"
"${App.fontGame.charsetOverrideSerbian}${ret.CAP()}${App.fontGame.charsetOverrideDefault}"
else
ret.capitalize()
ret.CAP()
}
private fun String.getEndTag() = this.split("_").last()

View File

@@ -24,7 +24,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
override var openCloseTime = 0f
private var remoConTray: UIRemoConElement // this remocon is dynamically generated
private var currentRemoConContents = treeRepresentation
var currentRemoConContents = treeRepresentation; private set
private var currentlySelectedRemoConItem = treeRepresentation.data
override var width: Int

View File

@@ -31,7 +31,7 @@ class UITitleLanguage : UICanvas() {
private val textArea1 = UIItemTextButtonList(this,
textButtonLineHeight,
localeFirstHalf.map { Lang.get("MENU_LANGUAGE_THIS", it) ?: "!ERR: $it" }.toTypedArray(),
localeFirstHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(),
(App.scr.width - width) / 2, (App.scr.height - height) / 2,
width / 2, height,
textAreaWidth = width / 2,
@@ -44,7 +44,7 @@ class UITitleLanguage : UICanvas() {
)
private val textArea2 = UIItemTextButtonList(this,
textButtonLineHeight,
localeSecondHalf.map { Lang.get("MENU_LANGUAGE_THIS", it) ?: "!ERR: $it" }.toTypedArray(),
localeSecondHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(),
(App.scr.width - width) / 2 + (width / 2), (App.scr.height - height) / 2,
width / 2, height,
textAreaWidth = width / 2,

View File

@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.utils.Disposable
import net.torvald.terrarum.App
import net.torvald.terrarum.CommonResourcePool
@@ -42,8 +43,12 @@ object Toolkit : Disposable {
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
val imageW = image.width
val targetW = if (ui == null) App.scr.width else ui.width
val targetW = ui?.width ?: App.scr.width
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
}
fun drawCentered(batch: SpriteBatch, image: TextureRegion, screenPosY: Int, ui: UICanvas? = null) {
val imageW = image.regionWidth
val targetW = ui?.width ?: App.scr.width
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
}
@@ -51,6 +56,10 @@ object Toolkit : Disposable {
val imageW = image.width
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat() + offsetX, screenPosY.toFloat() + offsetY)
}
fun drawCentered(batch: SpriteBatch, image: TextureRegion, screenPosY: Int, targetW: Int, offsetX: Int = 0, offsetY: Int = 0) {
val imageW = image.regionWidth
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat() + offsetX, screenPosY.toFloat() + offsetY)
}
fun fillArea(batch: SpriteBatch, x: Int, y: Int, w: Int, h: Int) {
batch.fillRect(x.toFloat(), y.toFloat(), w.toFloat(), h.toFloat())