forked from metin-server/m2dev-client
Smooth player gauge anchor on high FPS
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user