Class GUI

Core class for the canvasGUI library

Use an instance of GUI (the controller) to control all aspects of your gui.

  • Create the UI controls e.g. buttons, sliders
  • Provides 7 color schemes for the controls

Hierarchy

  • GUI

Properties

_announced: boolean = false
_guis: {} = {}

Type declaration

    Methods

    • Returns void

    • Returns void

    • Parameters

      • e: FocusEvent

      Returns void

    • Returns void

    • Returns void

    • Adds a child control to this one.

      Returns

      the control just added

      Parameters

      • control: any

        the child control to add

      Returns any

    • Adds a new color scheme to those already available. It does not replace an existing scheme.

      Returns

      this gui instance

      Parameters

      • schemename: string

        the name of the color schmem

      • scheme: __Scheme

        the color scheme

      Returns GUI

    • Create a button control

      Returns

      a button

      Parameters

      • name: string

        unique name for this control

      • Optional x: number

        left-hand pixel position

      • Optional y: number

        top pixel position

      • Optional w: number

        width

      • Optional h: number

        height

      Returns any

    • Get the height of the HTML canvas tag

      Returns

      the height of the canvas

      Returns any

    • Get the width of the HTML canvas tag

      Returns

      the width of the canvas

      Returns any

    • Create a checkbox control

      Returns

      a checkbox

      Parameters

      • name: string

        unique name for this control

      • x: number

        left-hand pixel position

      • y: number

        top pixel position

      • w: number

        width

      • h: number

        height

      Returns any

    • Set or get the corner radii used for the controls

      Returns

      an array with the 4 corner radii

      Parameters

      • Optional c: number[]

        an array of 4 corner radii

      Returns number[]

    • Disable mouse/key event handling for this gui

      Returns

      this gui

      Since

      0.9.3

      Returns GUI

    • Enable mouse/key event handling for this gui

      Returns

      this gui

      Since

      0.9.3

      Returns GUI

    • Do not render any controls for this gui

      Returns

      this gui

      Since

      0.9.3

      Returns GUI

    • Hide all side panes. This will also close any pane that is open. Replaces hideAll

      Since

      0.9.3

      Returns void

    • Is this a 3D renderer?

      Returns

      true for WEBGL and false for P2D

      Returns boolean

    • Returns

      true if this gui can respond to mouse/key events

      Since

      0.9.3

      Returns boolean

    • Returns

      true if gui rendering is allowed

      Returns

      this gui

      Since

      0.9.3

      Returns boolean

    • Create a label control

      Returns

      a label

      Parameters

      • name: string

        unique name for this control

      • x: number

        left-hand pixel position

      • y: number

        top pixel position

      • w: number

        width

      • h: number

        height

      Returns any

    • Create an option (radio button) control

      Returns

      an option button

      Parameters

      • name: string
      • x: number

        left-hand pixel position

      • y: number

        top pixel position

      • w: number

        width

      • h: number

        height

      Returns any

    • Create a side pane. The pane location is either 'north', 'south', 'east' or 'west'.

      The pane will fill the whole width/height of the canvas depending on its position. The user controls how far the pane extends into the canvas when open.

      Returns

      a side pane

      Parameters

      • name: string

        unique name for this control

      • location: string

        the pane position ('north', 'south', 'east' or 'west')

      • depth: number

        the maximum depth the pane expands into the canvas

      Returns CvsPane

    • Create a ranger control

      Returns

      ranger control

      Parameters

      • name: string

        unique name for this control

      • x: number

        left-hand pixel position

      • y: number

        top pixel position

      • w: number

        width

      • h: number

        height

      Returns any

    • Set or get an existing global color scheme.

      Returns

      this gui instance

      Parameters

      • Optional schemename: string

        color scheme to set

      Returns GUI | __Scheme

    • Render any controls for this gui

      Returns

      this gui

      Since

      0.9.3

      Returns GUI

    • Show all pane tabs. All panes will be shown closed. Replaces showAll

      Since

      0.9.3

      Returns void

    • Create a slider control

      Returns

      slider control

      Parameters

      • name: string

        unique name for this control

      • x: number

        left-hand pixel position

      • y: number

        top pixel position

      • w: number

        width

      • h: number

        height

      Returns any

    • Start handling mouse and key events

      Since

      0.9.4

      Returns void

    • Stop handling mouse and key events

      Since

      0.9.4

      Returns void

    • Sets or gets the global text size.

      If no parameter is passed then the global text size is returned otherwise it returns this control.

      Returns

      the global text size or this control

      Parameters

      • Optional gts: number

        new global text size

      Returns number | GUI

    • Create a single line text input control

      Returns

      a textfield

      Parameters

      • name: string

        unique name for this control

      • Optional x: number

        left-hand pixel position

      • Optional y: number

        top pixel position

      • Optional w: number

        width

      • Optional h: number

        height

      Returns any

    • Sets or gets the global tip text size. If no parameter is passed then the global tip text size is returned otherwise it returns this control

      Returns

      the global tip text size or this control

      Parameters

      • Optional gtts: number

        new global tip text size

      Returns number | GUI

    • Create a viewer

      Returns

      an image viewer

      Parameters

      • name: string

        unique name for this control

      • x: number

        left-hand pixel position

      • y: number

        top pixel position

      • w: number

        width

      • h: number

        height

      Returns any

    • Creates and returns a GUI controller for a given canvas element.

      Returns

      a GUI controller

      Parameters

      • p5c: Renderer
      • p: p5 = p5.instance

      Returns any

    • Creates and returns a named GUI controller.

      Added in V0.9.4

      Returns

      a GUI controller

      Parameters

      • name: any

        unique name for the gui

      • p5c: Renderer
      • p: p5 = p5.instance

      Returns any

    Generated using TypeDoc