Documentation

Renderer

Constructible This class can not be instantiated from your script. Do not try to use the `new` keyword on this class. Auto Destroy Instances of this class will be deleted automatically. Custom Properties You cannot add your own properties to instances of this class. They will not be saved and can cause undefined behavior.

Constructor

Creates a new renderer. This method cannot be called directly. Instead, a Renderer object is only available in certain Render events.

Properties

Name Type Description
viewportSize Vector2f read only Screen dimensions
dtf number read only

Functions

Renderer.EnableCulling(boolean enable)

Enables or disables culling.

Parameter

Name Type Description
enable boolean true to enable culling, false otherwise.

Renderer.SetTransform(Matrix matrix)

Sets the matrix that describes the coordinate system the renderer is drawing to.

Parameter

Name Type Description
matrix Matrix The new transformation 4x4 matrix

Renderer.DrawText(string text, Vector3f position, Vector2f maxSize, RGBA color, number fontSize, string fontName)

Draws a text to the screen or world.

Parameter

Name Type Description
text string The text you want to draw
position Vector3f The position vector. Set the z-coordinate to 0.5 if you render to the screen.
maxSize Vector2f Maximum size
color RGBA Text color
fontSize number Font size
fontName string Font name (all Windows fonts are valid here)

Renderer.MeasureText(string text, number fontSize, string fontName)

Returns the physical dimensions of a text.

returns: Vector2f A vector describing width and height of the text.

Parameter

Name Type Description
text string Text
fontSize number Font size
fontName string Font name

Renderer.DrawRect([Vector3f, Vector2f] position, Vector2f size, RGBA color)

Draws a rectangle (behaves similarly to DrawText).

Parameter

Name Type Description
position [Vector3f, Vector2f] Position
size Vector2f Size
color RGBA Fill color

Renderer.DrawLine([Vector3f, Vector2f] start, [Vector3f, Vector2f] end, RGBA color)

Draws a line.

Parameter

Name Type Description
start [Vector3f, Vector2f] Start position
end [Vector3f, Vector2f] End position
color RGBA Color

Renderer.DrawTexture(Texture texture, [Vector3f, Vector2f] position, Vector2f] size)

Draws a texture object.

Parameter

Name Type Description
texture Texture The Texture to draw
position [Vector3f, Vector2f] Position
size Vector2f Size

Stay informed

By becoming the newest member of our growing forums, we and hundreds of other players will always keep you up to date on everything JC3:MP related.