Constructor
new Drawable(owner, canvasBitmap, argsopt) → {void}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
owner |
GameEntity | |||
canvasBitmap |
object | |||
args |
object |
<optional> |
{} |
Properties:
Name | Type | Description |
---|---|---|
name |
string |
-------------Values That Can Be Changed------------ |
offset_x |
float |
The horizontal offset of the image from the owner's x position |
offset_y |
float |
The vertical offset of the image from the owner's y position |
scale_x |
float |
The image scale - horizontal |
scale_y |
float |
The image scale - vertical |
rotation |
float |
Rotation of the image |
color |
integer |
This can be used to tint the image with the provided color if desired. White makes no change to the original image. |
alpha |
float |
Change the image alpha (transparency). |
enabled |
boolean |
Whether or not the image will be drawn. |
offsetPositionFromOwner |
boolean |
Should the image be offset from teh owner, or from the canvas's origin? |
drawTo |
object |
The canvas this will be drawn to (e.g. m.game.getCanvas()) |
owner |
GameEntity |
------------Never To Be Manually Changed----------------- ' These values should never need to be manually changed. |
width |
float | |
height |
float | |
shouldRedraw |
boolean |
- Source:
Methods
draw(additionalRotationopt) → {void}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
additionalRotation |
float |
<optional> |
0 |
- Source:
drawRegionToCanvas(draw2d, additionalRotationopt, ignoreColoropt) → {void}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
draw2d |
object | |||
additionalRotation |
float |
<optional> |
0 | |
ignoreColor |
boolean |
<optional> |
false |
- Source:
forceRedraw() → {void}
Forces a redraw of this drawable on next frame By default, some drawables that need to do preprocessing (text, polygons, etc) will only redraw automatically if their dimensions or underlying values change --
- Source:
getDrawnSize() → {object}
- Source:
getDrawPosition() → {object}
- Source:
getFillColorRGBA(ignoreColoropt) → {integer}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ignoreColor |
boolean |
<optional> |
false |
- Source:
getSize() → {object}
- Source:
onResume(pausedTimeMs) → {dynamic}
Parameters:
Name | Type | Description |
---|---|---|
pausedTimeMs |
integer |
- Source:
setCanvas(canvas) → {void}
Sets the canvas this will draw to
Parameters:
Name | Type | Description |
---|---|---|
canvas |
object |
The canvas (roBitmap) this should draw to |
- Source:
setScale(scale_x, scale_yopt) → {void}
Sets the scale of the drawable
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
scale_x |
float |
horizontal scale |
||
scale_y |
dynamic |
<optional> |
invalid |
vertical scale, or if invalid, use the horizontal scale as vertical scale |
- Source: