diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2025-12-27 17:21:49 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2025-12-27 17:21:49 -0600 |
| commit | 0c6a674999333a10317ee8a2b43f72bde03068c5 (patch) | |
| tree | 71e1839fafaba516d2472d02847fe65d469a5550 /gamemode/utility | |
| parent | aacf5fbcfe1e6f2cdb0c6ab19b3e8dd87e3fd488 (diff) | |
| download | artery-0c6a674999333a10317ee8a2b43f72bde03068c5.tar.gz artery-0c6a674999333a10317ee8a2b43f72bde03068c5.tar.bz2 artery-0c6a674999333a10317ee8a2b43f72bde03068c5.zip | |
Diffstat (limited to 'gamemode/utility')
| -rw-r--r-- | gamemode/utility/svg/cl_svg.lua | 23 |
1 files changed, 23 insertions, 0 deletions
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([[ +<style>%s%sbody{overflow:hidden}</style><body>%s</body> +]],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) |
