Module: Oil

Oil.setup () Call in your setup function to initialise the Oil UI library.
Oil.beginDraw () Call at the start of your draw() function to ensure that rendering is done to Oil's internal framebuffer.
Oil.endDraw () Call at the end of your draw() function to ensure that UI is processed and rendered to the screen.
Oil.sizeChanged (w, h) Should be called by the user when the window dimensions change.
Oil.label (x, y, w, h, label, align)
Oil.labelResize (x, y, w, h, label, align)
Oil.Rect (x, y, w, h, color, radius, blur)
Oil.Icon (x, y, w, h, texture)
Oil.TextButton (x, y, w, h, label, cb, press_cb)
Oil.EmojiButton (x, y, w, h, emoji, cb, press_cb)
Oil.IconButton (x, y, w, h, texture, cb, press_cb)
Oil.HorizontalStack (x, y, w, h) Spreads children along it's width.
Oil.VerticalStack (x, y, w, h) Spreads children along it's height.
Oil.Scroll (x, y, w, h)
Oil.Switch (x, y, callback, default)
Oil.Slider (x, y, w, h, min, max, callback, default)
Oil.List (x, y, w)
Oil.Dropdown (x, y, w, h, label, max_size)
Oil.TextEntry (x, y, w, h, default_text, callback)
Oil.Alert (msg, cb, style_sheet, style_sheet_button)
Oil.StatusModal (msg, style_sheet)

Class: Oil.Node

Oil.Node (x, y, w, h, priority) Node constructor.
Node:set_style (style_or_key, value)
Node:add_style (style_or_key, value)
Node:set_style_sheet (style_sheet)
Node:get_style (key)
Node:set_priority (p)
Node:add_child (child, sort)
Node:add_children (...)
Node:add_pre_updater (updater) Registers the function 'updater' as an update function.
Node:add_updater (updater) Registers the function 'updater' as an update function.
Node:add_renderer (renderer) Registers the function 'renderer' as a render function.
Node:add_handler (handler) Registers the function 'handler' as an event handler.
Node:remove_child (child) Removes a child from this node.
Node:remove_pre_updater (updater) Removes a pre-updater from this node.
Node:remove_updater (updater) Removes an updater from this node.
Node:remove_renderer (renderer) Removes an renderer from this node.
Node:remove_handler (handler) Removes a handler from this node.
Node:kill () Removes the node from its parent.
Node:set_debug_name (name) Sets the debug name.
Node:get_debug_name () Gets a debug name if it's available.

Module: Oil

Entry to the Oil UI library.
Oil.setup ()
Call in your setup function to initialise the Oil UI library.
Oil.beginDraw ()
Call at the start of your draw() function to ensure that rendering is done to Oil's internal framebuffer. This must be done to ensure that gaussian blur can correctly be applied to elements rendered outside of the Oil library.

Usage:

  • function draw()
        Oil.beginDraw()
    
        background(64) -- render a grey background.
    
        -- Other user rendering here
    
        Oil.endDraw()
    end
Oil.endDraw ()
Call at the end of your draw() function to ensure that UI is processed and rendered to the screen.

Usage:

  • function draw()
        Oil.beginDraw()
    
        background(64) -- render a grey background.
    
        -- Other user rendering here
    
        Oil.endDraw()
    end
Oil.sizeChanged (w, h)
Should be called by the user when the window dimensions change.
Usually called from within Codea's sizeChanged() callback function.

Parameters:

  • w New width
  • h New height

Usage:

  • function sizeChanged(w, h)
        Oil.sizeChanged(w, h) -- Update Oil with new sizes
    end
Oil.label (x, y, w, h, label, align)
Oil.labelResize (x, y, w, h, label, align)
Oil.Rect (x, y, w, h, color, radius, blur)
Oil.Icon (x, y, w, h, texture)
Oil.TextButton (x, y, w, h, label, cb, press_cb)
Oil.EmojiButton (x, y, w, h, emoji, cb, press_cb)
Oil.IconButton (x, y, w, h, texture, cb, press_cb)
Oil.HorizontalStack (x, y, w, h)
Spreads children along it's width.
Oil.VerticalStack (x, y, w, h)
Spreads children along it's height.
Children must use pixel heights.
Oil.Scroll (x, y, w, h)
Oil.Switch (x, y, callback, default)
Oil.Slider (x, y, w, h, min, max, callback, default)
Oil.List (x, y, w)
Oil.Dropdown (x, y, w, h, label, max_size)
Oil.TextEntry (x, y, w, h, default_text, callback)
Oil.Alert (msg, cb, style_sheet, style_sheet_button)
Oil.StatusModal (msg, style_sheet)

Class: Oil.Node

Core UI element used in Oil. All UI elements inherit this class.
Oil.Node (x, y, w, h, priority)
Node constructor.
Node:set_style (style_or_key, value)
Node:add_style (style_or_key, value)
Node:set_style_sheet (style_sheet)
Node:get_style (key)
Node:set_priority (p)
Node:add_child (child, sort)
Node:add_children (...)
Node:add_pre_updater (updater)
Registers the function 'updater' as an update function.
that will be called every frame (when the node is enabled)
Pre-Updaters are called before calculating the frame.
Node:add_updater (updater)
Registers the function 'updater' as an update function.
that will be called every frame (when the node is enabled)
Node:add_renderer (renderer)
Registers the function 'renderer' as a render function.
that will be called every frame (when the node is enabled & displayed on-screen)
Node:add_handler (handler)
Registers the function 'handler' as an event handler.
Node:remove_child (child)
Removes a child from this node.
Node:remove_pre_updater (updater)
Removes a pre-updater from this node.
Node:remove_updater (updater)
Removes an updater from this node.
Node:remove_renderer (renderer)
Removes an renderer from this node.
Node:remove_handler (handler)
Removes a handler from this node.
Node:kill ()
Removes the node from its parent.
Use this to delete nodes
Node:set_debug_name (name)
Sets the debug name.
Node:get_debug_name ()
Gets a debug name if it's available.
Generated by Codea+ AutoDoc Last updated Tue May 10 08:07:47 2022