Rename GraphRendering -> ChartRendering

This commit is contained in:
DBotThePony 2024-10-01 09:38:37 +07:00
parent ac9095b58d
commit badcc5d3d5
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 7 additions and 8 deletions

View File

@ -9,7 +9,6 @@ import net.minecraft.client.gui.Font
import net.minecraft.client.renderer.GameRenderer
import net.minecraft.network.chat.Component
import ru.dbotthepony.kommons.math.RGBAColor
import ru.dbotthepony.kommons.math.linearInterpolation
import kotlin.math.PI
import kotlin.math.acos
import kotlin.math.cos
@ -22,7 +21,7 @@ private const val HIGHLIGHT_WIDTH = 3f
private val TEXT_BACKGROUND = RGBAColor(0f, 0f, 0f, 0.5f)
data class GraphMouseLabels(
data class ChartMouseLabels(
val mouseX: Float,
val mouseY: Float,
val labels: (Int) -> Component,
@ -33,13 +32,13 @@ data class GraphMouseLabels(
val textBackgroundColor: RGBAColor = TEXT_BACKGROUND
)
fun renderGraph(
fun renderChart(
poseStack: PoseStack,
normalized: FloatArray,
width: Float,
height: Float,
color: RGBAColor = RGBAColor.WHITE,
labels: GraphMouseLabels? = null,
labels: ChartMouseLabels? = null,
x: Float = 0f,
y: Float = 0f,
) {

View File

@ -2,9 +2,9 @@ package ru.dbotthepony.mc.otm.client.screen.panels
import net.minecraft.network.chat.Component
import ru.dbotthepony.kommons.math.RGBAColor
import ru.dbotthepony.mc.otm.client.render.GraphMouseLabels
import ru.dbotthepony.mc.otm.client.render.ChartMouseLabels
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
import ru.dbotthepony.mc.otm.client.render.renderGraph
import ru.dbotthepony.mc.otm.client.render.renderChart
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.core.DecimalHistoryChart
import ru.dbotthepony.mc.otm.core.TextComponent
@ -34,12 +34,12 @@ open class DecimalHistoryChartPanel<out S : MatteryScreen<*>>(
graphics.renderRect(0f, 0f, this.width, this.height, color = RGBAColor.BLACK)
renderGraph(
renderChart(
graphics.pose,
normalized,
width,
height,
labels = GraphMouseLabels(
labels = ChartMouseLabels(
mouseX - absoluteX,
mouseY - absoluteY,
{ formatText(graph[it]) },