mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
screenshots will take unique name
This commit is contained in:
@@ -557,11 +557,14 @@ public class AppLoader implements ApplicationListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Pixmap p = ScreenUtils.getFrameBufferPixmap(0, 0, appConfig.width, appConfig.height);
|
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();
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
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) {
|
inline fun Lock.lock(body: () -> Unit) {
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
|||||||
// screenshot key
|
// screenshot key
|
||||||
if (keycode == Input.Keys.F12 && !f12Down) {
|
if (keycode == Input.Keys.F12 && !f12Down) {
|
||||||
AppLoader.requestScreenshot()
|
AppLoader.requestScreenshot()
|
||||||
terrarumIngame.sendNotification("Screenshot taken")
|
|
||||||
f12Down = true
|
f12Down = true
|
||||||
println("Screenshot taken.")
|
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. */
|
/** 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())
|
(notifier as Notification).sendNotification(messages.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendNotification(messages: List<String>) {
|
override fun sendNotification(messages: List<String>) {
|
||||||
(notifier as Notification).sendNotification(messages)
|
(notifier as Notification).sendNotification(messages)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendNotification(singleMessage: String) = sendNotification(listOf(singleMessage))
|
override fun sendNotification(singleMessage: String) = sendNotification(listOf(singleMessage))
|
||||||
|
|
||||||
fun wakeDormantActors() {
|
fun wakeDormantActors() {
|
||||||
var actorContainerSize = actorContainerInactive.size
|
var actorContainerSize = actorContainerInactive.size
|
||||||
|
|||||||
Reference in New Issue
Block a user