jvm heap usage bar on loading screen
This commit is contained in:
parent
e0c511af33
commit
19c3da7b8f
@ -815,7 +815,7 @@ class StarboundClient : Closeable {
|
||||
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
|
||||
|
||||
val min = viewportHeight.coerceAtMost(viewportWidth)
|
||||
val size = min * 0.01f
|
||||
val size = min * 0.02f
|
||||
|
||||
val program = programs.positionColor
|
||||
val builder = program.builder
|
||||
@ -846,25 +846,31 @@ class StarboundClient : Closeable {
|
||||
val b = if (dotsIndex == 1) RGBAColor.SLATE_GRAY else RGBAColor.WHITE
|
||||
val c = if (dotsIndex == 2) RGBAColor.SLATE_GRAY else RGBAColor.WHITE
|
||||
|
||||
builder.builder.vertex(viewportWidth * 0.5f - size - size * 4f, viewportHeight * 0.5f - size).color(a)
|
||||
builder.builder.vertex(viewportWidth * 0.5f + size - size * 4f, viewportHeight * 0.5f - size).color(a)
|
||||
builder.builder.vertex(viewportWidth * 0.5f + size - size * 4f, viewportHeight * 0.5f + size).color(a)
|
||||
builder.builder.vertex(viewportWidth * 0.5f - size - size * 4f, viewportHeight * 0.5f + size).color(a)
|
||||
builder.builder.centeredQuad(viewportWidth * 0.5f, viewportHeight * 0.5f, size, size) { color(b) }
|
||||
builder.builder.centeredQuad(viewportWidth * 0.5f - size * 2f, viewportHeight * 0.5f, size, size) { color(a) }
|
||||
builder.builder.centeredQuad(viewportWidth * 0.5f + size * 2f, viewportHeight * 0.5f, size, size) { color(c) }
|
||||
|
||||
builder.builder.vertex(viewportWidth * 0.5f - size, viewportHeight * 0.5f - size).color(b)
|
||||
builder.builder.vertex(viewportWidth * 0.5f + size, viewportHeight * 0.5f - size).color(b)
|
||||
builder.builder.vertex(viewportWidth * 0.5f + size, viewportHeight * 0.5f + size).color(b)
|
||||
builder.builder.vertex(viewportWidth * 0.5f - size, viewportHeight * 0.5f + size).color(b)
|
||||
builder.builder.quad(0f, viewportHeight - 20f, viewportWidth * Starbound.loadingProgress.toFloat(), viewportHeight.toFloat()) { color(RGBAColor.GREEN) }
|
||||
|
||||
builder.builder.vertex(viewportWidth * 0.5f - size + size * 4f, viewportHeight * 0.5f - size).color(c)
|
||||
builder.builder.vertex(viewportWidth * 0.5f + size + size * 4f, viewportHeight * 0.5f - size).color(c)
|
||||
builder.builder.vertex(viewportWidth * 0.5f + size + size * 4f, viewportHeight * 0.5f + size).color(c)
|
||||
builder.builder.vertex(viewportWidth * 0.5f - size + size * 4f, viewportHeight * 0.5f + size).color(c)
|
||||
val runtime = Runtime.getRuntime()
|
||||
|
||||
builder.builder.vertex(0f, viewportHeight - 20f).color(RGBAColor.GREEN)
|
||||
builder.builder.vertex(viewportWidth * Starbound.loadingProgress.toFloat(), viewportHeight - 20f).color(RGBAColor.GREEN)
|
||||
builder.builder.vertex(viewportWidth * Starbound.loadingProgress.toFloat(), viewportHeight.toFloat()).color(RGBAColor.GREEN)
|
||||
builder.builder.vertex(0f, viewportHeight.toFloat()).color(RGBAColor.GREEN)
|
||||
//if (runtime.maxMemory() <= 4L * 1024L * 1024L * 1024L) {
|
||||
builder.builder.centeredQuad(viewportWidth * 0.5f, viewportHeight * 0.1f, viewportWidth * 0.7f, 2f) { color(RGBAColor.WHITE) }
|
||||
builder.builder.centeredQuad(viewportWidth * 0.5f, viewportHeight * 0.1f + 20f, viewportWidth * 0.7f, 2f) { color(RGBAColor.WHITE) }
|
||||
builder.builder.centeredQuad(viewportWidth * (0.5f - 0.35f), viewportHeight * 0.1f + 10f, 2f, 20f) { color(RGBAColor.WHITE) }
|
||||
builder.builder.centeredQuad(viewportWidth * (0.5f + 0.35f), viewportHeight * 0.1f + 10f, 2f, 20f) { color(RGBAColor.WHITE) }
|
||||
|
||||
builder.builder.centeredQuad(viewportWidth * (0.5f - 0.35f + 0.7f * (runtime.totalMemory().toDouble() / runtime.maxMemory().toDouble()).toFloat()), viewportHeight * 0.1f + 10f, 2f, 18f) { color(RGBAColor.RED) }
|
||||
|
||||
val leftEdge = viewportWidth * (0.5f - 0.35f) + 1f
|
||||
|
||||
builder.builder.quad(
|
||||
leftEdge,
|
||||
viewportHeight * 0.1f + 1f,
|
||||
leftEdge + viewportWidth * 0.7f * ((runtime.totalMemory() - runtime.freeMemory()) / runtime.maxMemory().toDouble()).toFloat(),
|
||||
viewportHeight * 0.1f + 19f
|
||||
) { color(RGBAColor(29, 140, 160)) }
|
||||
//}
|
||||
|
||||
if (fontInitialized) {
|
||||
drawPerformanceBasic(true)
|
||||
|
@ -280,6 +280,22 @@ class VertexBuilder(
|
||||
return this
|
||||
}
|
||||
|
||||
inline fun quad(x0: Float, y0: Float, x1: Float, y1: Float, configurator: VertexBuilder.() -> Unit = {}): VertexBuilder {
|
||||
vertex(x0, y0).also(configurator)
|
||||
vertex(x1, y0).also(configurator)
|
||||
vertex(x1, y1).also(configurator)
|
||||
vertex(x0, y1).also(configurator)
|
||||
return this
|
||||
}
|
||||
|
||||
inline fun centeredQuad(x: Float, y: Float, width: Float, height: Float, configurator: VertexBuilder.() -> Unit = {}): VertexBuilder {
|
||||
vertex(x - width * 0.5f, y - height * 0.5f).also(configurator)
|
||||
vertex(x + width * 0.5f, y - height * 0.5f).also(configurator)
|
||||
vertex(x + width * 0.5f, y + height * 0.5f).also(configurator)
|
||||
vertex(x - width * 0.5f, y + height * 0.5f).also(configurator)
|
||||
return this
|
||||
}
|
||||
|
||||
fun vertex(value: IStruct2f): VertexBuilder {
|
||||
vertex()
|
||||
position(value.component1(), value.component2())
|
||||
|
Loading…
Reference in New Issue
Block a user