Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Tuners
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    2. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    3. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    4. Bugs*

    1. Grand Theft Auto Series

      1. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    6. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

      1. GTANet 20th Anniversary
    2. Support

    3. Suggestions

How to use UI.DrawTexture ?


Amey.Banaye
 Share

Recommended Posts

Amey.Banaye

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

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

Amey.Banaye

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

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

  • 4 weeks later...
GeorgeZhang
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

Pandassaurus
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 by Pandassaurus
Link to comment
Share on other sites

GeorgeZhang

 

 

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!

thanks man, you made it so clear, gonna test it out.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.