aboutsummaryrefslogtreecommitdiff
path: root/gamemode/utility/svg
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2025-12-27 17:21:49 -0600
committerAlexander M Pickering <alex@cogarr.net>2025-12-27 17:21:49 -0600
commit0c6a674999333a10317ee8a2b43f72bde03068c5 (patch)
tree71e1839fafaba516d2472d02847fe65d469a5550 /gamemode/utility/svg
parentaacf5fbcfe1e6f2cdb0c6ab19b3e8dd87e3fd488 (diff)
downloadartery-master.tar.gz
artery-master.tar.bz2
artery-master.zip
Update for documentationHEADmaster
Diffstat (limited to 'gamemode/utility/svg')
-rw-r--r--gamemode/utility/svg/cl_svg.lua23
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)