Documentation

Want to improve the docs? Take a look at scripting-api-data!
Found a bug? jc3mp/bugs is a good place to let us know.

Renderer

Constructible This class can be instantiated from your script. You can find more information on the Constructor below. 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

This class currently lacks documentation for the constructor.

Properties

Name Type Description
viewportSize Vector2f read only
dtf number read only

Functions

Renderer.EnableCulling(boolean enabled)

Parameter

Name Type Description
enabled boolean Enables or disables culling.

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

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 Text color

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

Draws a rectangle (behaves similarly to DrawText).

Parameter

Name Type Description
start [Vector3f, Vector2f] Start position
end [Vector3f, Vector2f] End position
color RGBA Text 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

Renderer.WorldToScreen(Vector3f p1)

returns: Vector2f

Parameter

Name Type Description
p1 Vector3f

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.