system.framebuffer
The framebuffer library provides functions to make “window” and “framebuffer” objects. These objects imitate a Terminal object (as returned by @{system.terminal.openterm}) or GFXTerminal object (as returned by @{system.terminal.opengfx}) that may or may not draw to a parent object. Windows and framebuffers may be used as parents to other windows and framebuffers, in addition to the root terminal object.
A framebuffer object holds its own state, can be redrawn onto the parent terminal even if the parent is changed, can be removed from the parent and used independently, and its contents can be accessed from code. A window object simply changes the coordinates of writing methods, and is entirely dependent on the parent.
The type of object returned by each function is dependent on the parent passed in. If a Terminal object is passed, a Terminal object is created; if a GFXTerminal object is passed, a GFXTerminal object is created. When creating a framebuffer with no parent, the @{empty} fields are used to specify the type.
window(parent: Terminal|GFXTerminal, x: number, y: number, width: number, height: number): Terminal|GFXTerminal
Creates a new window object.
Arguments
parent
: The parent object to render tox
: The X coordinate in the parent to start aty
: The Y coordinate in the parent to start atwidth
: The width of the windowheight
: The height of the window
Return Values
The new window object
framebuffer(parent: Terminal|GFXTerminal, wx: number|nil, wy: number|nil, w: number, h: number, visible: boolean?, transparency: boolean?): Terminal|GFXTerminal
Creates a new framebuffer object.
Arguments
parent
: The parent object to render to, or a member of empty to not use a parentwx
: The X coordinate in the parent to start at (nil
if there’s no parent)wy
: The Y coordinate in the parent to start at (nil
if there’s no parent)w
: The width of the framebufferh
: The height of the framebuffervisible
: Whether the window should be visible upon creation (optional)transparency
: Whether the window should support transparency (i.e. replaces space colors with the color behind it) (optional)
Return Values
The new framebuffer object
empty
Empty objects for use when creating framebuffers with no parents.
Fields
text
: Used to create a text mode Terminal framebuffergraphics
: Used to create a graphics mode GFXTerminal framebuffer