Garry's Mod Wiki

Revision Difference

Silkicons#561086

<cat>Dev.UI</cat>⤶ <cat>Dev.Ref</cat>⤶ In Garry's Mod 13, all silkicons are included in the game. They can be found in `materials/icon16/*.png` A full list of all silkicons which can be used in the game can be [viewed here](https://heyter.github.io/js-famfamfam-search/) Also included are flag icons. They can be found in `materials/flags16/*.png`. A preview of them can be found here: <page>Flag Icon List</page>. The flag icon filenames follow the [ISO 3166-1 alpha-2 country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) and include all flags. In-game, all of these icons can be viewed via `derma_icon_browser` console command, including when not on a map/server. Make sure to include `icon16/` before the `.png` as shown below # Example of using silkicons This line of code makes a DermaMenu option have a silkicon logo on its left side. ``` MENU:AddOption("Say hi", function() RunConsoleCommand("say", "hi") end ):SetImage( "icon16/user.png" ) ``` Here is an example of using a silkicon in a <page>DHTML</page> panel. ``` html:SetHTML( [[ <img src="asset://garrysmod/materials/icon16/user.png"/> ]] ) ``` # Rendering silkicons You no longer can use <page>surface.GetTextureID</page> and <page>surface.SetTexture</page> with silkicons, because they are now .png files. Now, to draw them, you must use <page>Global.Material</page> and <page>surface.SetMaterial</page>. Since <page>Global.Material</page> is slower than <page>surface.GetTextureID</page>, it is not recommended to call it in a drawing hook, which are ran every frame, as that will cause lag. Instead, save the material as a variable outside of the draw hook. # Icon List [Search...](https://heyter.github.io/js-famfamfam-search/) <upload src="353/8d872d2846d452e.png" size="963864" name="index_abc.png" />