Graphics::drawSprite: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
Draws a 2D sprite on the screen.<br><br>Parameters:<br>textureDict - Name of texture dictionary to load texture from (e.g. 'CommonMenu', 'MPWeaponsCommon', etc.)<br><br>textureName - Name of texture to load from texture dictionary (e.g. 'last_team_standing_icon', 'tennis_icon', etc.)<br><br>screenX/Y - Screen offset (0.5 = center)<br>scaleX/Y - Texture scaling. Negative values can be used to flip the texture on that axis. (0.5 = half)<br><br>heading - Texture rotation in degrees (default = 0.0) positive is clockwise, measured in degrees<br><br>red,green,blue - Sprite color (default = 255/255/255/ALPHA or 255)<br><br>
Draws a 2D Sprite / Texture on the screen. This can also be done through DLCPacks.
 
[[Textures | Textures & Sprite List]]
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">mp.game.graphics.drawSprite(textureDict, textureName, screenX, screenY, scaleX, scaleY, heading, colorR, colorG, colorB, alpha);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.game.graphics.drawSprite(textureDict, textureName, screenX, screenY, scaleX, scaleY, heading, colorR, colorG, colorB, alpha);</syntaxhighlight>

Latest revision as of 16:19, 27 July 2018

Draws a 2D Sprite / Texture on the screen. This can also be done through DLCPacks.

Textures & Sprite List

Syntax

mp.game.graphics.drawSprite(textureDict, textureName, screenX, screenY, scaleX, scaleY, heading, colorR, colorG, colorB, alpha);

Required Arguments

  • textureDict: String
  • textureName: String
  • screenX: float
  • screenY: float
  • scaleX: float
  • scaleY: float
  • heading: float
  • colorR: int
  • colorG: int
  • colorB: int
  • alpha: int

Return value

  • Undefined

Example

if (!mp.game.graphics.hasStreamedTextureDictLoaded("mponmissmarkers")) {
    mp.game.graphics.requestStreamedTextureDict("mponmissmarkers", true);
}
    
if (mp.game.graphics.hasStreamedTextureDictLoaded("mponmissmarkers")) {
    mp.game.graphics.drawSprite("mponmissmarkers", "capture_the_flag_base_icon", 0.5, 0.5, 0.1, 0.1, 0, 255, 255, 255, 100);
}

See also