mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
load game ui to show human-readable timestamp
This commit is contained in:
@@ -185,7 +185,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
|
|
||||||
// fake UI for blur
|
// fake UI for blur
|
||||||
uiFakeBlurOverlay = UIFakeBlurOverlay(2f, false)
|
uiFakeBlurOverlay = UIFakeBlurOverlay(1f, false)
|
||||||
uiFakeBlurOverlay.setPosition(0,0)
|
uiFakeBlurOverlay.setPosition(0,0)
|
||||||
uiContainer.add(uiFakeBlurOverlay)
|
uiContainer.add(uiFakeBlurOverlay)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ internal object CommandInterpreter {
|
|||||||
"screenshot",
|
"screenshot",
|
||||||
"resize",
|
"resize",
|
||||||
"echo",
|
"echo",
|
||||||
"error"
|
"error",
|
||||||
|
"seed"
|
||||||
)
|
)
|
||||||
|
|
||||||
internal fun execute(command: String) {
|
internal fun execute(command: String) {
|
||||||
|
|||||||
@@ -9,16 +9,20 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
|
|||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.App.printdbg
|
import net.torvald.terrarum.App.printdbg
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.tvda.ByteArray64InputStream
|
|
||||||
import net.torvald.terrarum.tvda.VDUtil
|
|
||||||
import net.torvald.terrarum.tvda.VirtualDisk
|
|
||||||
import net.torvald.terrarum.serialise.Common
|
import net.torvald.terrarum.serialise.Common
|
||||||
import net.torvald.terrarum.serialise.LoadSavegame
|
import net.torvald.terrarum.serialise.LoadSavegame
|
||||||
import net.torvald.terrarum.serialise.ReadMeta
|
import net.torvald.terrarum.serialise.ReadMeta
|
||||||
|
import net.torvald.terrarum.tvda.ByteArray64InputStream
|
||||||
|
import net.torvald.terrarum.tvda.VDUtil
|
||||||
|
import net.torvald.terrarum.tvda.VirtualDisk
|
||||||
import net.torvald.terrarum.ui.Toolkit
|
import net.torvald.terrarum.ui.Toolkit
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.ui.UIItem
|
import net.torvald.terrarum.ui.UIItem
|
||||||
|
import net.torvald.terrarum.ui.UIItemTextButton
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.time.Instant
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
import java.util.*
|
||||||
import java.util.zip.GZIPInputStream
|
import java.util.zip.GZIPInputStream
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,6 +104,10 @@ class UIItemDemoSaveCells(
|
|||||||
private val x = initialX.toFloat()
|
private val x = initialX.toFloat()
|
||||||
private val y = initialY.toFloat()
|
private val y = initialY.toFloat()
|
||||||
|
|
||||||
|
private val lastPlayedTimestamp = Instant.ofEpochSecond(meta.lastplay_t)
|
||||||
|
.atZone(TimeZone.getDefault().toZoneId())
|
||||||
|
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
|
||||||
|
|
||||||
init {
|
init {
|
||||||
try {
|
try {
|
||||||
// load a thumbnail
|
// load a thumbnail
|
||||||
@@ -125,22 +133,32 @@ class UIItemDemoSaveCells(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
batch.color = Color.WHITE
|
val highlightCol = if (mouseUp) UIItemTextButton.defaultActiveCol else Color.WHITE
|
||||||
|
|
||||||
|
|
||||||
|
// TODO draw border
|
||||||
|
batch.color = highlightCol
|
||||||
|
Toolkit.drawBoxBorder(batch, x.toInt()-1, y.toInt()-1, width+1, height+1)
|
||||||
|
|
||||||
// draw thumbnail
|
// draw thumbnail
|
||||||
|
batch.color = Color.WHITE
|
||||||
blendNormal(batch)
|
blendNormal(batch)
|
||||||
batch.draw(thumb, x, y + height, width.toFloat(), -height.toFloat())
|
batch.draw(thumb, x, y + height, width.toFloat(), -height.toFloat())
|
||||||
// draw gradient
|
// draw gradient
|
||||||
blendMul(batch)
|
blendMul(batch)
|
||||||
batch.draw(grad, x + width, y, -width.toFloat(), height.toFloat())
|
batch.draw(grad, x + width, y, -width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
|
// draw texts
|
||||||
|
batch.color = highlightCol
|
||||||
|
|
||||||
// draw timestamp
|
// draw timestamp
|
||||||
blendNormal(batch)
|
blendNormal(batch)
|
||||||
val timestamp = "${meta.lastplay_t}"
|
val tlen = App.fontSmallNumbers.getWidth(lastPlayedTimestamp)
|
||||||
val tlen = App.fontGame.getWidth(timestamp)
|
App.fontSmallNumbers.draw(batch, lastPlayedTimestamp, posX + (width - tlen) - 3f, posY + height - 16f)
|
||||||
App.fontGame.draw(batch, timestamp, posX + (width - tlen) - 5f, posY + height - 23f)
|
|
||||||
|
|
||||||
|
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
batch.color = Color.WHITE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ object LightmapRenderer {
|
|||||||
|
|
||||||
const val overscan_open: Int = 40
|
const val overscan_open: Int = 40
|
||||||
const val overscan_opaque: Int = 10
|
const val overscan_opaque: Int = 10
|
||||||
const val LIGHTMAP_OVERRENDER = 8
|
const val LIGHTMAP_OVERRENDER = 40
|
||||||
|
|
||||||
private var LIGHTMAP_WIDTH: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(App.scr.width).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
|
private var LIGHTMAP_WIDTH: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(App.scr.width).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
|
||||||
private var LIGHTMAP_HEIGHT: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(App.scr.height).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
|
private var LIGHTMAP_HEIGHT: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(App.scr.height).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
|
||||||
|
|||||||
Reference in New Issue
Block a user