titlescreen moved to modules; using GLES 3.0 as default

This commit is contained in:
minjaesong
2021-12-11 21:08:56 +09:00
parent 56f5dc1686
commit 10819e2607
13 changed files with 135 additions and 80 deletions

View File

@@ -0,0 +1,54 @@
package net.torvald.terrarum
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import net.torvald.terrarum.ui.Toolkit
/**
* Created by minjaesong on 2021-12-11.
*/
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 maxtw = wot.maxOf { App.fontGame.getWidth(it) }
private val fbo = FrameBuffer(Pixmap.Format.RGBA8888, App.scr.width, App.scr.height, true)
private var init = false
override fun render(updateRate: Float) {
gdxClearAndSetBlend(0f, 0f, 0f, 0f)
if (!init) {
val lh = 36f
val th = lh * wot.size
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)
}
}
}
}
batch.inUse {
batch.draw(fbo.colorBufferTexture, 0f, 0f)
}
}
override fun dispose() {
super.dispose()
fbo.dispose()
}
}