bringing back old animating titlescreen

This commit is contained in:
minjaesong
2021-09-08 16:22:25 +09:00
parent 7c38e9a7fd
commit b8e181915e
16 changed files with 157 additions and 108 deletions

View File

@@ -330,6 +330,21 @@ object IngameRenderer : Disposable {
blendNormal(batch)
///////////////////////////////////////////////////////////////////////
if (fboRGBexportRequested) {
fboRGBexportRequested = false
try {
val w = 960
val h = 640
val p = Pixmap.createFromFrameBuffer((fboRGB.width - w).ushr(1), (fboRGB.height - h).ushr(1), w, h)
PixmapIO2.writeTGA(Gdx.files.absolute(fboRGBexportPath), p, true)
p.dispose()
}
catch (e: Throwable) {
e.printStackTrace()
}
}
///////////////////////////////////////////////////////////////////////
@@ -368,6 +383,7 @@ object IngameRenderer : Disposable {
}
internal var fboRGBexportRequested = false
internal var fboRGBexportPath = ""
private fun drawToRGB(
actorsRenderBehind: List<ActorWithBody>?,
@@ -418,25 +434,6 @@ object IngameRenderer : Disposable {
}
}
if (fboRGBexportRequested) {
fboRGBexportRequested = false
val fileChooser = JFileChooser()
fileChooser.showSaveDialog(null)
try {
if (fileChooser.selectedFile != null) {
fboRGB.inAction(null, null) {
val p = ScreenUtils.getFrameBufferPixmap(0, 0, fboRGB.width, fboRGB.height)
PixmapIO2.writeTGA(Gdx.files.absolute(fileChooser.selectedFile.absolutePath), p, false)
p.dispose()
}
}
}
catch (e: Throwable) {
e.printStackTrace()
}
}
fboRGB_lightMixed.inAction(camera, batch) {
setCameraPosition(0f, 0f)

View File

@@ -10,8 +10,6 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
*/
internal object SetTimeDelta : ConsoleCommand {
val HARD_LIMIT = 60
override fun execute(args: Array<String>) {
val world = (Terrarum.ingame!! as TerrarumIngame).world

View File

@@ -45,12 +45,12 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
// TODO scrolling of the palette, as the old method flat out won't work with The Flattening
private val tabs = UIItemTextButtonList(
this, arrayOf("Terrain", "Wall", "Wire"),
this, 36, arrayOf("Terrain", "Wall", "Wire"),
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
defaultSelection = 0
)
private val closeButton = UIItemTextButtonList(
this, arrayOf("Close"),
this, 36, arrayOf("Close"),
0, this.height - UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
width = MENUBAR_SIZE, textAreaWidth = MENUBAR_SIZE
)

View File

@@ -23,7 +23,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
private val gameMenuListHeight = DEFAULT_LINE_HEIGHT * gameMenu.size
private val gameMenuListWidth = 400
private val gameMenuButtons = UIItemTextButtonList(
this, gameMenu,
this, DEFAULT_LINE_HEIGHT, gameMenu,
(AppLoader.screenSize.screenW - gameMenuListWidth) / 2,
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2,
gameMenuListWidth, gameMenuListHeight,

View File

@@ -38,12 +38,12 @@ class UIProxyNewRandomGame : UICanvas() {
val ingame = TerrarumIngame(AppLoader.batch)
val worldParam = TerrarumIngame.NewWorldParameters(2400, 1280, 0x51621DL)
//val worldParam = TerrarumIngame.NewWorldParameters(2400, 1280, HQRNG().nextLong())
// val worldParam = TerrarumIngame.NewWorldParameters(2400, 1280, 0x51621DL)
val worldParam = TerrarumIngame.NewWorldParameters(2400, 1280, HQRNG().nextLong())
//val worldParam = TerrarumIngame.NewWorldParameters(6000, 1800, 0x51621DL) // small
// val worldParam = TerrarumIngame.NewWorldParameters(9000, 2250, 0x51621DL) // normal
//val worldParam = TerrarumIngame.NewWorldParameters(13500, 3000, 0x51621DL) // large
//val worldParam = TerrarumIngame.NewWorldParDoubleameters(13500, 3000, 0x51621DL) // large
//val worldParam = TerrarumIngame.NewWorldParameters(22500, 4500, 0x51621DL) // huge
ingame.gameLoadInfoPayload = worldParam
ingame.gameLoadMode = TerrarumIngame.GameLoadMode.CREATE_NEW

View File

@@ -248,11 +248,14 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
class UIRemoConElement(uiRemoCon: UIRemoCon, val labels: Array<String>) {
private val lineHeight = 36
private val menubar = UIItemTextButtonList(
uiRemoCon,
lineHeight,
labels,
0, menubarOffY,
menubarOffX,
menubarOffY - lineHeight * labels.size + 16,
uiRemoCon.width, getRemoConHeight(labels),
textAreaWidth = uiRemoCon.width,
readFromLang = true,
@@ -261,7 +264,8 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
backgroundCol = Color(0),
inactiveCol = Color.WHITE,
defaultSelection = null,
itemHitboxSize = 34
itemHitboxSize = lineHeight - 2,
alignment = UIItemTextButton.Companion.Alignment.LEFT
)
fun update(delta: Float) {
@@ -288,9 +292,10 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
}
companion object {
val remoConWidth = 304
val remoConWidth = 300
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
val menubarOffY: Int; get() = AppLoader.screenSize.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
val menubarOffX: Int; get() = (0.11 * AppLoader.screenSize.screenW).toInt()
val menubarOffY: Int; get() = (0.82 * AppLoader.screenSize.screenH).toInt()
}
}

View File

@@ -25,6 +25,7 @@ class UITitleLanguage : UICanvas() {
private val localeList = Lang.languageList.toList().sorted()
private val textArea = UIItemTextButtonList(this,
24,
localeList.map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }.toTypedArray(),
AppLoader.screenSize.screenW - width, textAreaHMargin,
width, height,

View File

@@ -13,12 +13,9 @@ object UITitleRemoConYaml {
* The class must be the UICanvas
*/
val menus = """
- MENU_MODE_SINGLEPLAYER : net.torvald.terrarum.modulebasegame.ui.UITitleCharactersList
- CONTEXT_CHARACTER_NEW
- CONTEXT_CHARACTER_DELETE
- MENU_LABEL_RETURN
- MENU_MODE_MULTIPLAYER
- MENU_LABEL_RETURN
- MENU_LABEL_CONTINUE
- MENU_LABEL_NEW_GAME : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
- MENU_IO_LOAD
- MENU_OPTIONS
- MENU_OPTIONS_GRAPHICS
- MENU_OPTIONS_CONTROLS
@@ -38,12 +35,12 @@ object UITitleRemoConYaml {
- MENU_LABEL_QUIT
""".trimIndent()
val debugTools = """
val debugTools = "" /*"""
- Development Tools $
- Building Maker : net.torvald.terrarum.modulebasegame.ui.UIProxyNewBuildingMaker
- Start New Random Game : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
- MENU_LABEL_RETURN
""".trimIndent()
""".trimIndent()*/
operator fun invoke() = if (AppLoader.IS_DEVELOPMENT_BUILD)
Yaml(menus + "\n" + debugTools).parse()