summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2022-12-10 16:33:52 +0600
committerilotterytea <iltsu@alright.party>2022-12-10 16:33:52 +0600
commit6fdaa92288b5854d946299a2624de9ead7058d71 (patch)
tree3e232366adf67fef8ca7df2b8d0204cae67c71af
parent9b95791e8e6739040a02c6725edf1adaf287ca64 (diff)
Added information about memory usage. Also, added localization for debug info widget.
-rw-r--r--assets/i18n/en_us.json5
-rw-r--r--assets/i18n/ru_ru.json5
-rw-r--r--core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt37
3 files changed, 38 insertions, 9 deletions
diff --git a/assets/i18n/en_us.json b/assets/i18n/en_us.json
index 3454aaf..b026d68 100644
--- a/assets/i18n/en_us.json
+++ b/assets/i18n/en_us.json
@@ -1,5 +1,8 @@
{
- "debug.fps": "%s FPS",
+ "debug.version": "%s (LibGDX %s, Java %s)",
+ "debug.c_fps": "%s FPS",
+ "debug.c_mem": "Used memory: %s MB (total of %s MB)",
+
"splash.disclaimer": "This game contains an unbelievable dose of cheeky \"woolbags\". Please, it is not recommended for anyone to play. Any match in real life of the presented images of cats is pure coincidence! All cat images were generated by \"NUT-S\" neural network.",
"menu.last_savegame.found": "Savegame: %s - %s Squish Points (x%s/click) - %s purchased items.",
diff --git a/assets/i18n/ru_ru.json b/assets/i18n/ru_ru.json
index de7942f..dbd77b5 100644
--- a/assets/i18n/ru_ru.json
+++ b/assets/i18n/ru_ru.json
@@ -1,5 +1,8 @@
{
- "debug.fps": "%s FPS",
+ "debug.version": "%s (LibGDX %s, Java %s)",
+ "debug.c_fps": "%s FPS",
+ "debug.c_mem": "Потребление ОЗУ: %s МБ (из %s МБ)",
+
"splash.disclaimer": "Эта игра содержит невероятную дозу щекастых \"шерстяных мешков\". Никому не рекомендуется не играть в эту игру. Любое сходство в реальной жизни с представленными изображениями котов - чистое совпадение! Все изображения котов были сгенерированы нейросетью \"NUT-S\".",
"menu.last_savegame.found": "Сохранение: %s - %s баллы жмякания (х%s/клик) - %s куплено предметов.",
diff --git a/core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt b/core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt
index 38a2f2b..71e33cf 100644
--- a/core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt
+++ b/core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt
@@ -1,10 +1,12 @@
package com.ilotterytea.maxoning.ui
import com.badlogic.gdx.Gdx
+import com.badlogic.gdx.Version
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Skin
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.Align
+import com.ilotterytea.maxoning.MaxonConstants
import com.ilotterytea.maxoning.utils.I18N
/**
@@ -14,20 +16,41 @@ import com.ilotterytea.maxoning.utils.I18N
*/
class DebugInfo(skin: Skin, locale: I18N) : Table() {
private val i18n = locale
- private var fps: Label
+ private var c_fps: Label
+ private var c_mem: Label
init {
+ val rt = Runtime.getRuntime()
+ val usedmem = ((rt.totalMemory() - rt.freeMemory()) / 1024) / 1024
+ val totalmem = (rt.totalMemory() / 1024) / 1024
+
+ // Version info:
+ val ver = Label(i18n.FormattedText("debug.version", MaxonConstants.GAME_VERSION, Version.VERSION, System.getProperty("java.version")), skin, "debug")
+ ver.setAlignment(Align.left)
+ this.add(ver).fillX().row()
+
// Frames per second:
- fps = Label(i18n.FormattedText("debug.fps", Gdx.graphics.framesPerSecond.toString()), skin, "debug")
- this.add(fps).row()
+ c_fps = Label(i18n.FormattedText("debug.c_fps", Gdx.graphics.framesPerSecond.toString()), skin, "debug")
+ c_fps.setAlignment(Align.left)
+ this.add(c_fps).fillX().row()
- this.align(Align.top)
- this.height = 100f
- this.width = 100f
+ // Memory usage:
+ c_mem = Label(i18n.FormattedText("debug.c_mem", usedmem.toString(), totalmem.toString()), skin, "debug")
+ c_mem.setAlignment(Align.left)
+ this.add(c_mem).fillX().row()
+
+ this.align(Align.left)
+ this.skin = skin
+ this.background("tile_03")
}
override fun act(delta: Float) {
+ val rt = Runtime.getRuntime()
+ val usedmem = ((rt.totalMemory() - rt.freeMemory()) / 1024) / 1024
+ val totalmem = (rt.totalMemory() / 1024) / 1024
+
super.act(delta)
- fps.setText(i18n.FormattedText("debug.fps", Gdx.graphics.framesPerSecond.toString()))
+ c_fps.setText(i18n.FormattedText("debug.c_fps", Gdx.graphics.framesPerSecond.toString()))
+ c_mem.setText(i18n.FormattedText("debug.c_mem", usedmem.toString(), totalmem.toString()))
}
} \ No newline at end of file