Render
This is the render module for Basalt. It tries to mimic the functionality of the term
API. but with additional functionality. It also has a buffer system to reduce the number of calls
Fields
Field | Type | Description |
---|---|---|
terminal | table | The terminal object to render to |
width | number | The width of the render |
height | number | The height of the render |
buffer | table | The buffer to render |
xCursor | number | The x position of the cursor |
yCursor | number | The y position of the cursor |
blink | boolean | Whether the cursor should blink |
Functions
Method | Returns | Description |
---|---|---|
Render.new | Render | |
Render:addDirtyRect | Render | |
Render:bg | Render | |
Render:bg | Render | |
Render:blit | Render | |
Render:clear | Render | |
Render:clearArea | Render | |
Render:fg | Render | |
Render:fg | Render | |
Render:getSize | number, | |
Render:mergeRects | Render | |
Render:multiBlit | Render | |
Render:rectOverlaps | boolean | |
Render:render | Render | |
Render:setCursor | Render | |
Render:setSize | Render | |
Render:text | Render | |
Render:text | Render | |
Render:textBg | Render | |
Render:textFg | Render |
Render.new(terminal)
Creates a new Render object
Parameters
terminal
table
The terminal object to render to
Returns
nil
nil
nil
Render:addDirtyRect(x, y, width, height)
Adds a dirty rectangle to the buffer
Parameters
x
number
The x position of the rectangley
number
The y position of the rectanglewidth
number
The width of the rectangleheight
number
The height of the rectangle
Returns
nil
nil
nil
Render:bg(x, y, bg)
Blits a background color to the screen
Parameters
x
number
The x positiony
number
The y positionbg
string
The background color to blit
Returns
nil
nil
nil
Render:bg(x, y, bg)
Blits a background color to the screen
Parameters
x
number
The x positiony
number
The y positionbg
string
The background color to blit
Returns
nil
nil
nil
Render:blit(x, y, text, fg, bg)
Blits text to the screen
Parameters
x
number
The x position to blit toy
number
The y position to blit totext
string
The text to blitfg
string
The foreground color of the textbg
string
The background color of the text
Returns
nil
nil
nil
Render:clear(bg)
Clears the screen
Parameters
bg
colors
The background color to clear the screen with
Returns
nil
nil
nil
Render:clearArea(x, y, width, height, bg)
Clears an area of the screen
Parameters
x
number
The x position of the areay
number
The y position of the areawidth
number
The width of the areaheight
number
The height of the areabg
colors
The background color to clear the area with
Returns
nil
nil
nil
Render:fg(x, y, fg)
Blits a foreground color to the screen
Parameters
x
number
The x positiony
number
The y positionfg
string
The foreground color to blit
Returns
nil
nil
nil
Render:fg(x, y, fg)
Blits a foreground color to the screen
Parameters
x
number
The x positiony
number
The y positionfg
string
The foreground color to blit
Returns
nil
nil
nil
Render:getSize()
Gets the size of the render
Returns
nil
nil
nil
Render:mergeRects(target, source)
Merges two rectangles
Parameters
target
table
The target rectanglesource
table
The source rectangle
Returns
nil
nil
nil
Render:multiBlit(x, y, width, height, text, fg, bg)
Blits text to the screen with multiple lines
Parameters
x
number
The x position to blit toy
number
The y position to blit towidth
number
The width of the textheight
number
The height of the texttext
string
The text to blitfg
colors
The foreground color of the textbg
colors
The background color of the text
Returns
nil
nil
nil
Render:rectOverlaps(r1, r2)
Checks if two rectangles overlap
Parameters
r1
table
The first rectangler2
table
The second rectangle
Returns
nil
nil
nil
Render:render()
Renders the buffer to the screen
Returns
nil
nil
nil
Render:setCursor(x, y, blink)
Sets the cursor position
Parameters
x
number
The x position of the cursory
number
The y position of the cursorblink
boolean
Whether the cursor should blink
Returns
nil
nil
nil
Render:setSize(width, height)
Sets the size of the render
Parameters
width
number
The width of the renderheight
number
The height of the render
Returns
nil
nil
nil
Render:text(x, y, text)
Blits text to the screen
Parameters
x
number
The x position to blit toy
number
The y position to blit totext
string
The text to blit
Returns
nil
nil
nil
Render:text(x, y, text)
Renders the text to the screen
Parameters
x
number
The x position to blit toy
number
The y position to blit totext
string
The text to blit
Returns
nil
nil
nil
Render:textBg(x, y, text, bg)
Blits text to the screen with a background color
Parameters
x
number
The x position to blit toy
number
The y position to blit totext
string
The text to blitbg
colors
The background color of the text
Returns
nil
nil
nil
Render:textFg(x, y, text, fg)
Blits text to the screen with a foreground color
Parameters
x
number
The x position to blit toy
number
The y position to blit totext
string
The text to blitfg
colors
The foreground color of the text
Returns
nil
nil
nil