Class Sprite
A sprite element using a built-in texture.
Inherited Members
Namespace: GTA.UI
Assembly: ScriptHookVDotNet3.dll
Syntax
public class Sprite : ISpriteElement, IElement, IDisposable
Constructors
| Improve this Doc View SourceSprite(String, String, SizeF, PointF)
Initializes a new instance of the Sprite class used for drawing in game textures on the screen.
Declaration
public Sprite(string textureDict, string textureName, SizeF size, PointF position)
Parameters
Type | Name | Description |
---|---|---|
String | textureDict | The Texture dictionary where the Sprite is stored (the *.ytd file). |
String | textureName | Name of the Sprite inside the Texture dictionary. |
SizeF | size | |
PointF | position |
Sprite(String, String, SizeF, PointF, Color)
Initializes a new instance of the Sprite class used for drawing in game textures on the screen.
Declaration
public Sprite(string textureDict, string textureName, SizeF size, PointF position, Color color)
Parameters
Type | Name | Description |
---|---|---|
String | textureDict | The Texture dictionary where the Sprite is stored (the *.ytd file). |
String | textureName | Name of the Sprite inside the Texture dictionary. |
SizeF | size | |
PointF | position | |
Color | color |
Sprite(String, String, SizeF, PointF, Color, Single)
Initializes a new instance of the Sprite class used for drawing in game textures on the screen.
Declaration
public Sprite(string textureDict, string textureName, SizeF size, PointF position, Color color, float rotation)
Parameters
Type | Name | Description |
---|---|---|
String | textureDict | The Texture dictionary where the Sprite is stored (the *.ytd file). |
String | textureName | Name of the Sprite inside the Texture dictionary. |
SizeF | size | |
PointF | position | |
Color | color | |
Single | rotation | Set the rotation to draw the sprite, measured in degrees, see also Rotation. |
Sprite(String, String, SizeF, PointF, Color, Single, Boolean)
Initializes a new instance of the Sprite class used for drawing in game textures on the screen.
Declaration
public Sprite(string textureDict, string textureName, SizeF size, PointF position, Color color, float rotation, bool centered)
Parameters
Type | Name | Description |
---|---|---|
String | textureDict | The Texture dictionary where the Sprite is stored (the *.ytd file). |
String | textureName | Name of the Sprite inside the Texture dictionary. |
SizeF | size | |
PointF | position | |
Color | color | |
Single | rotation | Set the rotation to draw the sprite, measured in degrees, see also Rotation. |
Boolean | centered | Position the Sprite based on its center instead of top left corner, see also Centered. |
Properties
| Improve this Doc View SourceCentered
Gets or sets a value indicating whether this Sprite should be positioned based on its center or top left corner
Declaration
public bool Centered { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true if centered; otherwise, false. |
Color
Gets or sets the color of this Sprite.
Declaration
public Color Color { get; set; }
Property Value
Type | Description |
---|---|
Color | The color. |
Enabled
Gets or sets a value indicating whether this Sprite will be drawn.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true if enabled; otherwise, false. |
Position
Gets or sets the position of this Sprite.
Declaration
public PointF Position { get; set; }
Property Value
Type | Description |
---|---|
PointF | The position scaled on a 1280*720 pixel base. |
Remarks
If ScaledDraw is called, the position will be scaled by the width returned in ScaledWidth.
Rotation
Gets or sets the rotation to draw thie Sprite.
Declaration
public float Rotation { get; set; }
Property Value
Type | Description |
---|---|
Single | The rotation measured in degrees, clockwise increasing, 0.0 at vertical |
Size
Gets or sets the size to draw the Sprite
Declaration
public SizeF Size { get; set; }
Property Value
Type | Description |
---|---|
SizeF | The size on a 1280*720 pixel base |
Remarks
If ScaledDraw is called, the size will be scaled by the width returned in ScaledWidth.
Methods
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
Draw()
Draws this Sprite.
Declaration
public virtual void Draw()
Draw(SizeF)
Draws the Sprite at the specified offset.
Declaration
public virtual void Draw(SizeF offset)
Parameters
Type | Name | Description |
---|---|---|
SizeF | offset | The offset. |
ScaledDraw()
Draws this Sprite using the width returned in ScaledWidth.
Declaration
public virtual void ScaledDraw()
ScaledDraw(SizeF)
Draws the Sprite at the specified offset using the width returned in ScaledWidth.
Declaration
public virtual void ScaledDraw(SizeF offset)
Parameters
Type | Name | Description |
---|---|---|
SizeF | offset | The offset. |