Lysa  0.0
Lysa 3D Engine
Vector2DRenderer Class Referenceabstract

Detailed Description

A GPU renderer that draws 2-D shapes, images, and text in normalized screen space (0–VECTOR_2D_SCREEN_SIZE).

Inherits from: Vector3DRenderer

Lua full name: lysa.Vector2DRenderer

Public Member Functions

nil draw_line (start: float2, end: float2)
 Draws a line between two 2-D screen-space points using the current pen color. More...
 
nil draw_rect (rect: Rect)
 Draws a filled rectangle using the current pen color. More...
 
nil draw_rect (rect: Rect, texture: integer)
 Draws a textured filled rectangle. More...
 
nil draw_rect (x: number, y: number, w: number, h: number, texture: integer)
 Draws a textured filled rectangle from x, y, w, h. More...
 
nil draw_circle (center: float2, radius: number, borderWidth: number?)
 Draws a circle using the current pen color. borderWidth defaults to 0, which fills the disc, otherwise only a border of that width is drawn. Rasterized by the fragment shader with an antialiased edge, the horizontal radius being corrected by the aspect ratio so the shape stays circular. More...
 
nil draw_circle (x: number, y: number, radius: number, borderWidth: number?)
 Draws a circle centered on x, y. More...
 
nil draw_rounded_rect (rect: Rect, cornerRadius: number, borderWidth: number?)
 Draws a rectangle with rounded corners using the current pen color. cornerRadius and borderWidth are clamped to half of the smallest side; borderWidth defaults to 0, which fills the rectangle. The corners stay circular whatever the aspect ratio. More...
 
nil draw_rounded_rect (rect: Rect, texture: integer, cornerRadius: number, borderWidth: number?)
 Draws a textured rectangle with rounded corners. More...
 
nil draw_rounded_rect (x: number, y: number, w: number, h: number, cornerRadius: number, borderWidth: number?, texture: integer?)
 Draws a rectangle with rounded corners from x, y, w, h, optionally textured. More...
 
nil set_pen_color (color: float4)
 Sets the current pen color (RGBA) used by subsequent draw calls. More...
 
nil set_translate (t: float2)
 Sets a 2-D translation offset applied to all subsequent draw calls in this renderer. More...
 
nil set_transparency (a: number)
 Sets the global alpha multiplier (0.0 = fully transparent, 1.0 = fully opaque) for subsequent draw calls. More...
 

Properties

number aspect_ratio
 Constructor: Vector2DRenderer(rt)
 

Member Function Documentation

nil draw_line ( float2  start,
float2  end)

Draws a line between two 2-D screen-space points using the current pen color.

Parameters
startfloat2
endfloat2
nil draw_rect ( Rect  rect)

Draws a filled rectangle using the current pen color.

Parameters
rectRect
nil draw_rect ( Rect  rect,
integer  texture)

Draws a textured filled rectangle.

Parameters
rectRect
textureinteger
nil draw_rect ( number  x,
number  y,
number  w,
number  h,
integer  texture)

Draws a textured filled rectangle from x, y, w, h.

Parameters
xnumber
ynumber
wnumber
hnumber
textureinteger
nil draw_circle ( float2  center,
number  radius,
number?  borderWidth)

Draws a circle using the current pen color. borderWidth defaults to 0, which fills the disc, otherwise only a border of that width is drawn. Rasterized by the fragment shader with an antialiased edge, the horizontal radius being corrected by the aspect ratio so the shape stays circular.

Parameters
centerfloat2
radiusnumber
borderWidthnumber?
nil draw_circle ( number  x,
number  y,
number  radius,
number?  borderWidth)

Draws a circle centered on x, y.

Parameters
xnumber
ynumber
radiusnumber
borderWidthnumber?
nil draw_rounded_rect ( Rect  rect,
number  cornerRadius,
number?  borderWidth)

Draws a rectangle with rounded corners using the current pen color. cornerRadius and borderWidth are clamped to half of the smallest side; borderWidth defaults to 0, which fills the rectangle. The corners stay circular whatever the aspect ratio.

Parameters
rectRect
cornerRadiusnumber
borderWidthnumber?
nil draw_rounded_rect ( Rect  rect,
integer  texture,
number  cornerRadius,
number?  borderWidth)

Draws a textured rectangle with rounded corners.

Parameters
rectRect
textureinteger
cornerRadiusnumber
borderWidthnumber?
nil draw_rounded_rect ( number  x,
number  y,
number  w,
number  h,
number  cornerRadius,
number?  borderWidth,
integer?  texture)

Draws a rectangle with rounded corners from x, y, w, h, optionally textured.

Parameters
xnumber
ynumber
wnumber
hnumber
cornerRadiusnumber
borderWidthnumber?
textureinteger?
nil set_pen_color ( float4  color)

Sets the current pen color (RGBA) used by subsequent draw calls.

Parameters
colorfloat4
nil set_translate ( float2  t)

Sets a 2-D translation offset applied to all subsequent draw calls in this renderer.

Parameters
tfloat2
nil set_transparency ( number  a)

Sets the global alpha multiplier (0.0 = fully transparent, 1.0 = fully opaque) for subsequent draw calls.

Parameters
anumber

Property Documentation

number aspect_ratio

Constructor: Vector2DRenderer(rt)