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
Polygonobject.Parameters
- Points
pointsa list of points that the polygon takes - number
edge_colourThe edge colour of the polygon - number
fill_colourThe fill colour of the polygon, -1 for transparent
Returns
Polygonthe new polygon object.
- Points
- 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
ObjectThe resulting object
Parameters
- obj_type
- 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, andmouse_upevents, 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
- x/y
Pointcoordinate to test.
- x/y
- _child_index(obj)Source
Parameters
- obj
- append_child(obj)Source
Add a child to this object.
Parameters
- obj
ObjectThe child to add
- obj
- remove_child(obj)Source
Parameters
- obj
- draw(win)Source
Parameters
- 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
- event
- listener
- remove_event_listener(event, listener)Source
Parameters
- event
- listener
- call_event_listeners(event)Source
Parameters
- event
- mouse_loop(monitor)Source
An infinite loop that checks for
mouse_click,mouse_drag, andmouse_upevents, and passes them into the test_hit function.Parameters
- monitor
- Polygon.draw(Terminal)Source
Draw the polygon to the designated terminal object
Parameters
- Terminal
tableobject
- Terminal
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, andmouse_upevents, 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
- x/y
Pointcoordinate to test.
- x/y
- _child_index(obj)Source
Parameters
- obj
- append_child(obj)Source
Add a child to this object.
Parameters
- obj
ObjectThe child to add
- obj
- remove_child(obj)Source
Parameters
- obj
- draw(win)Source
Parameters
- 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
- event
- listener
- remove_event_listener(event, listener)Source
Parameters
- event
- listener
- call_event_listeners(event)Source
Parameters
- event
- mouse_loop(monitor)Source
An infinite loop that checks for
mouse_click,mouse_drag, andmouse_upevents, and passes them into the test_hit function.Parameters
- monitor
- progress.new(options)Source
Parameters
- options
- progress:_blit_line_right(width, value, mode)Source
Parameters
- width
- value
- mode
- progress.draw(win)Source
Draw the progress bar
Parameters
- win
tableThe window object to draw to.
- win