Smooth player gauge anchor on high FPS

This commit is contained in:
root
2026-04-16 10:48:08 +02:00
parent 780900af61
commit 10915467c1

View File

@@ -22,7 +22,7 @@ class PlayerGauge(ui.Gauge):
self.SetPosition(-100, -100)
ui.Gauge.Hide(self)
def OnUpdate(self):
def __UpdateScreenPosition(self):
playerIndex = player.GetMainCharacterIndex()
(x, y, z)=textTail.GetPosition(playerIndex)
@@ -30,6 +30,14 @@ class PlayerGauge(ui.Gauge):
isChat = textTail.IsChat(playerIndex)
ui.Gauge.SetPosition(self, int(x - self.GetWidth() // 2), int(y + 5) + isChat * 17)
def OnUpdate(self):
self.__UpdateScreenPosition()
def OnRender(self):
# Refresh the anchor every render so the gauge tracks interpolated
# character/text-tail positions on high refresh displays.
self.__UpdateScreenPosition()
def RefreshGauge(self):
self.curHP = player.GetStatus(player.HP)