Kiwi.HUD.Widget.Menu Class
A Widget for that is used for the management/displaying of a Menu. This class is primarily used as a manager of MenuItems, so on this class you can create/add MenuItems and styles that you want applyed to all MenuItems.
Constructor
Kiwi.HUD.Widget.Menu
-
game
-
x
-
y
Parameters:
-
game
Kiwi.GameThe game that this Menu belongs to.
-
x
NumberIts position on the x-axis.
-
y
NumberIts position on the y -axis.
Returns:
Item Index
Methods
Methods
addMenuItem
-
item
Adds a MenuItem to this menu.
Parameters:
-
item
Kiwi.HUD.Widget.MenuItemThe MenuItem that you would like to add to this menu.
Returns:
addMenuItems
-
items
Adds multiple MenuItems to this Menu. Each item in the array you would like to add needs to be of the type Kiwi.HUD.Widget.MenuItem.
Parameters:
-
items
ArrayThe array containing all of the menu items you want to add.
createMenuItem
-
text
-
x
-
y
Creates a new menu item and add's it to this menu.
Parameters:
-
text
StringThe text that you would like the menu item to have.
-
x
NumberThe x position of the menu item you are wanting to add.
-
y
NumberThe y position of the menu item you are wanting to add.
Returns:
The newly created MenuItem.
destroy
()
public
getMenuItem
-
val
Returns a MenuItem based on its corresponding numeric position that you pass in the array.
Parameters:
-
val
Number
Returns:
objType
()
String
public
The type of object that this is.
Returns:
"MenuWidget"
removeTemplate
()
public
Currently not supported or working.
setStyle
-
index
-
value
Sets the style of all of the icons that will be on this menu.
Parameters:
-
index
String -
value
String
setTemplate
-
main
-
[sub]
Currently not supported or working.
Parameters:
-
main
String -
[sub]
String optional
update
()
public
The update loop.
Properties
_device
_device
protected
The type of device that this game is being targeted at. Same as the deviceTargetOption on the game class. Used to detirmine how the HUD is to be managed behind the scenes. This is mainly indented for INTERNAL Kiwi use only and is public so that sub classes can have a reference to it.
_horizontalOrigin
String
protected
Contains the current CSS style that will used for the x position.
Should either be LEFT
or RIGHT
but these values are not checked upon assignment.
Default: 'left'
_manager
Kiwi.HUD.HUDManager
protected
The HUDManager that this widget 'belongs' to. This is mainly indented for INTERNAL Kiwi use only and is public so that sub classes can have a reference to it.
_styles
Array
private
An array containing all of the styles that are/will be applyed to each MenuIcon.
_tempContainer
HTMLElement
private
The container element for the template Currently doesn't have that great support.
_tempParent
HTMLElement
private
The parent of the template container. So that when removing a template we can place it in the right spot Currently doesn't have that great support.
The HTMLDivElement that this widget is using.
_verticalOrigin
String
protected
Contains the current CSS style that will used for the y position.
Should either be TOP
or BOTTOM
but these values are not checked upon assignment.
Default: 'top'
_x
Number
private
The x coordinate of the widget
_y
Number
private
The y coordinate of the widget
class
String
public
The class name/s that the container element that this HUDWidget current has.
horizontalOrigin
String
public
Contains the current CSS style that will used for the x position.
Should either be LEFT
or RIGHT
but these values are not checked upon assignment.
Default: 'left'
style
Any
public
A quick way to reference the style object that exists on the container element of this widget.
tempElement
HTMLElement
public
When a template has been set, this property will have a reference to the HTMLElement we can place the HUDWidget information into. Currently doesn't have that great support.
vertical
String
public
Contains the current CSS style that will used for the y position.
Should either be TOP
or BOTTOM
but these values are not checked upon assignment.
Default: 'top'
x
Number
public
Get the x coordinate of the widget
y
Number
public
Get the y coordinate of the widget