From 0c6a674999333a10317ee8a2b43f72bde03068c5 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Sat, 27 Dec 2025 17:21:49 -0600 Subject: Update for documentation --- gamemode/utility/svg/cl_svg.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gamemode/utility/svg/cl_svg.lua') diff --git a/gamemode/utility/svg/cl_svg.lua b/gamemode/utility/svg/cl_svg.lua index 6a17f0a..7fa53d5 100644 --- a/gamemode/utility/svg/cl_svg.lua +++ b/gamemode/utility/svg/cl_svg.lua @@ -100,9 +100,32 @@ hook.Add("Think","process_svg_materials",function() for i = k,#toprocess do toprocess[i] = toprocess[i + 1] end + if v[3] then + v[3]() + end end end) +function svg.SetMaterialSVG(what,spath,background,foreground) + local html = vgui.Create("DHTML") + local svgdata = readsvg(spath) + local bgf = "" + local fgf = "" + if background ~= nil then + bgf = string.format("svg{background:%s}",background) + end + if foreground ~= nil then + fgf = string.format("svg path{fill:%s}",foreground) + end + html:SetHTML(string.format([[ +%s +]],background and bgf or "",foreground and fgf or "",svgdata)) + local mat = {} + toprocess[#toprocess + 1] = {mat,html,function() + what:SetMaterial(mat.material) + end} +end + function svg.SvgOnDpanel(spath,background,foreground,dpanel) local ret = {} ret.html = vgui.Create("DHTML",dpanel) -- cgit v1.2.3-70-g09d2