a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Client / Sprite
Represents a sprite, an object that can be drawn on the screen with a texture, position, size, rotation, and color.
new Sprite(
textureDict
,textureName
,pos
?,size
?,heading
?,color
?):Sprite
Creates an instance of a Sprite.
• textureDict: string
The name of the texture dictionary.
• textureName: string
The name of the texture.
• pos?: Point
The position of the sprite on the screen.
• size?: Size
The size of the sprite.
• heading?: number
= 0
The heading (rotation) of the sprite in degrees. Default is 0.
• color?: Color
The color of the sprite. Default is white.
color:
Color
heading:
number
pos:
Point
size:
Size
textureName:
string
visible:
boolean
get
IsTextureDictionaryLoaded():boolean
Checks if the texture dictionary is loaded.
boolean
True if the texture dictionary is loaded, otherwise false.
get
TextureDict():string
Gets the texture dictionary name.
set
TextureDict(v
):void
Sets the texture dictionary name and loads it if not already loaded.
• v: string
The texture dictionary name.
string
The texture dictionary name as a string.
Draws the sprite on the screen with either the specified or current attributes.
The screen resolution to use for scaling or the texture dictionary name.
The texture name.
The position to draw the sprite at.
The size to draw the sprite with.
The heading (rotation) of the sprite in degrees.
The color to draw the sprite with.
Whether to load the texture if not already loaded.
The screen resolution to use for scaling.
draw(
resolution
?):void
Draws the sprite on the screen.
• resolution?: Size
The screen resolution to use for scaling.
void
The screen resolution to use for scaling or the texture dictionary name.
The texture name.
The position to draw the sprite at.
The size to draw the sprite with.
The heading (rotation) of the sprite in degrees.
The color to draw the sprite with.
Whether to load the texture if not already loaded.
The screen resolution to use for scaling.
draw(
textureDictionary
?,textureName
?,pos
?,size
?,heading
?,color
?,loadTexture
?,resolution
?):void
Draws the sprite on the screen with the specified parameters.
• textureDictionary?: string
The texture dictionary name.
• textureName?: string
The texture name.
• pos?: Point
The position to draw the sprite at.
• size?: Size
The size to draw the sprite with.
• heading?: number
The heading (rotation) of the sprite in degrees.
• color?: Color
The color to draw the sprite with.
• loadTexture?: boolean
Whether to load the texture if not already loaded.
• resolution?: Size
The screen resolution to use for scaling.
void
The screen resolution to use for scaling or the texture dictionary name.
The texture name.
The position to draw the sprite at.
The size to draw the sprite with.
The heading (rotation) of the sprite in degrees.
The color to draw the sprite with.
Whether to load the texture if not already loaded.
The screen resolution to use for scaling.
IDrawable.draw
loadTextureDictionary():
void
Loads the texture dictionary required for the sprite. This method will keep trying to load until the texture dictionary is loaded.
void