D3stats/lua/d3stats/cl_hud.lua

31 lines
1.1 KiB
Lua
Raw Normal View History

-- Delete HUD and redo if already existent. This will reset the displayed values until the next update from the server
2016-10-05 12:30:35 +00:00
if d3stats.D3StatsOverlay then
d3stats.D3StatsOverlay:Remove()
d3stats.Overlay_Init()
end
-- HUD on the left top of the screen
function d3stats.Overlay_Init()
local screenscale = BetterScreenScale()
d3stats.D3StatsOverlay = vgui.Create( "D3StatsOverlay" )
d3stats.D3StatsOverlay:SetPos( 0, screenscale * 80 )
d3stats.D3StatsOverlay:SetSize( 350, 100 )
end
-- Call this function from cl_targetid.lua in the gamemode. Works for ZS, needs adjustments for other gamemodes.
2016-10-05 12:30:35 +00:00
local colTemp = Color(255, 255, 255)
function d3stats.DrawTargetID( ent, fade, x, y )
colTemp.a = fade * 255
--util.ColorCopy(COLOR_FRIENDLY, colTemp)
local Level = ent:GetNWInt( "D3Stats_Level", 0 )
if Level > 0 and d3stats.Levels[Level] then
draw.SimpleTextBlur("Level " .. tostring(Level) .. " \"" .. d3stats.Levels[Level].Name .. "\"", d3stats.Font_TargetID, x, y, colTemp, TEXT_ALIGN_CENTER)
y = y + draw.GetFontHeight(d3stats.Font_TargetID) + 4
2016-10-05 12:30:35 +00:00
end
return x, y
end