Skip to content

Commit

Permalink
Optimizes hud.
Browse files Browse the repository at this point in the history
  • Loading branch information
toxicity188 committed Mar 19, 2024
1 parent 34b8c50 commit e2ecd19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions dist/src/main/kotlin/kr/toxicity/hud/hud/HudHeadElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class HudHeadElement(parent: HudImpl, private val head: HeadLayout, gui: GuiLoca
head.head.pixel,
final.x,
head.conditions.and(head.head.conditions)
)
).getHead(UpdateEvent.EMPTY)
}

fun getHead(player: HudPlayer) = renderer.getHead(UpdateEvent.EMPTY)(player)
fun getHead(player: HudPlayer) = renderer(player)
}
8 changes: 4 additions & 4 deletions dist/src/main/kotlin/kr/toxicity/hud/hud/HudImageElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ class HudImageElement(parent: HudImpl, private val image: ImageLayout, gui: GuiL
})
list.add(finalWidth.toPixelComponent(finalPixel.x + round(pair.image.xOffset * scale).toInt()))
}
ImageRenderer(
val renderer = ImageRenderer(
hud,
image.color,
list,
image.conditions.and(image.image.conditions)
)
renderer.max() to renderer.getComponent(UpdateEvent.EMPTY)
}

val max = chars.max()
val max = chars.first

fun getComponent(player: HudPlayer): PixelComponent = chars.getComponent(
UpdateEvent.EMPTY)(player)
fun getComponent(player: HudPlayer): PixelComponent = chars.second(player)

}
5 changes: 2 additions & 3 deletions dist/src/main/kotlin/kr/toxicity/hud/hud/HudTextElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class HudTextElement(parent: HudImpl, name: String, file: File, private val text
text.numberFormat,
text.conditions.and(text.text.conditions)
)
}
}.getText(UpdateEvent.EMPTY)

fun getText(player: HudPlayer): PixelComponent = renderer.getText(
UpdateEvent.EMPTY)(player)
fun getText(player: HudPlayer): PixelComponent = renderer(player)
}

0 comments on commit e2ecd19

Please sign in to comment.