Class CustomSprite
A sprite element using a custom image texture.
Inherited Members
Namespace: GTA.UI
Assembly: ScriptHookVDotNet3.dll
Syntax
public class CustomSprite : ISpriteElement, IElement
Constructors
| Improve this Doc View SourceCustomSprite(String, SizeF, PointF)
Initializes a new instance of the CustomSprite class used for drawing external textures on the screen.
Declaration
public CustomSprite(string filename, SizeF size, PointF position)
Parameters
Type | Name | Description |
---|---|---|
String | filename | Full path to location of the CustomSprite on the disc. |
SizeF | size | Set the Size of the CustomSprite. |
PointF | position | Set the Position on screen where to draw the CustomSprite. |
Exceptions
Type | Condition |
---|---|
FileNotFoundException | Thrown if the specified file doesn't exist |
CustomSprite(String, SizeF, PointF, Color)
Initializes a new instance of the CustomSprite class used for drawing external textures on the screen.
Declaration
public CustomSprite(string filename, SizeF size, PointF position, Color color)
Parameters
Type | Name | Description |
---|---|---|
String | filename | Full path to location of the CustomSprite on the disc. |
SizeF | size | Set the Size of the CustomSprite. |
PointF | position | Set the Position on screen where to draw the CustomSprite. |
Color | color | Set the Color used to draw the CustomSprite. |
Exceptions
Type | Condition |
---|---|
FileNotFoundException | Thrown if the specified file doesn't exist |
CustomSprite(String, SizeF, PointF, Color, Single)
Initializes a new instance of the CustomSprite class used for drawing external textures on the screen.
Declaration
public CustomSprite(string filename, SizeF size, PointF position, Color color, float rotation)
Parameters
Type | Name | Description |
---|---|---|
String | filename | Full path to location of the CustomSprite on the disc. |
SizeF | size | Set the Size of the CustomSprite. |
PointF | position | Set the Position on screen where to draw the CustomSprite. |
Color | color | Set the Color used to draw the CustomSprite. |
Single | rotation | Set the rotation to draw the sprite, measured in degrees, see also Rotation. |
Exceptions
Type | Condition |
---|---|
FileNotFoundException | Thrown if the specified file doesn't exist |
CustomSprite(String, SizeF, PointF, Color, Single, Boolean)
Initializes a new instance of the CustomSprite class used for drawing external textures on the screen.
Declaration
public CustomSprite(string filename, SizeF size, PointF position, Color color, float rotation, bool centered)
Parameters
Type | Name | Description |
---|---|---|
String | filename | Full path to location of the CustomSprite on the disc. |
SizeF | size | Set the Size of the CustomSprite. |
PointF | position | Set the Position on screen where to draw the CustomSprite. |
Color | color | Set the Color used to draw the CustomSprite. |
Single | rotation | Set the rotation to draw the sprite, measured in degrees, see also Rotation. |
Boolean | centered | Position the CustomSprite based on its center instead of top left corner, see also Centered. |
Exceptions
Type | Condition |
---|---|
FileNotFoundException | Thrown if the specified file doesn't exist |
Properties
| Improve this Doc View SourceCentered
Gets or sets a value indicating whether this CustomSprite 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 CustomSprite.
Declaration
public Color Color { get; set; }
Property Value
Type | Description |
---|---|
Color | The color. |
Enabled
Gets or sets a value indicating whether this CustomSprite 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 CustomSprite.
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 CustomSprite.
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 CustomSprite
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 SourceDraw()
Draws this CustomSprite.
Declaration
public void Draw()
Draw(SizeF)
Draws the CustomSprite at the specified offset.
Declaration
public void Draw(SizeF offset)
Parameters
Type | Name | Description |
---|---|---|
SizeF | offset | The offset. |
ScaledDraw()
Draws this CustomSprite using the width returned in ScaledWidth.
Declaration
public virtual void ScaledDraw()
ScaledDraw(SizeF)
Draws the CustomSprite 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. |