mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
revised ingame date format
This commit is contained in:
@@ -609,19 +609,21 @@ public class App implements ApplicationListener {
|
|||||||
|
|
||||||
private static void processScreenshotRequest(FrameBuffer fb) {
|
private static void processScreenshotRequest(FrameBuffer fb) {
|
||||||
if (screenshotRequested) {
|
if (screenshotRequested) {
|
||||||
|
String msg = "Screenshot taken";
|
||||||
FrameBufferManager.begin(fb);
|
FrameBufferManager.begin(fb);
|
||||||
try {
|
try {
|
||||||
Pixmap p = Pixmap.createFromFrameBuffer(0, 0, fb.getWidth(), fb.getHeight());
|
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);
|
PixmapIO.writePNG(Gdx.files.absolute(defaultDir+"/Screenshot-"+String.valueOf(System.currentTimeMillis())+".png"), p, 9, true);
|
||||||
p.dispose();
|
p.dispose();
|
||||||
Terrarum.INSTANCE.getIngame().sendNotification("Screenshot taken");
|
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Terrarum.INSTANCE.getIngame().sendNotification("Failed to take screenshot: "+e.getMessage());
|
msg = ("Failed to take screenshot: "+e.getMessage());
|
||||||
}
|
}
|
||||||
FrameBufferManager.end();
|
FrameBufferManager.end();
|
||||||
screenshotRequested = false;
|
screenshotRequested = false;
|
||||||
|
|
||||||
|
Terrarum.INSTANCE.getIngame().sendNotification(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,14 +234,20 @@ class WorldTime(initTime: Long = 0L) {
|
|||||||
fun Long.toPositiveInt() = this.and(0x7FFFFFFF).toInt()
|
fun Long.toPositiveInt() = this.and(0x7FFFFFFF).toInt()
|
||||||
fun Long.abs() = Math.abs(this)
|
fun Long.abs() = Math.abs(this)
|
||||||
|
|
||||||
/** Format: "%A, %Y %B %d %X" */
|
/** Format: "ɣ%Y %B %d %A, %X" */
|
||||||
fun getFormattedTime() = "${getDayNameShort()}, " +
|
fun getFormattedTime() =
|
||||||
"$years " +
|
"ɣ$years " +
|
||||||
"${getMonthNameFull()} " +
|
"${getMonthNameFull()} " +
|
||||||
"$calendarDay " +
|
"$calendarDay " +
|
||||||
"${String.format("%02d", hours)}:" +
|
"${getDayNameFull()}, " +
|
||||||
"${String.format("%02d", minutes)}:" +
|
"${String.format("%02d", hours)}:" +
|
||||||
"${String.format("%02d", seconds)}"
|
"${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 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')}"
|
fun getFilenameTime() = "${years.toString().padStart(4, '0')}${calendarMonth.toString().padStart(2, '0')}${calendarDay.toString().padStart(2, '0')}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user