Garry's Mod Wiki




A panel that draws a sprite on the player's HUD with the given IMaterial, Color and rotation.

A shortcut for this is CreateSprite().


Derives methods, etc not listed on this page from DPanel.


table DSprite:GetColor()
Gets the color the sprite is using as a modifier.
Vector DSprite:GetHandle()
No Description
IMaterial DSprite:GetMaterial()
Gets the material the sprite is using.
number DSprite:GetRotation()
Gets the 2D rotation angle of the sprite, in the plane of the screen.
DSprite:SetColor( table color )
Sets the color modifier for the sprite.
DSprite:SetHandle( Vector vec )
Seems to be an unused feature. Does nothing.
DSprite:SetMaterial( IMaterial material )
Sets the source material for the sprite.
DSprite:SetRotation( number ang )
Sets the 2D rotation angle of the sprite, in the plane of the screen.


Creates a DSprite with the sent_ball material, and sets the color to cyan.

local sprite = vgui.Create("DSprite") sprite:SetMaterial(Material("sprites/sent_ball")) sprite:SetColor(Color(0, 255, 255)) sprite:Center() sprite:SetSize(200, 200)
Output: See Preview above.

Special Pages



Render Time: 57ms

DB GetPage 36
Generate Html 5
SaveChanges (1) 6
Render Body 0
Render Sidebar 7