Garry's Mod Wiki

DSprite

Description

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

A shortcut for this is CreateSprite().

Parent

Derives from DPanel.

Methods

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.

Example

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.

Page Links


Special Pages


Wikis

?

Render Time: 57ms

DB GetPage 26
Generate Html 7
SaveChanges (1) 9
Render Body 0
Render Sidebar 12