natives.drawSprite

From GTA Connected
Jump to navigation Jump to search

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

void natives.drawSprite(int texture, float x, float y, float width, float height, float rotation, int r, int g, int b, int a)

The natives.drawSprite function is used to Draws a textured sprite on the screen at the specified position, size, rotation, and color.

Parameters

1) int texture Handle of the texture obtained with natives.getTexture.
2) float x Normalized X coordinate (0.0–1.0) for the sprite’s center.
3) float y Normalized Y coordinate (0.0–1.0) for the sprite’s center.
4) float width Width of the sprite relative to screen size.
5) float height Height of the sprite relative to screen size.
6) float rotation Rotation angle in degrees (clockwise).
7) int r Red color value (0–255).
8) int g Green color value (0–255).
9) int b Blue color value (0–255).
10) int a Alpha transparency value (0–255).

Return

void This function doesn't return a value.

Notes

Examples

Example 1 - JavaScript:

addEventHandler("OnDrawnHUD", function() {

   // Load TXD and get texture once
   const txdId = natives.loadTxd("frontend_360");
   const neonTex = natives.getTexture(txdId, "neon");
   // Draw the texture as a sprite in the center of the screen
   if (neonTex) {
       natives.drawSprite(neonTex, 0.5, 0.5, 0.3, 0.2, 0.0, 255, 255, 255, 255);
   }

});

Compatibility

There isn't any compatibility information for this function.