aboutsummaryrefslogtreecommitdiff
path: root/gamemode/utility
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-03-23 15:51:18 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2018-03-23 15:51:18 -0400
commitbe4055809b02a783f93ac15ee6fc326d0238c376 (patch)
treec84e039b4cdb991d39774af96aa5ad7945f84f83 /gamemode/utility
parente498a96b23f8325ba7ad13283f71ad1718936224 (diff)
downloadartery-be4055809b02a783f93ac15ee6fc326d0238c376.tar.gz
artery-be4055809b02a783f93ac15ee6fc326d0238c376.tar.bz2
artery-be4055809b02a783f93ac15ee6fc326d0238c376.zip
Start working on allows svgs to be loaded over html
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()