Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Note: in this application the texture dictionary images are prefixed with the letter F, as in F1, F2 etc.
- //Modify accordingly, with or with or without prefix
- private void DrawSprite()
- {
- if (drawSprite)
- {
- Vector3 textureRes = Function.Call<Vector3>(Hash.GET_TEXTURE_RESOLUTION, SpriteLibrary, SpriteName);
- 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
- if (Function.Call<bool>(Hash.HAS_STREAMED_TEXTURE_DICT_LOADED, SpriteLibrary))
- {Function.Call(Hash.DRAW_SPRITE, SpriteLibrary, SpriteName, spriteX, spriteY, scaleX, scaleY, rotation, col.R, col.G, col.B, col.A); }
- else
- { Function.Call(Hash.REQUEST_STREAMED_TEXTURE_DICT, SpriteLibrary, false); }
- }
- }
- // In the ontick
- SpriteName = Name_Prefix + spriteNum.ToString(); //Name
- DrawSprite();
- // From the LemonUI Menu, where MyChoice is the Preview Option
- // I change the text of Preview to Preview On or Preview Off after selection, which is why you have the OR below
- if (MyChoice == "Preview" || MyChoice == "Preview On" || MyChoice == "Preview Off")
- {
- drawSprite = !drawSprite;
- int PreviewIndex = 0; // Index of the "Preview" option in the menu, starts at 0
- if (drawSprite)
- {
- GalOptions.Items[PreviewIndex] = "Preview On"; // This is just to change the text optionally, same below
- }
- else
- {
- GalOptions.Items[PreviewIndex] = "Preview Off";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement