Rename GraphRendering -> ChartRendering
This commit is contained in:
parent
ac9095b58d
commit
badcc5d3d5
@ -9,7 +9,6 @@ import net.minecraft.client.gui.Font
|
|||||||
import net.minecraft.client.renderer.GameRenderer
|
import net.minecraft.client.renderer.GameRenderer
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.kommons.math.RGBAColor
|
import ru.dbotthepony.kommons.math.RGBAColor
|
||||||
import ru.dbotthepony.kommons.math.linearInterpolation
|
|
||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
import kotlin.math.acos
|
import kotlin.math.acos
|
||||||
import kotlin.math.cos
|
import kotlin.math.cos
|
||||||
@ -22,7 +21,7 @@ private const val HIGHLIGHT_WIDTH = 3f
|
|||||||
|
|
||||||
private val TEXT_BACKGROUND = RGBAColor(0f, 0f, 0f, 0.5f)
|
private val TEXT_BACKGROUND = RGBAColor(0f, 0f, 0f, 0.5f)
|
||||||
|
|
||||||
data class GraphMouseLabels(
|
data class ChartMouseLabels(
|
||||||
val mouseX: Float,
|
val mouseX: Float,
|
||||||
val mouseY: Float,
|
val mouseY: Float,
|
||||||
val labels: (Int) -> Component,
|
val labels: (Int) -> Component,
|
||||||
@ -33,13 +32,13 @@ data class GraphMouseLabels(
|
|||||||
val textBackgroundColor: RGBAColor = TEXT_BACKGROUND
|
val textBackgroundColor: RGBAColor = TEXT_BACKGROUND
|
||||||
)
|
)
|
||||||
|
|
||||||
fun renderGraph(
|
fun renderChart(
|
||||||
poseStack: PoseStack,
|
poseStack: PoseStack,
|
||||||
normalized: FloatArray,
|
normalized: FloatArray,
|
||||||
width: Float,
|
width: Float,
|
||||||
height: Float,
|
height: Float,
|
||||||
color: RGBAColor = RGBAColor.WHITE,
|
color: RGBAColor = RGBAColor.WHITE,
|
||||||
labels: GraphMouseLabels? = null,
|
labels: ChartMouseLabels? = null,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
y: Float = 0f,
|
y: Float = 0f,
|
||||||
) {
|
) {
|
@ -2,9 +2,9 @@ package ru.dbotthepony.mc.otm.client.screen.panels
|
|||||||
|
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import ru.dbotthepony.kommons.math.RGBAColor
|
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.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.client.screen.MatteryScreen
|
||||||
import ru.dbotthepony.mc.otm.core.DecimalHistoryChart
|
import ru.dbotthepony.mc.otm.core.DecimalHistoryChart
|
||||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
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)
|
graphics.renderRect(0f, 0f, this.width, this.height, color = RGBAColor.BLACK)
|
||||||
|
|
||||||
renderGraph(
|
renderChart(
|
||||||
graphics.pose,
|
graphics.pose,
|
||||||
normalized,
|
normalized,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
labels = GraphMouseLabels(
|
labels = ChartMouseLabels(
|
||||||
mouseX - absoluteX,
|
mouseX - absoluteX,
|
||||||
mouseY - absoluteY,
|
mouseY - absoluteY,
|
||||||
{ formatText(graph[it]) },
|
{ formatText(graph[it]) },
|
||||||
|
Loading…
Reference in New Issue
Block a user