Library

immediate

table

Immediate-mode drawing primitives backed by the overlay renderer. Submit filled shapes, outlines, lines, text and images each frame; the surface clears between frames.

Functions

7

#immediate.circle(center: Vector2 | Vector3, radii: number, filled: boolean, outlined: boolean, color: Color4) → boolean

since 1.6.15-alpha

Draws a circle. Must be used inside RunService.PreRender. Returns true if the circle was successfully rendered, false if rendering failed.

Parameters

centerVector2 | Vector3

The center of the circle.

radiinumber

The radius of the circle.

filledboolean

Whether the circle is filled.

outlinedboolean

Whether the circle is rendered with an outline

colorColor4

The color of the circle

#immediate.line(startPoint: Vector2 | Vector3, endPoint: Vector2 | Vector3, thickness: number, outlined: boolean, color: Color4) → boolean

since 1.6.15-alpha

Draws a Line from one point to another. Must be used inside RunService.PreRender. Returns true if the line was successfully rendered, false if rendering failed.

Parameters

startPointVector2 | Vector3

The start point of the line

endPointVector2 | Vector3

The end point of the line

thicknessnumber

The thickness of the line

outlinedboolean

Whether the line is rendered with an outline

colorColor4

The color of the line

#immediate.rectangle(topLeft: Vector2 | Vector3, bottomRight: Vector2 | Vector3, roundness: number, filled: boolean, outlined: boolean, color: Color4) → boolean

since 1.6.15-alpha

Draws a rectangle. Must be used inside RunService.PreRender. Returns true if the rectangle was successfully rendered, false if rendering failed.

Parameters

topLeftVector2 | Vector3

The top left of the rectangle.

bottomRightVector2 | Vector3

The bottom right of the rectangle.

roundnessnumber

The roundness of the rectangle.

filledboolean

Whether the rectangle is filled.

outlinedboolean

Whether the rectangle is rendered with an outline

colorColor4

The color of the rectangle

#immediate.text(topLeft: Vector2 | Vector3, text: string, fontDescriptor: FontDescriptor, outlined: boolean, color: Color4) → boolean

since 1.6.15-alpha

Draws text given a custom font. Must be used inside RunService.PreRender. Returns true if the text was successfully rendered, false if rendering failed.

Parameters

topLeftVector2 | Vector3

The top left origin of the text.

textstring

The text to render.

fontDescriptorFontDescriptor

The descriptor.

outlinedboolean

Whether the text is rendered with an outline

colorColor4

The color of the text

#immediate.calculate_text_size(text: string, fontDescriptor: FontDescriptor) → Vector2

since 1.6.15-alpha

Measures the pixel size a string would occupy if it were drawn with the given font, without actually rendering anything. Must be used inside RunService.PreRender.

Parameters

textstring

The text to measure.

fontDescriptorFontDescriptor

The font the text would be drawn with.

#immediate.image(image: Image, topLeft: Vector2 | Vector3, bottomRight: Vector2 | Vector3, tint: Color4?, rounding: number?) → boolean

since 1.7.5-alpha

Draws an image obtained from the image library inside a rectangular region. Must be used inside RunService.PreRender. Returns true if the image was successfully rendered, false if the image was invalid or the projection failed.

Parameters

imageImage

The image handle to draw.

topLeftVector2 | Vector3

The top-left of the destination rectangle.

bottomRightVector2 | Vector3

The bottom-right of the destination rectangle.

tintColor4?

Optional tint color multiplied with the texture. Defaults to opaque white.

roundingnumber?

Optional corner rounding in pixels. Defaults to 0 (no rounding).

#immediate.convex_poly_filled(points: { Vector2 }, color: Color4) → boolean

since 1.8.3-free

Fills a convex polygon. Must be used inside RunService.PreRender. The point list must already describe a convex polygon (see the convex_hull helpers in the Luau convex_hull library); ImGui does not re-validate convexity, so a non-convex input renders incorrectly. Returns true if the polygon was successfully rendered, false if the input had fewer than three points.

Parameters

points{ Vector2 }

Ordered convex polygon vertices in screen space.

colorColor4

Fill color.