revised ingame date format

This commit is contained in:
minjaesong
2023-08-08 09:01:34 +09:00
parent 87d92ecb74
commit 88831051c8
2 changed files with 18 additions and 10 deletions

View File

@@ -609,19 +609,21 @@ public class App implements ApplicationListener {
private static void processScreenshotRequest(FrameBuffer fb) {
if (screenshotRequested) {
String msg = "Screenshot taken";
FrameBufferManager.begin(fb);
try {
Pixmap p = Pixmap.createFromFrameBuffer(0, 0, fb.getWidth(), fb.getHeight());
PixmapIO.writePNG(Gdx.files.absolute(defaultDir+"/Screenshot-"+String.valueOf(System.currentTimeMillis())+".png"), p, 9, true);
p.dispose();
Terrarum.INSTANCE.getIngame().sendNotification("Screenshot taken");
}
catch (Throwable e) {
e.printStackTrace();
Terrarum.INSTANCE.getIngame().sendNotification("Failed to take screenshot: "+e.getMessage());
msg = ("Failed to take screenshot: "+e.getMessage());
}
FrameBufferManager.end();
screenshotRequested = false;
Terrarum.INSTANCE.getIngame().sendNotification(msg);
}
}

View File

@@ -234,14 +234,20 @@ class WorldTime(initTime: Long = 0L) {
fun Long.toPositiveInt() = this.and(0x7FFFFFFF).toInt()
fun Long.abs() = Math.abs(this)
/** Format: "%A, %Y %B %d %X" */
fun getFormattedTime() = "${getDayNameShort()}, " +
"$years " +
"${getMonthNameFull()} " +
"$calendarDay " +
"${String.format("%02d", hours)}:" +
"${String.format("%02d", minutes)}:" +
"${String.format("%02d", seconds)}"
/** Format: "ɣ%Y %B %d %A, %X" */
fun getFormattedTime() =
"ɣ$years " +
"${getMonthNameFull()} " +
"$calendarDay " +
"${getDayNameFull()}, " +
"${String.format("%02d", hours)}:" +
"${String.format("%02d", minutes)}:" +
"${String.format("%02d", seconds)}"
fun getFormattedCalendarDay() =
"ɣ$years " +
"${getMonthNameFull()} " +
"$calendarDay " +
"${getDayNameFull()}"
fun getShortTime() = "${years.toString().padStart(4, '0')}-${getMonthNameShort()}-${calendarDay.toString().padStart(2, '0')}"
fun getFilenameTime() = "${years.toString().padStart(4, '0')}${calendarMonth.toString().padStart(2, '0')}${calendarDay.toString().padStart(2, '0')}"