This commit is contained in:
yairm210 2021-12-23 21:15:20 +02:00
parent 90df253783
commit eb4a76dcd0

View File

@ -39,9 +39,13 @@ class SaveGameScreen(val gameInfo: GameInfo) : PickerScreen(disableScroll = true
val copyJsonButton = "Copy to clipboard".toTextButton()
copyJsonButton.onClick {
val json = Json().toJson(gameInfo)
val base64Gzip = Gzip.zip(json)
Gdx.app.clipboard.contents = base64Gzip
try {
val json = Json().toJson(gameInfo)
val base64Gzip = Gzip.zip(json)
Gdx.app.clipboard.contents = base64Gzip
} catch (OOM: OutOfMemoryError) {
// you don't get a special toast, this isn't nearly common enough, this is a total edge-case
}
}
newSave.add(copyJsonButton).row()
if (GameSaver.canLoadFromCustomSaveLocation()) {