summaryrefslogtreecommitdiff
path: root/core/src/com/ilotterytea/maxoning/ui
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/com/ilotterytea/maxoning/ui')
-rw-r--r--core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt33
-rw-r--r--core/src/com/ilotterytea/maxoning/ui/DebugLabel.java19
2 files changed, 33 insertions, 19 deletions
diff --git a/core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt b/core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt
new file mode 100644
index 0000000..38a2f2b
--- /dev/null
+++ b/core/src/com/ilotterytea/maxoning/ui/DebugInfo.kt
@@ -0,0 +1,33 @@
+package com.ilotterytea.maxoning.ui
+
+import com.badlogic.gdx.Gdx
+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.utils.I18N
+
+/**
+ * Debug information.
+ * @since a_1.0
+ * @author ilotterytea
+ */
+class DebugInfo(skin: Skin, locale: I18N) : Table() {
+ private val i18n = locale
+ private var fps: Label
+
+ init {
+ // Frames per second:
+ fps = Label(i18n.FormattedText("debug.fps", Gdx.graphics.framesPerSecond.toString()), skin, "debug")
+ this.add(fps).row()
+
+ this.align(Align.top)
+ this.height = 100f
+ this.width = 100f
+ }
+
+ override fun act(delta: Float) {
+ super.act(delta)
+ fps.setText(i18n.FormattedText("debug.fps", Gdx.graphics.framesPerSecond.toString()))
+ }
+} \ No newline at end of file
diff --git a/core/src/com/ilotterytea/maxoning/ui/DebugLabel.java b/core/src/com/ilotterytea/maxoning/ui/DebugLabel.java
deleted file mode 100644
index 5335450..0000000
--- a/core/src/com/ilotterytea/maxoning/ui/DebugLabel.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.ilotterytea.maxoning.ui;
-
-import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.graphics.Color;
-import com.badlogic.gdx.scenes.scene2d.ui.Label;
-import com.badlogic.gdx.scenes.scene2d.ui.Skin;
-
-public class DebugLabel extends Label {
- private static final String str_placeholder = "%s fps";
-
- public DebugLabel(Skin skin) {
- super(String.format(str_placeholder, Gdx.graphics.getFramesPerSecond()), skin, "debug");
- super.setColor(Color.LIME);
- }
-
- @Override public void act(float delta) {
- super.setText(String.format(str_placeholder, Gdx.graphics.getFramesPerSecond()));
- }
-}