savegame to save with the thumbnail

This commit is contained in:
minjaesong
2021-09-08 20:36:49 +09:00
parent 966e7ce26f
commit fc40ec48f1
6 changed files with 93 additions and 67 deletions

View File

@@ -1,5 +1,8 @@
package net.torvald.terrarum.console
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Pixmap
import net.torvald.gdx.graphics.PixmapIO2
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.ccG
import net.torvald.terrarum.modulebasegame.IngameRenderer
@@ -8,7 +11,13 @@ object ScreencapNogui: ConsoleCommand {
override fun execute(args: Array<String>) {
if (args.size == 2) {
IngameRenderer.fboRGBexportPath = AppLoader.defaultDir + "/Exports/${args[1]}.tga"
IngameRenderer.fboRGBexportCallback = {
val w = 960
val h = 640
val p = Pixmap.createFromFrameBuffer((it.width - w).ushr(1), (it.height - h).ushr(1), w, h)
PixmapIO2.writeTGA(Gdx.files.absolute(AppLoader.defaultDir + "/Exports/${args[1]}.tga"), p, true)
p.dispose()
}
IngameRenderer.fboRGBexportRequested = true
Echo("FBO exported to$ccG Exports/${args[1]}.tga")
}