graphics

2D Graphics Library If any method asks for a colour, it will accept blit colours (0123456789abcdef), or colours.black colours.

new_polygon(Points, number, number)Instantiate a new Polygon object.
new(obj_type, options)Create a new graphics object, with specified options.
new_polygon(Points, number, number)Source

Instantiate a new Polygon object.

Parameters

  1. Points points a list of points that the polygon takes
  2. number edge_colour The edge colour of the polygon
  3. number fill_colour The fill colour of the polygon, -1 for transparent

Returns

  1. Polygon the new polygon object.
new(obj_type, options)Source

Create a new graphics object, with specified options.

  • @tparam string obj_type The object type to create
  • @tparam table options Options to create the object with.
  • @treturn Object The resulting object

Parameters

  1. obj_type
  2. options

Types

Points

Polygon

Polygon.SuperSource

Object superclass

  • @type table Object
  • The field "children" is a list of other Object subclasses.
  • The field "listeners" is a list of string:array pairs, where the string is the event name, and the array is a list of functions to call.
  • The only arguments to the function is (object, event) where event is a numerical table of all of the event properties.
  • The field "disabled" is a boolean for whether or not listeners should be called.
  • The field "id" is the objects unique identifier, for use with the children attribute.
  • The field "parent" is another Object which is the parent of this. It is used for offsetting the origin in draw calls.
new()
test_hit(x/y)Test a hit point on the object, and its children.
_child_index(obj)
append_child(obj)Add a child to this object.
remove_child(obj)
draw(win)
real_origin()Recursively follows the parent origin, until we reach the top-most element.
add_event_listener(event, listener)
remove_event_listener(event, listener)
call_event_listeners(event)
mouse_loop(monitor)An infinite loop that checks for mouse_click, mouse_drag, and mouse_up events, and passes them into the test_hit function.
new()Source
test_hit(x/y)Source

Test a hit point on the object, and its children. In a normal Object, it just calls the test hit on its children, and return the child or false. Other objects should implement this method with something like a bounding box test.

Parameters

  1. x/y Point coordinate to test.
_child_index(obj)Source

Parameters

  1. obj
append_child(obj)Source

Add a child to this object.

Parameters

  1. obj Object The child to add
remove_child(obj)Source

Parameters

  1. obj
draw(win)Source

Parameters

  1. win
real_origin()Source

Recursively follows the parent origin, until we reach the top-most element. Returns the real coordinates of the relative origins.

add_event_listener(event, listener)Source

Parameters

  1. event
  2. listener
remove_event_listener(event, listener)Source

Parameters

  1. event
  2. listener
call_event_listeners(event)Source

Parameters

  1. event
mouse_loop(monitor)Source

An infinite loop that checks for mouse_click, mouse_drag, and mouse_up events, and passes them into the test_hit function.

Parameters

  1. monitor
Polygon.draw(Terminal)Source

Draw the polygon to the designated terminal object

Parameters

  1. Terminal table object

progress

Progress bar object

progress.SuperSource

Object superclass

  • @type table Object
  • The field "children" is a list of other Object subclasses.
  • The field "listeners" is a list of string:array pairs, where the string is the event name, and the array is a list of functions to call.
  • The only arguments to the function is (object, event) where event is a numerical table of all of the event properties.
  • The field "disabled" is a boolean for whether or not listeners should be called.
  • The field "id" is the objects unique identifier, for use with the children attribute.
  • The field "parent" is another Object which is the parent of this. It is used for offsetting the origin in draw calls.
new()
test_hit(x/y)Test a hit point on the object, and its children.
_child_index(obj)
append_child(obj)Add a child to this object.
remove_child(obj)
draw(win)
real_origin()Recursively follows the parent origin, until we reach the top-most element.
add_event_listener(event, listener)
remove_event_listener(event, listener)
call_event_listeners(event)
mouse_loop(monitor)An infinite loop that checks for mouse_click, mouse_drag, and mouse_up events, and passes them into the test_hit function.
new()Source
test_hit(x/y)Source

Test a hit point on the object, and its children. In a normal Object, it just calls the test hit on its children, and return the child or false. Other objects should implement this method with something like a bounding box test.

Parameters

  1. x/y Point coordinate to test.
_child_index(obj)Source

Parameters

  1. obj
append_child(obj)Source

Add a child to this object.

Parameters

  1. obj Object The child to add
remove_child(obj)Source

Parameters

  1. obj
draw(win)Source

Parameters

  1. win
real_origin()Source

Recursively follows the parent origin, until we reach the top-most element. Returns the real coordinates of the relative origins.

add_event_listener(event, listener)Source

Parameters

  1. event
  2. listener
remove_event_listener(event, listener)Source

Parameters

  1. event
  2. listener
call_event_listeners(event)Source

Parameters

  1. event
mouse_loop(monitor)Source

An infinite loop that checks for mouse_click, mouse_drag, and mouse_up events, and passes them into the test_hit function.

Parameters

  1. monitor
progress.new(options)Source

Parameters

  1. options
progress:_blit_line_right(width, value, mode)Source

Parameters

  1. width
  2. value
  3. mode
progress.draw(win)Source

Draw the progress bar

Parameters

  1. win table The window object to draw to.