Amey.Banaye Posted July 13, 2015 Share Posted July 13, 2015 The latest update of scripthook.net includes method called UI.DrawTexture() Does anyone knows how to use it ? Link to comment Share on other sites More sharing options...
GRANDHEIST Posted July 13, 2015 Share Posted July 13, 2015 Dont have .net but Ragehook has similar function, where you must subscribe your own method to Game.FrameRender (dont know what this is in the .net) it works like this: Game.FrameRender += YourOwnMethod; and YourOwnMethod: public static void YourOwnMethod(object sender, GraphicEventArgs e) <--- (these parameters have to be same as Game.Framerender) { UI.DrawTexture(parameters); } Or is the parameter part what is unclear to you? Link to comment Share on other sites More sharing options...
Amey.Banaye Posted July 13, 2015 Author Share Posted July 13, 2015 Dont have .net but Ragehook has similar function, where you must subscribe your own method to Game.FrameRender (dont know what this is in the .net) it works like this: Game.FrameRender += YourOwnMethod; and YourOwnMethod: public static void YourOwnMethod(object sender, GraphicEventArgs e) <--- (these parameters have to be same as Game.Framerender) { UI.DrawTexture(parameters); } Or is the parameter part what is unclear to you? The parameters part too . Link to comment Share on other sites More sharing options...
CamxxCore Posted July 13, 2015 Share Posted July 13, 2015 The latest update of scripthook.net includes method called UI.DrawTexture() Does anyone knows how to use it ? Fortunately the parameters are well documented in the scripthook sdk in main.h: // Draw texture// id - texture id recieved from createTexture()// index - each texture can have up to 64 different instances on screen at one time// level - draw level, being used in global draw order, texture instance with least level draws first// time - how much time (ms) texture instance will stay on screen, the amount of time should be enough// for it to stay on screen until the next corresponding drawTexture() call// sizeX,Y - size in screen space, should be in the range from 0.0 to 1.0, e.g setting this to 0.2 means that// texture instance will take 20% of the screen space// centerX,Y - center position in texture space, e.g. 0.5 means real texture center// posX,Y - position in screen space, [0.0, 0.0] - top left corner, [1.0, 1.0] - bottom right,// texture instance is positioned according to it's center// rotation - should be in the range from 0.0 to 1.0// screenHeightScaleFactor - screen aspect ratio, used for texture size correction, you can get it using natives// r,g,b,a - color, should be in the range from 0.0 to 1.0//// Texture instance draw parameters are updated each time script performs corresponding call to drawTexture()// You should always check your textures layout for 16:9, 16:10 and 4:3 screen aspects, for ex. in 1280x720,// 1440x900 and 1024x768 screen resolutions, use windowed mode for this// Can be called only in the same thread as natives Link to comment Share on other sites More sharing options...
GeorgeZhang Posted August 7, 2015 Share Posted August 7, 2015 UI.DrawTexture(string filename, int index, int level, int time, Point pos, Size size, float rotation, Color color); What is "file name"? Where do I find textures to draw? Can I draw weapon icons or radar blips? Can someone help please Link to comment Share on other sites More sharing options...
Pandassaurus Posted August 9, 2015 Share Posted August 9, 2015 (edited) UI.DrawTexture(string filename, int index, int level, int time, Point pos, Size size, float rotation, Color color); What is "file name"? Where do I find textures to draw? Can I draw weapon icons or radar blips? Can someone help please Sure. filename The filename is the directory to the file. What I use is String texture= AppDomain.CurrentDomain.BaseDirectory + "\\textureName.png"; AppDomain.CurrentDomain.BaseDirectory is the directory where the mod is (basically the path to your scripts folder), so you add the name of the file at the end. I made my own textures, and put them in there. index The way this function works is it just draws the image you want on screen. You can change the index to set what gets rendered in front of it (lower indexes get higher render preference, meaning they'll show up in front). time Time is just how long it will show up, which should be set to about 100 or less if you want to call it every tick and keep it on screen. pos and size For the pos and size, i really couldn't figure out what the numbers meant. The documentation is wrong, as Size and Point take ints, so you can't do 1.0 or .2, so I just changed them until they looked right, and for the center of the screen got numbers like 618 and 330 (keep in mind, if you hard code the pos, you're going to have to change it if the screen resolution changes). I think that size is width by height in pixels, but i could be wrong. I havent really messed with the other ones, but I'm guessing that rotation is in degrees, and color overlays the whole image with a certain color? Good Luck! Edited August 9, 2015 by Pandassaurus Link to comment Share on other sites More sharing options...
GeorgeZhang Posted August 9, 2015 Share Posted August 9, 2015 UI.DrawTexture(string filename, int index, int level, int time, Point pos, Size size, float rotation, Color color);What is "file name"? Where do I find textures to draw? Can I draw weapon icons or radar blips? Can someone help please Sure.filenameThe filename is the directory to the file. What I use isString texture= AppDomain.CurrentDomain.BaseDirectory + "\\textureName.png";AppDomain.CurrentDomain.BaseDirectory is the directory where the mod is (basically the path to your scripts folder), so you add the name of the file at the end. I made my own textures, and put them in there. indexThe way this function works is it just draws the image you want on screen. You can change the index to set what gets rendered in front of it (lower indexes get higher render preference, meaning they'll show up in front).timeTime is just how long it will show up, which should be set to about 100 or less if you want to call it every tick and keep it on screen.pos and sizeFor the pos and size, i really couldn't figure out what the numbers meant. The documentation is wrong, as Size and Point take ints, so you can't do 1.0 or .2, so I just changed them until they looked right, and for the center of the screen got numbers like 618 and 330 (keep in mind, if you hard code the pos, you're going to have to change it if the screen resolution changes). I think that size is width by height in pixels, but i could be wrong. I havent really messed with the other ones, but I'm guessing that rotation is in degrees, and color overlays the whole image with a certain color? Good Luck!thanks man, you made it so clear, gonna test it out. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now