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

Empty objects for use when creating framebuffers with no parents.

Function

framebuffer()

Creates a new framebuffer object.

window()

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 to

  • x (number) – The X coordinate in the parent to start at

  • y (number) – The Y coordinate in the parent to start at

  • width (number) – The width of the window

  • height (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 of empty to not use a parent

  • wx (number | nil) – The X coordinate in the parent to start at (nil if there’s no parent)

  • wy (number | nil) – The Y coordinate in the parent to start at (nil if there’s no parent)

  • w (number) – The width of the framebuffer

  • h (number) – The height of the framebuffer

  • visible? (boolean) – Whether the window should be visible upon creation

  • transparency? (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