Advertisement
GTA5HelpDesk

DrawSprite GTA V

Aug 15th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. //Note: in this application the texture dictionary images are prefixed with the letter F, as in F1, F2 etc.
  2. //Modify accordingly, with or with or without prefix
  3.  
  4. private void DrawSprite()
  5. {
  6. if (drawSprite)
  7. {
  8. Vector3 textureRes = Function.Call<Vector3>(Hash.GET_TEXTURE_RESOLUTION, SpriteLibrary, SpriteName);
  9. float scaleX = (textureRes.X / GTA.UI.Screen.Resolution.Width) * SpriteSizeX; float scaleY = (textureRes.Y / GTA.UI.Screen.Resolution.Height) * SpriteSizeY; float rotation = 0f; Color col = Color.White; //color optional
  10.  
  11. if (Function.Call<bool>(Hash.HAS_STREAMED_TEXTURE_DICT_LOADED, SpriteLibrary))
  12. {Function.Call(Hash.DRAW_SPRITE, SpriteLibrary, SpriteName, spriteX, spriteY, scaleX, scaleY, rotation, col.R, col.G, col.B, col.A); }
  13. else
  14. { Function.Call(Hash.REQUEST_STREAMED_TEXTURE_DICT, SpriteLibrary, false); }
  15. }
  16. }
  17.  
  18.  
  19. // In the ontick
  20. SpriteName = Name_Prefix + spriteNum.ToString(); //Name
  21. DrawSprite();
  22.  
  23. // From the LemonUI Menu, where MyChoice is the Preview Option
  24. // I change the text of Preview to Preview On or Preview Off after selection, which is why you have the OR below
  25. if (MyChoice == "Preview" || MyChoice == "Preview On" || MyChoice == "Preview Off")
  26. {
  27. drawSprite = !drawSprite;
  28. int PreviewIndex = 0; // Index of the "Preview" option in the menu, starts at 0
  29.  
  30. if (drawSprite)
  31. {
  32. GalOptions.Items[PreviewIndex] = "Preview On"; // This is just to change the text optionally, same below
  33.  
  34. }
  35. else
  36. {
  37. GalOptions.Items[PreviewIndex] = "Preview Off";
  38.  
  39. }
  40.  
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement