aboutsummaryrefslogtreecommitdiff
path: root/gamemode/utility
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/utility')
-rw-r--r--gamemode/utility/svg/cl_svg.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/gamemode/utility/svg/cl_svg.lua b/gamemode/utility/svg/cl_svg.lua
index 6f34390..6a17f0a 100644
--- a/gamemode/utility/svg/cl_svg.lua
+++ b/gamemode/utility/svg/cl_svg.lua
@@ -74,6 +74,23 @@ function svg.MaterialFromSVG(spath,background,foreground)
return mat
end
+function svg.MaterialFromHTTP(spath,background,foreground)
+ print("Drawing from http",spath)
+ local html = vgui.Create("DHTML")
+ http.Fetch(spath,
+ function(body,size,headers,code)
+ print("Got response!")
+ html:SetHTML(string.format([[
+ <style>%s%sbody{overflow:hidden}</style><body>%s</body>
+ ]],background and bgf or "",foreground and fgf or "",body))
+ end,function(err)
+ print("Failed to get file",spath,"err:",err)
+ end,{})
+ local mat = {}
+ toprocess[#toprocess + 1] = {mat,html}
+ return mat
+end
+
hook.Add("Think","process_svg_materials",function()
for k,v in ipairs(toprocess) do
local hm = v[2]:GetHTMLMaterial()