font update; fallback titlescreen update

This commit is contained in:
minjaesong
2021-12-12 14:26:39 +09:00
parent 06a6d2774c
commit e5b4e76d39
9 changed files with 89 additions and 23 deletions

Binary file not shown.

View File

@@ -895,6 +895,11 @@ public class App implements ApplicationListener {
CommonResourcePool.INSTANCE.loadAll();
// check if selected IME is accessible; if not, set selected IME to none
String selectedIME = getConfigString("inputmethod");
if (!selectedIME.equals("none") && !IME.INSTANCE.getAllHighLayers().contains(selectedIME)) {
setConfig("inputmethod", "none");
}
if (ModMgr.INSTANCE.getModuleInfo().isEmpty()) {
@@ -910,21 +915,21 @@ public class App implements ApplicationListener {
// test print
System.out.println("[App] Test printing every registered item");
Terrarum.INSTANCE.getItemCodex().getItemCodex().values().stream().map(GameItem::getOriginalID).forEach((String s) -> System.out.print(s+" "));
Terrarum.INSTANCE.getItemCodex().getItemCodex().values().stream().map(GameItem::getOriginalID).forEach(
(String s) -> System.out.print(s + " "));
System.out.println();
// create tile atlas
printdbg(this, "Making terrain textures...");
tileMaker = new CreateTileAtlas();
tileMaker.invoke(false);
// check if selected IME is accessible; if not, set selected IME to none
String selectedIME = getConfigString("inputmethod");
if (!selectedIME.equals("none") && !IME.INSTANCE.getAllHighLayers().contains(selectedIME)) {
setConfig("inputmethod", "none");
try {
// create tile atlas
printdbg(this, "Making terrain textures...");
tileMaker = new CreateTileAtlas();
tileMaker.invoke(false);
}
catch (NullPointerException e) {
throw new Error("TileMaker failed to load", e);
}
Terrarum.initialise();

View File

@@ -11,13 +11,39 @@ import net.torvald.terrarum.ui.Toolkit
*/
class NoModuleDefaultTitlescreen(batch: SpriteBatch) : IngameInstance(batch) {
private val wot = listOf(
"No Module is currently loaded.",
"Please review your Load Order on",
"assets/mods/LoadOrder.csv"
)
private val wot = """No Module is currently loaded.
Please reconfigure your Load Order on:
private val maxtw = wot.maxOf { App.fontGame.getWidth(it) }
Derzeit ist kein Modul geladen.
Bitte konfigurieren Sie Ihren Ladeauftrag neu auf:
Actualmente no hay ningún módulo cargado.
Vuelva a configurar su orden de carga en:
Moduulia ei ole ladattu tällä hetkellä.
Määritä lataustilauksesi uudelleen:
Aucun module nest actuellement chargé.
Veuillez reconfigurer votre ordre de chargement sur :
現在ロードされたモジュールがありません。
次のパスでロードオーダーを再設定してください。
현재 불러와진 모듈이 없습니다.
다음의 경로에서 불러오기 순서를 재설정하십시오.
В настоящее время модуль не загружен.
Измените конфигурацию вашего порядка загрузки на:
ไม่มีการโหลดโมดูลในขณะนี้
โปรดกำหนดค่าคำสั่งซื้อการโหลดของคุณใหม่เมื่อ:
当前未加载任何模块。请重新配置您的加载顺序:
當前未加載任何模塊。請重新配置您的加載順序:
\c\a assets/mods/LoadOrder.csv""".split('\n')
private val maxtw = wot.maxOf { App.fontGameFBO.getWidth(it) }
private val fbo = FrameBuffer(Pixmap.Format.RGBA8888, App.scr.width, App.scr.height, true)
@@ -27,21 +53,50 @@ class NoModuleDefaultTitlescreen(batch: SpriteBatch) : IngameInstance(batch) {
gdxClearAndSetBlend(0f, 0f, 0f, 0f)
if (!init) {
val lh = 36f
val lh = 20f
val pbreak = 8f
val th = lh * wot.size
val heights = FloatArray(wot.size)
// build y-pos map for strings
wot.tail().forEachIndexed { index, s ->
heights[index + 1] = heights[index] + (if (s.isBlank()) pbreak else lh)
}
// vertically centre the above
val centering = (App.scr.hf - heights.last() - App.fontGameFBO.lineHeight) / 2f
fbo.inAction(null, null) {
gdxClearAndSetBlend(.094f, .094f, .094f, 1f)
batch.inUse {
batch.color = Color.WHITE
wot.forEachIndexed { index, s ->
App.fontGame.draw(batch, s, (Toolkit.drawWidth - maxtw) / 2f, (App.scr.height - th) / 2f + lh * index)
if (s.startsWith('\\')) {
val tagsSplit = s.indexOfFirst { it == ' ' }
val tagsBulk = s.substring(0, tagsSplit)
val tags = tagsBulk.split('\\').filter { it.isNotBlank() }
val text = s.substring(tagsSplit + 1)
if (tags.contains("a")) batch.color = Toolkit.Theme.COL_HIGHLIGHT else batch.color = Color.WHITE
if (tags.contains("c"))
App.fontGameFBO.draw(batch, text, (Toolkit.drawWidth - App.fontGameFBO.getWidth(text)) / 2f, heights[index] + centering)
else
App.fontGameFBO.draw(batch, text, (Toolkit.drawWidth - maxtw) / 2f, heights[index] + centering)
}
else {
batch.color = Color.WHITE
App.fontGameFBO.draw(batch, s, (Toolkit.drawWidth - maxtw) / 2f, heights[index] + centering)
}
}
}
}
}
batch.inUse {
batch.color = Color.WHITE
batch.draw(fbo.colorBufferTexture, 0f, 0f)
}
}