Kiwi.HUD.Widget.Time Class
A subclass of TextField which manages the displaying of a Time/Timer by creating a new clock on the Time Manager. The time is managed by a Time Component which contains a format property that handles how the time should be formatted.
Constructor
Kiwi.HUD.Widget.Time
-
game
-
format
-
x
-
y
Parameters:
-
game
Kiwi.GameThe game that this object belongs to.
-
format
StringThe format that you want the time to be displayed in. Leave it empty to display as normal.
-
x
NumberThe position of this text on the field.
-
y
NumberThe position of this text on the field.
Returns:
Item Index
Methods
_updateText
()
protected
This method is intended to be overriden by subclasses which functions update the text being displayed.
destroy
()
public
objType
()
String
public
The type of object that this is.
Returns:
'TimeWidget'
pause
()
public
Pauses the clock where is stands. Calls the pause method on the clock.
removeTemplate
()
public
Used to remove any the template HTML from this HUDWidget. Currently doesn't have great support.
resume
()
public
Resumes the clock and thus the time.
setTemplate
-
main
-
icon
This method is used to remove existing DOM elements and place them inside a HUDWidget's container element. Useful so that when making HUD Widgets the developer can style HUDWidgets without having to create/write to much javascript.
Currently doesn't have great support.
Parameters:
-
main
StringID of an HTMLElement. This element should contain all of the elements you would like to place inside the HUDWidget.
-
icon
StringID of an HTMLElement that resides inside of the main param. This is the element that the HUDWidget can use to populate with information. E.g. Your score, health remaining, the icon, e.t.c.
start
()
public
Starts the clock and thus the time.
stop
()
public
Stops the clock and thus the time. Calls the stop method of the clock.
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.
_prefix
String
private
A string that is to be added in-front of the score. Can contain HTMLElements.
Default: ''
_suffix
String
private
A string that is to be added after the score. Can contain HTMLElements.
Default: ''
_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.
_text
String
private
The text current being displayed inside this textfield.
_textField
HTMLElement
private
The htmlelement that is being used as the textfield. Initially when created this is the same as the container HTMLDivElement.
_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.
text
String
public
The text that is currently being displayed inside the textfield.
time
Kiwi.HUD.HUDComponents.Time
public
Holds the time component which manages the counting/formating of the time.
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'
The HTMLDivElement that this widget is using.
x
Number
public
Get the x coordinate of the widget
y
Number
public
Get the y coordinate of the widget