Class: GUI

MC.GUI(ConBoxListopt) → {MC.GUI}

new GUI(ConBoxListopt) → {MC.GUI}


The MC.GUI object provides a simple way to manage multiple MC.ConBox objects
Parameters:
Name Type Attributes Description
ConBoxList MC.ConBox <optional>
Comma seperated list of the ConBox's to be added
N.B. Non-Control Box items will be ignored
Properties:
Name Type Description
bin Array The Array holding the Control Box items
Source:
Returns:
A new MC.GUI object
Type
MC.GUI

Methods

checkClick() → {this}


Calls the checkClick() method of all ConBox's
Source:
Returns:
Enables method chaining
Type
this

clean() → {this}


Removes all non MC.ConBox from the GUI.
Called automatically by various other methods
Source:
Returns:
Enables method chaining
Type
this

click() → {this}


Cycles through all ConBox's and calls their onClick() method if their hover property is true
Source:
Returns:
Enables method chaining
Type
this

empty() → {this}


Removes all elements from the GUI, making it available for reuse
Source:
Returns:
Enables method chaining
Type
this

pop() → {this}


Removes the last item from the bin array.
Source:
Returns:
Enables method chaining
Type
this

push(ConBoxList) → {this}


Adds a MC.ConBox object to the end of the array.
Parameters:
Name Type Description
ConBoxList MC.ConBox Comma seperated list of the ConBox's to be added
N.B. Non-Control Box items will be ignored
Source:
Returns:
enables method chaining
Type
this

render(position_or_xopt, yopt) → {this}


Renders all Control Boxes held in the GUI to the canvas.
This call accepts 3 sets of parameters
(1) Nothing, and all Control Boxes will be positioned as per their individual pos property.
(2) An MC.Point, the GUI will auto fit it's contents using this position as a datum for the top left corner.
(3) Two numbers, which mirror and MC.Point (and GUI rendered as above)
In the latter two cases, the Control Boxes will be rendered in a left aligned vertical list
Parameters:
Name Type Attributes Description
position_or_x MC.Point | Number <optional>
y Number <optional>

N.B. Each Control Box's pos attribute is overwritten with their new rendered position
Source:
Returns:
Enables method chaining
Type
this

update()


Calls the update() method of all ConBox's in the GUI
This method should be called within any game loop, but only needs to be called once per frame.
Therefore it is advised to call it AFTER an MC.game.physicsUpdate loop
Source: