From be4055809b02a783f93ac15ee6fc326d0238c376 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Fri, 23 Mar 2018 15:51:18 -0400 Subject: Start working on allows svgs to be loaded over html --- gamemode/utility/svg/cl_svg.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gamemode/utility') 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([[ + %s + ]],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() -- cgit v1.2.3-70-g09d2