Class: UIBar

UIBar(position, size) → {UIBar}

new UIBar(position, size) → {UIBar}

A Bar to be used for UIs (eg. as a health or stamina Bar)
Parameters:
Name Type Description
position Array.<Array> Base position for the UIBar
size Array.<Array> The size for the UIBar
Source:
Returns:
Type
UIBar

Methods

_processPosition(posVal, sizeVal, val) → {float}

Private function for an equation used multiple times for positioning the Mid and Top Elems
Parameters:
Name Type Description
posVal float An X or Y position
sizeVal float An X or Y size
val float A value for the Mid or Top Elem
Source:
Returns:
New positional value based on given values
Type
float

configInterpolation(cycles, rate)

Configures the Interpolation
Parameters:
Name Type Description
cycles int Over how many frames should the Interpolation happen, 1 turns off Interpolation
rate float How much the Interpolation should change over a frame
Source:

draw(aCamera)

Draws the UIBar using the Stencil
Parameters:
Name Type Description
aCamera Camera The camera to draw it on
Source:

getCurrentValue() → {float}

Get the Current Value
Source:
Returns:
The Current Value
Type
float

getMaxValue() → {int}

Get the Max Value
Source:
Returns:
The Max Value
Type
int

incCurrentValue(value)

Increment the Value by the passed amount
Parameters:
Name Type Description
value type The amount to increment by
Source:

setBGColor(c)

Sets the Color of the Background
Parameters:
Name Type Description
c Array.<float> The desired Color for the Background
Source:

setBGVisible(visible)

Sets whether or not to show the Background
Parameters:
Name Type Description
visible bool Bool value of whether or not to show the background
Source:

setCurrentValue(value)

Set the Current Value
Parameters:
Name Type Description
value type Shat to set the Current Value
Source:

setMaxValue(value)

Set the Max Value of the Bar
Parameters:
Name Type Description
value int What to set the Max Value to
Source:

setMidElemColor(c)

Sets the Color of the Middle Element
Parameters:
Name Type Description
c Array.<float> The desired Color for the Middle Element
Source:

setMidVisible(visible)

Sets whether or not to show the Middle Element
Parameters:
Name Type Description
visible bool Bool value of whether or not to show the background
Source:

setSnapIncrease(b)

Sets whether the Top Element should snap when Value is increasing
Parameters:
Name Type Description
b bool Should the Top Element snap upon increasing Value
Source:

setStencil(stencilSprite)

Sets the sprite to be used for the Stencil
Parameters:
Name Type Description
stencilSprite String Location of the Sprite to be used for Stenciling
Source:

setStencilUV(left, right, bottom, top)

Sets the UVs of the Stencil
Parameters:
Name Type Description
left type
right type
bottom type
top type
Source:

setTopElemColor(c)

Sets the Color of the Top Element
Parameters:
Name Type Description
c Array.<float> The desired Color for the Top Element
Source:

update()

Update the UIBar
Source: