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

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

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

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
Amey.Banaye

How to use UI.DrawTexture ?

Recommended Posts

Amey.Banaye

The latest update of scripthook.net includes method called UI.DrawTexture()

Does anyone knows how to use it ?

Share this post


Link to post
Share on other sites
GRANDHEIST

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? :)

Share this post


Link to post
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 .

Share this post


Link to post
Share on other sites
CamxxCore

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 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.