Jump to content

Welcome to Gaming On Steroids Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

[18 November 2015] Added CreateSpriteFromFile, DrawSprite, SPRITE_PATH.


  • This topic is locked This topic is locked
No replies to this topic

#1
Feretorix

Feretorix

    Administrator

  • Administrators
  • 3,145 posts
sprIndex = CreateSpriteFromFile("yourspritefile.png"); --the functions will search into your C:\Users\[USERNAMEHERE]\AppData\Roaming\GamingOnSteroids\LOL\Sprites folder for the specific file. Returns SpriteID greater than 0 if found, and 0 if not found.

DrawSprite(SprIndex,ScreenX,ScreenY,SpriteX,SpriteY,SpriteWidth,SpriteHeight,COLOR); --draws a sprite on a specific location on your screen (X,Y) with a specific portion of it (X,Y,WIDTH,HEIGHT) and a possible COLOR (yes, ALPHA and all other colors are possible); Returns a boolean true if draw is success, false if failure (DirectX issue or SpriteIndex incorrect)

SCRIPT_PATH - a constant value pushed into the lua stack, holding the folder, where lua files are stored.



Small code example:
 
-- Used sprite: http://i.stack.imgur.com/ipKrd.png
local mysprite = CreateSpriteFromFile("ipKrd.png"); --make sure you call this ONLY ONCE, else you will flood your RAM and crash GoS.
OnDraw(function(myHero)
if mysprite > 0 then
	DrawSprite(mysprite,200,200,112,1,367,73,ARGB(255,255,255,255))
	DrawText("Look! A Button!", 35, 225, 215, ARGB(255,255,255,255))
	DrawSprite(mysprite,200,300,0,0,1000,1000,ARGB(255,255,255,255))
        end
end)


How it looks like:

ef1e54e7d3b714699296f802ce4dfbcb.png
  • 5




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users