DxDrawTexture

From GT-MP
Jump to: navigation, search
DxDrawTexture
Client-Side Function
System-users.png Client-Side Javascript.png JavaScript

This method draws a custom graphic to the screen using DirectX. File has to be included in the meta.xml file so that clients can download the image in order to view it by this function.

Needs to be called inside the client onUpdate event.

Syntax

In Javascript
Client-Side Function

API.dxDrawTexture(string path, Point pos, Size size, double rotation = 0.0);

Required Arguments

  • path: parameter input should be in string type, and is the path to a local image file in the resource.
  • pos: parameter input should be in Point type.
  • size: parameter input should be in Size type.
  • rotation: parameter input should be in double type, and is optional. A value of 90 would rotate the image 90 degrees clockwise on the screen.

Usage example(s)

This example is given that you have an image (img.png) saved under "Images/" folder in your project and it is included in the meta.xml file. Simply turn "isEnabled" to true to display it. The picture will be printed out to the left side of the screen.

In Javascript
Client-Side Function

var isEnabled = false;

API.onUpdate.connect(function () {
	if (isEnabled) {
		API.dxDrawTexture("Images/img.png", new Point(300, 300), new Size(300, 200));
	}
});


References