Skip to content

Allows you to load and render SVGs in GMod

License

Notifications You must be signed in to change notification settings

noaccessl/glua-SVG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

glua-SVG

Allows you to load and render SVGs in GMod

If you need to load SVG on startup, it is better to do it in GM:OnGamemodeLoaded hook due to how vgui.Create works.

Example

image

local w, h = 120, 120

svg.Test = svg.Generate( 'ok', w, h, [[<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="240" height="240" viewBox="0 0 48 48">
<path fill="#4caf50" d="M44,24c0,11.045-8.955,20-20,20S4,35.045,4,24S12.955,4,24,4S44,12.955,44,24z"></path><path fill="#ccff90" d="M34.602,14.602L21,28.199l-5.602-5.598l-2.797,2.797L21,33.801l16.398-16.402L34.602,14.602z"></path>
</svg>]] )

hook.Add( 'HUDPaint', '', function()
	svg.Test( ScrW() * 0.5 - w * 0.5, ScrH() * 0.5 - h * 0.5 )
end )

image

local w, h = 144, 144

svg.Test = svg.LoadURL( 'gmod', w, h, 'https://upload.wikimedia.org/wikipedia/commons/9/97/Garry%27s_Mod_logo.svg' )

hook.Add( 'HUDPaint', '', function()
	svg.Test( ScrW() * 0.5 - w * 0.5, ScrH() * 0.5 - h * 0.5 )
end )

About

Allows you to load and render SVGs in GMod

Resources

License

Stars

Watchers

Forks

Languages