Module 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.
Index¶
Data
Empty objects for use when creating framebuffers with no parents. |
Function
Creates a new framebuffer object. |
|
Creates a new window object. |
API Reference¶
-
system.framebuffer.empty:
table¶ Empty objects for use when creating framebuffers with no parents.
-
system.framebuffer.window(
parent:GFXTerminal|Terminal,
x:number,
y:number,
width:number,
height:number
): (result:GFXTerminal|Terminal)¶ Creates a new window object.
- Parameters:
parent (
GFXTerminal|Terminal) – The parent object to render tox (
number) – The X coordinate in the parent to start aty (
number) – The Y coordinate in the parent to start atwidth (
number) – The width of the windowheight (
number) – The height of the window
- Returns:
result (
GFXTerminal|Terminal) – The new window object
-
system.framebuffer.framebuffer(
parent:GFXTerminal|Terminal,
wx:number|nil,
wy:number|nil,
w:number,
h:number,
visible?:boolean,
transparency?:boolean
): (result:GFXTerminal|Terminal)¶ Creates a new framebuffer object.
- Parameters:
parent (
GFXTerminal|Terminal) – The parent object to render to, or a member ofemptyto not use a parentwx (
number|nil) – The X coordinate in the parent to start at (nilif there’s no parent)wy (
number|nil) – The Y coordinate in the parent to start at (nilif there’s no parent)w (
number) – The width of the framebufferh (
number) – The height of the framebuffervisible? (
boolean) – Whether the window should be visible upon creationtransparency? (
boolean) – Whether the window should support transparency (i.e. replaces space colors with the color behind it)
- Returns:
result (
GFXTerminal|Terminal) – The new framebuffer object