mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 13:51:53 +09:00
improved system info ui
This commit is contained in:
@@ -318,6 +318,9 @@ public class App implements ApplicationListener {
|
||||
|
||||
public static InputStrober inputStrober;
|
||||
|
||||
public static long bogoflops = 0L;
|
||||
private static double bogoflopf = Math.random();
|
||||
|
||||
public static Screen getCurrentScreen() {
|
||||
return currentScreen;
|
||||
}
|
||||
@@ -328,6 +331,17 @@ public class App implements ApplicationListener {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
long st = System.nanoTime();
|
||||
long sc = st;
|
||||
while (sc - st < 100000000L) {
|
||||
bogoflopf = Math.random() * bogoflopf;
|
||||
bogoflops++;
|
||||
sc = System.nanoTime();
|
||||
}
|
||||
bogoflops = Math.round((double)(bogoflops) * (1000000000.0 / (sc - st)));
|
||||
System.out.println(sc - st);
|
||||
System.out.println(bogoflops);
|
||||
|
||||
// if -ea flag is set, turn on all the debug prints
|
||||
try {
|
||||
assert false;
|
||||
|
||||
@@ -233,11 +233,13 @@ Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
private val glinfo = Gdx.graphics.glVersion.debugVersionString
|
||||
|
||||
val systeminfo: List<String>; get() = """
|
||||
${App.GAME_NAME} Version: ${App.getVERSION_STRING()}
|
||||
JRE Version: $javaVersion
|
||||
Gdx Version: ${com.badlogic.gdx.Version.VERSION}
|
||||
Operation System: $osName $osVersion
|
||||
Architecture: $sysArch
|
||||
Processor: $processor ($processorVendor)
|
||||
GL Info: $glinfo
|
||||
GL $glinfo
|
||||
""".split('\n')
|
||||
|
||||
|
||||
|
||||
@@ -126,8 +126,10 @@ emph {
|
||||
printStream.println("<ul>")
|
||||
printStream.println("<li>Game name: ${TerrarumAppConfiguration.GAME_NAME}</li>")
|
||||
printStream.println("<li>Engine version: ${App.getVERSION_STRING()}</li>")
|
||||
printStream.println("<li>Java version: ${System.getProperty("java.version")}</li>")
|
||||
printStream.println("<li>JRE version: ${System.getProperty("java.version")}</li>")
|
||||
printStream.println("<li>Gdx version: ${com.badlogic.gdx.Version.VERSION}</li>")
|
||||
printStream.println("<li>Uptime: ${uptime / 3600}h${(uptime % 3600) / 60}m${uptime % 60}s</li>")
|
||||
printStream.println("<li>BogoFlops: ${App.bogoflops}</li>")
|
||||
printStream.println("<li>OS Name: ${App.OSName}</li>")
|
||||
printStream.println("<li>OS Version: ${App.OSVersion}</li>")
|
||||
printStream.println("<li>System architecture: ${App.systemArch}</li>")
|
||||
|
||||
@@ -12,7 +12,8 @@ internal object Version : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
Echo("${App.GAME_NAME} ${App.getVERSION_STRING()}")
|
||||
Echo("Java version: ${System.getProperty("java.version")}")
|
||||
Echo("JRE Version: ${System.getProperty("java.version")}")
|
||||
Echo("Gdx Version: ${com.badlogic.gdx.Version.VERSION}")
|
||||
Echo("Polyglot language pack version: ${Lang.POLYGLOT_VERSION}")
|
||||
Echo("GL version: ${Terrarum.GL_VERSION}")
|
||||
Echo("Renderer: ${Gdx.graphics.glVersion.rendererString}, ${Gdx.graphics.glVersion.vendorString}")
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CreditSingleton
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.ui.Toolkit
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemTextArea
|
||||
import java.util.TreeMap
|
||||
|
||||
open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
|
||||
@@ -45,4 +46,71 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
|
||||
class UITitleCredits(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.credit)
|
||||
class UITitleGPL3(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.gpl3)
|
||||
class UISystemInfo(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.systeminfo)
|
||||
//class UISystemInfo(val remoCon: UIRemoCon) : UITitleWallOfText(CreditSingleton.systeminfo)
|
||||
|
||||
class UISystemInfo(val remoCon: UIRemoCon) : UICanvas() {
|
||||
override var width = Toolkit.drawWidth
|
||||
override var height = App.scr.height - 4 * App.scr.tvSafeGraphicsHeight
|
||||
|
||||
private val v = ArrayList<Pair<String, String>>()
|
||||
private val vlen = HashMap<String, Int>()
|
||||
|
||||
private val tb1w: Int
|
||||
private val tb2w: Int
|
||||
private val tb1x: Int
|
||||
private val tb2x: Int
|
||||
private val tby = (App.scr.height - height) / 2
|
||||
private val gap = 10
|
||||
|
||||
private var uptime: Long = 0L
|
||||
|
||||
init {
|
||||
v.add("${App.GAME_NAME}" to App.getVERSION_STRING())
|
||||
v.add("JRE" to System.getProperty("java.version"))
|
||||
v.add("Gdx" to com.badlogic.gdx.Version.VERSION)
|
||||
v.add("OS" to "${App.OSName} ${App.OSVersion}")
|
||||
v.add("Processor" to App.processor)
|
||||
v.add("Architecture" to App.systemArch)
|
||||
v.add("CPUID" to App.processorVendor.let { if (it == "null") "n/a" else it })
|
||||
v.add("OpenGL" to "${Gdx.graphics.glVersion.majorVersion}.${Gdx.graphics.glVersion.minorVersion}.${Gdx.graphics.glVersion.releaseVersion}")
|
||||
v.add("GL Vendor" to Gdx.graphics.glVersion.vendorString)
|
||||
v.add("GL Renderer" to Gdx.graphics.glVersion.rendererString)
|
||||
v.add("BogoFlops" to "${App.bogoflops}")
|
||||
v.add("Uptime" to "00h00m00s")
|
||||
|
||||
v.forEach { (k, v) ->
|
||||
vlen[k] = App.fontGame.getWidth(k)
|
||||
vlen[v] = App.fontGame.getWidth(v)
|
||||
}
|
||||
|
||||
tb1w = v.map { it.first }.maxOf { vlen[it]!! }
|
||||
tb2w = v.map { it.second }.maxOf { vlen[it]!! }
|
||||
|
||||
tb1x = (width - tb1w - tb2w - gap) / 2
|
||||
tb2x = tb1x + tb1w + gap
|
||||
}
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
uptime = App.getTIME_T() - App.startupTime
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||
var i = 0
|
||||
|
||||
v.forEach { (k, v0) ->
|
||||
val y = tby + 24 * i
|
||||
val v = if (k == "Uptime") "${uptime / 3600}h${(uptime % 3600) / 60}m${uptime % 60}s" else v0
|
||||
|
||||
batch.color = Toolkit.Theme.COL_LIST_DEFAULT
|
||||
App.fontGame.draw(batch, k, tb1x + tb1w - vlen[k]!!, y)
|
||||
batch.color = Toolkit.Theme.COL_MOUSE_UP
|
||||
App.fontGame.draw(batch, v, tb2x, y)
|
||||
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user