Class UIElement
Defined in: ui.js.
Constructor Attributes | Constructor Name and Description |
---|---|
UIElement(id, img, x, y, width, height)
Creates an instance of a UIElement.
|
Field Attributes | Field Name and Description |
---|---|
UIElement height.
|
|
UIElement id.
|
|
UIElement image object.
|
|
UIElement width.
|
|
UIElement x position.
|
|
UIElement y position.
|
Method Attributes | Method Name and Description |
---|---|
draw(ctx)
Draw the UI element.
|
|
elementFocus(x, y)
Check if a certain element has focus by checking it's X, Y, Width and Height.
|
|
load(image, x, y, width, height)
Load image UI element.
|
Class Detail
UIElement(id, img, x, y, width, height)
Creates an instance of a UIElement.
- Parameters:
- {String} id
- String ID for UIElement.
- {Image} img
- Image of UIElement.
- {Number} x
- x axis position to draw UIElement.
- {Number} y
- y axis position to draw UIElement.
- {Number} width
- Width of UIElement.
- {Number} height
- Height of UIElement.
- See:
- ui.js
Field Detail
{Number}
height
UIElement height.
{String}
id
UIElement id.
{[Object Image]}
image
UIElement image object.
{Number}
width
UIElement width.
{Number}
x
UIElement x position.
{Number}
y
UIElement y position.
Method Detail
draw(ctx)
Draw the UI element.
- Parameters:
- {[object CanvasRenderingContext2D]} ctx
- 2D Canvas context.
{String}
elementFocus(x, y)
Check if a certain element has focus by checking it's X, Y, Width and Height.
- Parameters:
- {Number} x
- x axis position to check.
- {Number} y
- y axis position to check.
- Returns:
- {String} String denoting ID of UIElement.
load(image, x, y, width, height)
Load image UI element.
- Parameters:
- {Image} image
- UI element image.
- {Number} x
- x axis coordinate to draw UI element.
- {Number} y
- y axis coordinate to draw UI element.
- {Number} width
- Width to draw UI element.
- {Number} height
- Height to draw UI element.