API Docs for: 1.4.0
Show:

Kiwi.HUD.HUDManager Class

Module: HUD
Parent Module: Kiwi

This class manages all of the various HUDDisplays that are currently used on this Managers game. Using this class you can create/add and remove HUDDisplays from this game, change the HUDDisplay that is currently being display (also known as the currentHUD) and show/hide the currentHUD. Each HUDManager also has at least one HUDDisplay which is called the 'defaultHUD' you cannot remove, but you can reassign the defaultHUD to be a different HUDDisplay if you want.

Constructor

Kiwi.HUD.HUDManager

(
  • game
)
Kiwi.HUD.HUDManager

Parameters:

Methods

addToContainer

(
  • hud
)
private

Adds a HUDDisplays HTMLDivElement to this HUDManagers container element.

Parameters:

boot

() public

The DOM is ready, so if the current state is pending we can boot up the HUD now.

createHUD

(
  • name
  • [switchTo=false]
)
Kiwi.HUD.HUDDisplay public

Creates a new HUDDisplay on this HUDManager.

Parameters:

  • name String

    Name of the new HUDDisplay that is being creates.

  • [switchTo=false] Boolean optional

    Switch to the new HUD that was created. DE

Returns:

Kiwi.HUD.HUDDisplay:

The HUDDisplay that was created.

hideHUD

(
  • [hud=currentHUD]
)
public

Hides the currentHUD (if nothing is passed) or shows a HUDDisplay that is passed.

Parameters:

  • [hud=currentHUD] Kiwi.HUD.HUDDisplay optional

    The HUDDisplay you want to hude. Defaults to the currentHUD if nothing is passed.

objType

() String public

Returns the type of object this is.

Returns:

String:

"HUDManager"

removeFromContainer

(
  • hud
)
private

Removes the hud that is passed from this HUD Manager. Checks to see if that hud has this container as a parent first.

Parameters:

removeHUD

(
  • hud
)
Boolean public

Removes a HUDDisplay off this manager. Returns a boolean indicating whether or not this method was a success.

Parameters:

Returns:

Boolean:

If this method succeeded or not.

setHUD

(
  • hud
)
public

Changes the currentHUD that is being displayed to one that is passed.

Parameters:

showHUD

(
  • [hud=currentHUD]
)
public

Shows the currentHUD (if nothing is passed) or shows a HUDDisplay that is passed.

Parameters:

  • [hud=currentHUD] Kiwi.HUD.HUDDisplay optional

    The HUDDisplay you want to show. Defaults to the currentHUD if nothing is passed.

update

() public

Game loop

Properties

_currentHUD

Kiwi.HUD.HUDDisplay private

The currentHUD that is in use. Can be the same as the defaultHUD.

_defaultHUD

Kiwi.HUD.HUDDisplay private

The defaultHUD that is being used. The defaultHUD cannot be removed, but can be swapped out for another HUDDisplay.

_device

Number private

The device that this game is being target at. The same as the deviceTargetOption property on the root Game. This is needed as it detirmines if HUD is supported on the device or not and if so, how it is implemented.

_game

Kiwi.Game private

The game that this HUDManager belongs to.

_hudContainer

HTMLDivElement private

The HTMLDivElement that is being used as the container for the whole manager.

_huds

Array private

An array containing all of the HUDDisplays that are currently active on this HUDManager.

_supported

Boolean private

If the HUD is supported on the DEVICE that is being targeted. Gets set during the BOOT sequence.

defaultHUD

Kiwi.HUD.HUDDisplay public

The default HUDDisplay that is to be used. The defaultHUD cannot be removed, and a game (that supports HUDS) will always contain the defaultHUD.

supported

Boolean public

Returns the _supported property indicating whether HUD is supported or not.