Kiwi.HUD.HUDManager Class
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
Item Index
Methods
Methods
addToContainer
-
hud
Adds a HUDDisplays HTMLDivElement to this HUDManagers container element.
Parameters:
-
hud
Kiwi.HUD.HUDDisplayThe HUDDisplay that is to be added.
boot
()
public
The DOM is ready, so if the current state is pending we can boot up the HUD now.
createHUD
-
name
-
[switchTo=false]
Creates a new HUDDisplay on this HUDManager.
Parameters:
-
name
StringName of the new HUDDisplay that is being creates.
-
[switchTo=false]
Boolean optionalSwitch to the new HUD that was created. DE
Returns:
The HUDDisplay that was created.
hideHUD
-
[hud=currentHUD]
Hides the currentHUD (if nothing is passed) or shows a HUDDisplay that is passed.
Parameters:
-
[hud=currentHUD]
Kiwi.HUD.HUDDisplay optionalThe HUDDisplay you want to hude. Defaults to the currentHUD if nothing is passed.
objType
()
String
public
Returns the type of object this is.
Returns:
"HUDManager"
removeFromContainer
-
hud
Removes the hud that is passed from this HUD Manager. Checks to see if that hud has this container as a parent first.
Parameters:
-
hud
Kiwi.HUD.HUDDisplayThe hud to be removed
removeHUD
-
hud
Removes a HUDDisplay off this manager. Returns a boolean indicating whether or not this method was a success.
Parameters:
-
hud
Kiwi.HUD.HUDDisplayThe hud you want to remove.
Returns:
If this method succeeded or not.
setHUD
-
hud
Changes the currentHUD that is being displayed to one that is passed.
Parameters:
-
hud
Kiwi.HUD.HUDDisplayThe HUD you want to display.
showHUD
-
[hud=currentHUD]
Shows the currentHUD (if nothing is passed) or shows a HUDDisplay that is passed.
Parameters:
-
[hud=currentHUD]
Kiwi.HUD.HUDDisplay optionalThe 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.
_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.