mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
battery complication not using shaperenderer
This commit is contained in:
Binary file not shown.
BIN
lib/GetBatteryStatus.jar
LFS
BIN
lib/GetBatteryStatus.jar
LFS
Binary file not shown.
@@ -412,12 +412,17 @@ object TerrarumPostProcessor : Disposable {
|
|||||||
val watchStr = "$clockH:$clockM"
|
val watchStr = "$clockH:$clockM"
|
||||||
val batteryPercentageStr = "$batteryPercentage%"
|
val batteryPercentageStr = "$batteryPercentage%"
|
||||||
|
|
||||||
|
val percIndex = (batteryPercentage.toFloat() * 0.01 * 64).toInt() // 0-63
|
||||||
|
val btx = percIndex % 4
|
||||||
|
val bty = percIndex / 4
|
||||||
|
val btxoff = isCharging.toInt() * 4
|
||||||
|
|
||||||
batch.inUse {
|
batch.inUse {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
App.fontSmallNumbers.draw(batch, watchStr, wx, wy)
|
App.fontSmallNumbers.draw(batch, watchStr, wx, wy)
|
||||||
|
|
||||||
if (hasBattery) {
|
if (hasBattery) {
|
||||||
val batCell = batteryTex.get(0, isCharging.toInt())
|
val batCell = batteryTex.get(btxoff + btx, bty)
|
||||||
batch.draw(batCell, wx - watchHeight - batCell.regionWidth, wy)
|
batch.draw(batCell, wx - watchHeight - batCell.regionWidth, wy)
|
||||||
|
|
||||||
App.fontSmallNumbers.draw(
|
App.fontSmallNumbers.draw(
|
||||||
@@ -427,20 +432,6 @@ object TerrarumPostProcessor : Disposable {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val magn = App.scr.magn
|
|
||||||
|
|
||||||
shapeRenderer.inUse(ShapeRenderer.ShapeType.Filled) {
|
|
||||||
if (hasBattery && !isCharging) {
|
|
||||||
val w = magn * (16f * batteryPercentage / 100f)
|
|
||||||
val h = magn * 6f
|
|
||||||
val x = magn * (wx - watchHeight - batteryTex.tileW + 2)
|
|
||||||
val y = magn * (wy + 3)
|
|
||||||
|
|
||||||
shapeRenderer.color = Color(1f, 1f, 1f, 1f)
|
|
||||||
shapeRenderer.rect(x, y, w, h)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val defaultResStr = "Ingame UI Area"
|
private val defaultResStr = "Ingame UI Area"
|
||||||
|
|||||||
BIN
work_files/graphics/gui/fullscreen_bat_ind.kra
LFS
Normal file
BIN
work_files/graphics/gui/fullscreen_bat_ind.kra
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user