mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
screenshots will take unique name
This commit is contained in:
@@ -557,11 +557,14 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
try {
|
||||
Pixmap p = ScreenUtils.getFrameBufferPixmap(0, 0, appConfig.width, appConfig.height);
|
||||
PixmapIO2.writeTGA(Gdx.files.absolute(defaultDir + "/Screenshot.tga"), p, true);
|
||||
PixmapIO2.writeTGA(Gdx.files.absolute(defaultDir+"/Screenshot-"+String.valueOf(System.currentTimeMillis())+".tga"), p, true);
|
||||
p.dispose();
|
||||
|
||||
Terrarum.INSTANCE.getIngame().sendNotification("Screenshot taken");
|
||||
}
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
Terrarum.INSTANCE.getIngame().sendNotification("Failed to take screenshot: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -253,6 +253,10 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
|
||||
|
||||
|
||||
data class BlockChangeQueueItem(val old: Int, val new: Int, val posX: Int, val posY: Int)
|
||||
|
||||
open fun sendNotification(messages: Array<String>) {}
|
||||
open fun sendNotification(messages: List<String>) {}
|
||||
open fun sendNotification(singleMessage: String) {}
|
||||
}
|
||||
|
||||
inline fun Lock.lock(body: () -> Unit) {
|
||||
|
||||
@@ -117,7 +117,6 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
// screenshot key
|
||||
if (keycode == Input.Keys.F12 && !f12Down) {
|
||||
AppLoader.requestScreenshot()
|
||||
terrarumIngame.sendNotification("Screenshot taken")
|
||||
f12Down = true
|
||||
println("Screenshot taken.")
|
||||
}
|
||||
|
||||
@@ -660,15 +660,15 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
|
||||
/** Send message to notifier UI and toggle the UI as opened. */
|
||||
fun sendNotification(messages: Array<String>) {
|
||||
override fun sendNotification(messages: Array<String>) {
|
||||
(notifier as Notification).sendNotification(messages.toList())
|
||||
}
|
||||
|
||||
fun sendNotification(messages: List<String>) {
|
||||
override fun sendNotification(messages: List<String>) {
|
||||
(notifier as Notification).sendNotification(messages)
|
||||
}
|
||||
|
||||
fun sendNotification(singleMessage: String) = sendNotification(listOf(singleMessage))
|
||||
override fun sendNotification(singleMessage: String) = sendNotification(listOf(singleMessage))
|
||||
|
||||
fun wakeDormantActors() {
|
||||
var actorContainerSize = actorContainerInactive.size
|
||||
|
||||
Reference in New Issue
Block a user