API Docs for: 1.4.0
Show:

Kiwi.HUD.Widget.Menu Class

Module: Widget
Parent Module: HUD

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
)
Kiwi.HUD.Widget.Menu

Parameters:

  • game Kiwi.Game

    The game that this Menu belongs to.

  • x Number

    Its position on the x-axis.

  • y Number

    Its position on the y -axis.

Methods

addMenuItem

(
  • item
)
Kiwi.HUD.Widget.MenuItem public

Adds a MenuItem to this menu.

Parameters:

addMenuItems

(
  • items
)
public

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 Array

    The array containing all of the menu items you want to add.

createMenuItem

(
  • text
  • x
  • y
)
Kiwi.HUD.Widget.MenuItem public

Creates a new menu item and add's it to this menu.

Parameters:

  • text String

    The text that you would like the menu item to have.

  • x Number

    The x position of the menu item you are wanting to add.

  • y Number

    The y position of the menu item you are wanting to add.

Returns:

Kiwi.HUD.Widget.MenuItem:

The newly created MenuItem.

destroy

() public

getMenuItem

(
  • val
)
Kiwi.HUD.Widget.MenuItem public

Returns a MenuItem based on its corresponding numeric position that you pass in the array.

Parameters:

  • val Number

objType

() String public

Inherited from Kiwi.HUD.HUDWidget but overwritten in src\hud\widgets\Menu.ts:32

The type of object that this is.

Returns:

String:

"MenuWidget"

removeTemplate

() public

Inherited from Kiwi.HUD.HUDWidget but overwritten in src\hud\widgets\Menu.ts:170

Currently not supported or working.

setStyle

(
  • index
  • value
)
public

Sets the style of all of the icons that will be on this menu.

Parameters:

  • index String
  • value String

setTemplate

(
  • main
  • [sub]
)
public

Inherited from Kiwi.HUD.HUDWidget but overwritten in src\hud\widgets\Menu.ts:146

Currently not supported or working.

Parameters:

  • main String
  • [sub] String optional

update

() public

Inherited from Kiwi.HUD.HUDWidget but overwritten in src\hud\widgets\Menu.ts:179

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

Inherited from Kiwi.HUD.HUDWidget: src\hud\HUDWidget.ts:296

Available since 1.3.0

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.

_menuItems

Array. private

Contains a list of all of the menu items that are currently on this menu. Each item in the list is of the type Kiwi.HUD.Widget.MenuItem.

_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.

HTMLDivElement public

Inherited from Kiwi.HUD.HUDWidget but overwritten in src\hud\HUDWidget.ts:170

The HTMLDivElement that this widget is using.

_verticalOrigin

String protected

Inherited from Kiwi.HUD.HUDWidget: src\hud\HUDWidget.ts:333

Available since 1.3.0

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.

components

Kiwi.ComponentManager public

The list of components that the HUDWidget use's.

game

Kiwi.Game public

The game that this HUDWidget belongs to.

horizontalOrigin

String public

Inherited from Kiwi.HUD.HUDWidget but overwritten in src\hud\widgets\Menu.ts:192

Available since 1.3.0

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'

menuItems

Array public

Returns a list that contains all of the menu items (buttons) that are currently on this menu. Each item in the list is of the type Kiwi.HUD.Widget.MenuItem. Note: The array itself is READ ONLY but you can modify the objects contained inside of it.

onCoordsUpdate

Kiwi.Signal public

Called when the coordinates of the HUD Widget updates.

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

Inherited from Kiwi.HUD.HUDWidget but overwritten in src\hud\widgets\Menu.ts:224

Available since 1.3.0

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