BaseFrame
extends Container
BaseFrame: the root of a UI tree, bound to a terminal. Owns the render buffer, keyboard focus and mouse capture state.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| background | number | colors.black | Background color (false = transparent) |
Methods
BaseFrame:setup()
Initializes a new BaseFrame instance.
BaseFrame:isKeyDown(keyCode)
Returns whether a keyboard key is currently held down.
keyCode (
number) ComputerCraft key codereturns down (
boolean)
BaseFrame:setTerm(t)
Binds the root frame to a terminal-like object and resizes its buffer.
t (
table) Terminal or monitor redirectreturns (
self)
BaseFrame:draw()
Redraws the whole tree into the buffer if anything changed, then flushes the line diff to the terminal.
BaseFrame:setFocused(el)
Moves keyboard focus to an element, or clears it with nil.
- el (
Element, optional) New focused element
BaseFrame:setCursor(x, y, blink, color)
Applies a cursor request from a focused element (absolute coordinates). Forwards an absolute cursor request to the render buffer.
x (
number) Absolute x coordinatey (
number) Absolute y coordinateblink (
boolean) Cursor blink statecolor (
number, optional) Cursor colorreturns (
self)
BaseFrame:getFocused()
Returns the element that currently owns keyboard focus.
- returns element (
Element|nil)
BaseFrame:handleEvent(event, a, b, c)
Entry point for raw CC events, called by the runtime. Dispatches one raw ComputerCraft event into this frame.
- event (
string) Event name - a (
any) First event argument - b (
any) Second event argument - c (
any) Third event argument
BaseFrame:cleanup()
Restores the terminal (palette, colors, cursor).