I wanna create some customs overlays to draw data and create menus close to the unit mesh.
It works but the refresh rate is too low (delta is 10 ms). So the text is shaking on camera move.
You can compare with the regular green name and health bar that is ok.
This is my code. I checked to update on each frame, so i don' know how to fix it. Maybe overlays rendering are hard coded. Any Idea ?
- Code: Select all
overlay = Bitmap(GetFrame(0))
overlay.Width:Set(100)
overlay.Height:Set(50)
overlay.etaText = UIUtil.CreateText(overlay, 'ETA', 10, UIUtil.bodyFont)
overlay.etaText:SetColor('white')
overlay.etaText:SetDropShadow(true)
overlay:SetNeedsFrameUpdate(true)
overlay.OnFrame = function(self, delta)
local unit = GetSelectedUnits()
if unit then
overlay.pos = unit[1]:GetPosition()
local worldView = import('/lua/ui/game/worldview.lua').viewLeft
local pos = worldView:Project(overlay.pos)
LayoutHelpers.AtLeftTopIn(overlay, worldView, pos.x - overlay.Width() / 2, pos.y - overlay.Height() / 2 + 1)
LayoutHelpers.AtCenterIn(overlay.etaText, overlay, 15, 0)
overlay.etaText:SetText('Why is it shaking ?')
else
overlay.etaText:SetText('')
end
end