4.4 KiB
4.4 KiB
BaseFrame
This is the base frame class. It is the root element of all elements and the only element without a parent.
Extends: Container
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| term | term | peripheral | term.current() |
Functions
| Method | Returns | Description |
|---|---|---|
| BaseFrame.new | BaseFrame | Creates a new Frame instance |
| BaseFrame:init | table | Initializes the Frame instance |
| BaseFrame:multiBlit | - | Renders a multiBlit to the render Object |
| BaseFrame:textFg | - | Renders a text with a foreground color to the render Object |
| BaseFrame:textBg | - | Renders a text with a background color to the render Object |
| BaseFrame:drawText | - | Renders a text with a background color to the render Object |
| BaseFrame:blit | - | Renders a text with a foreground and background color to the render Object |
| BaseFrame:setCursor | - | Sets the cursor position |
| BaseFrame:monitor_touch | - | Handles monitor touch events |
| BaseFrame:mouse_click | - | Handles mouse click events |
| BaseFrame:mouse_up | - | Handles mouse up events |
| BaseFrame:term_resize | - | Resizes the Frame |
| BaseFrame:key | - | Handles key events |
| BaseFrame:key_up | - | Handles key up events |
| BaseFrame:char | - | Handles character events |
| BaseFrame:render | - | Renders the Frame |
BaseFrame.new()
Creates a new Frame instance
Returns
BaseFrameobjectThe newly created Frame instance
Usage
local element = BaseFrame.new()
BaseFrame:init(props, basalt)
Parameters
propstableThe properties to initialize the element withbasalttableThe basalt instance
Returns
tableselfThe initialized instance
BaseFrame:multiBlit(x, y, width, height, text, fg, bg)
Parameters
xnumberThe x position to render toynumberThe y position to render towidthnumberThe width of the textheightnumberThe height of the texttextstringThe text to renderfgstringThe foreground colorbgstringThe background color
BaseFrame:textFg(x, y, text, fg)
Parameters
xnumberThe x position to render toynumberThe y position to render totextstringThe text to renderfgcolorsThe foreground color
BaseFrame:textBg(x, y, text, bg)
Parameters
xnumberThe x position to render toynumberThe y position to render totextstringThe text to renderbgcolorsThe background color
BaseFrame:drawText(x, y, text, bg)
Parameters
xnumberThe x position to render toynumberThe y position to render totextstringThe text to renderbgcolorsThe background color
BaseFrame:blit(x, y, text, fg, bg)
Parameters
xnumberThe x position to render toynumberThe y position to render totextstringThe text to renderfgstringThe foreground colorbgstringThe background color
BaseFrame:setCursor(x, y, blink)
Sets the cursor position
Parameters
xnumberThe x position to set the cursor toynumberThe y position to set the cursor toblinkbooleanWhether the cursor should blink
BaseFrame:monitor_touch(name, x, y)
Parameters
namestringThe name of the monitor that was touchedxnumberThe x position of the mouseynumberThe y position of the mouse
BaseFrame:mouse_click(button, x, y)
Parameters
buttonnumberThe button that was clickedxnumberThe x position of the mouseynumberThe y position of the mouse
BaseFrame:mouse_up(button, x, y)
Parameters
buttonnumberThe button that was releasedxnumberThe x position of the mouseynumberThe y position of the mouse
BaseFrame:term_resize()
BaseFrame:key(key)
Parameters
keynumberThe key that was pressed
BaseFrame:key_up(key)
Parameters
keynumberThe key that was released
BaseFrame:char(char)
Parameters
charstringThe character that was pressed