mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
fix: time the HUD graph from the game's frames as shown on screen
This commit is contained in:
1 parent
eaaecf0661
commit
1f60e57749
6 files changed
+110
-30
No files matched your search
@@ -18,6 +18,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.session.LoadingState
|
||||
import com.droiddeck.launcher.session.PerfHud
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import androidx.compose.animation.core.FastOutSlowInEasing
|
||||
@@ -116,7 +117,7 @@ fun HudText(text: String, graph: FloatArray = FloatArray(0), color: String = "mi
|
||||
@Composable
|
||||
private fun HudGraph(samples: FloatArray, accent: Color, wash: Float) {
|
||||
Canvas(Modifier.width(148.dp).height(44.dp)) {
|
||||
val maxMs = (samples.maxOrNull() ?: 16.7f).coerceAtLeast(16.7f)
|
||||
val maxMs = PerfHud.GRAPH_MAX_MS
|
||||
val step = size.width / (samples.size - 1)
|
||||
fun yOf(ms: Float) = size.height * (1f - (ms / maxMs).coerceIn(0f, 1f))
|
||||
val fillAlpha = wash * 0.5f
|
||||
|
||||
Reference in new issue
Block a user