Render component.
Inherited from l2df.class.Component class.
Info:
- Copyright: Atom-TM 2019
- Author: Abelidze, Kasai
Sprite |
Table describing <sprite> structure. |
Methods
-
Render:added(obj[, kwargs])
-
Component was added to Entity event.
Adds
"render"
key to the Entity.C table.
Parameters:
-
obj
l2df.class.entity
Entity's instance.
-
kwargs
table
Keyword arguments.
-
sprites
{l2df.class.component.render.Sprite,...}
Array of sprites to be added with Render:addSprite() method.
(optional)
-
w
number
BBox width. Doesn't apply if entity already has width setted.
(default 0)
-
h
number
BBox height. Doesn't apply if entity already has height setted.
(default 0)
-
scalex
number
BBox X scale. Doesn't apply if entity already has scale setted.
(default 1)
-
scaley
number
BBox Y scale. Doesn't apply if entity already has scale setted.
(default 1)
-
centerx
number
BBox origin X position. Doesn't apply if entity already has origin setted.
(default 0)
-
centery
number
BBox origin Y position. Doesn't apply if entity already has origin setted.
(default 0)
-
radiusx
number
BBox X border smoothing. Doesn't apply if entity already has smoothing setted.
(default 0)
-
radiusy
number
BBox Y border smoothing. Doesn't apply if entity already has smoothing setted.
(default 0)
-
border
number
BBox border width.
(default 1)
-
facing
number
Entity's X orientation (not whole axis). Can be 1 or -1 (mirrored).
Used for mirroring rendered content. Doesn't apply if entity already has facing setted.
(default 1)
-
yorientation
number
Y axis sign. Can be 1 or -1 (for UI elements).
Used for corrent UI processing which has inverted Y axis. Doesn't apply if entity already has yorientation setted.
(default 1)
-
pic
number
Current drawing sprite's index. Doesn't apply if entity already has pic setted.
(default 1)
-
shadow
boolean
True if entity has drop-shadow effect. False otherwise.
(default false)
-
lights
{l2df.manager.render.Light}
Array of lights used for shadows.
Usually you may add it for root scenes / maps entities.
(optional)
-
layer
string
Layer for drawing. Careful: if setted it will change entity's layer.
(optional)
-
color
{0..255,0..255,0..255,0..255}
RGBA color used for blending. Defaults to
{255, 255, 255, 255}
(white).
(optional)
-
bgcolor
{0..255,0..255,0..255,0..255}
BBox background's RGBA color. Defaults to
nil
(transparent).
(optional)
-
bcolor
{0..255,0..255,0..255,0..255}
BBox border's RGBA color. Defaults to
nil
(transparent).
(optional)
-
Render:removed(obj)
-
Component was removed from Entity event.
Removes
"render"
key from Entity.C table.
Parameters:
-
Render:addSprite(obj, sprite)
-
Adds single / multiple sprite(s) from a spritesheet.
Parameters:
-
Render:update(obj, dt, islast)
-
Component update event handler.
Parameters:
-
obj
l2df.class.entity
Entity's instance.
-
dt
number
Delta-time since last game tick.
-
islast
boolean
Draws only the last processed frame.
-
Render:postupdate(obj, dt, islast)
-
Component post-update event handler.
Parameters:
-
obj
l2df.class.entity
Entity's instance.
-
dt
number
Delta-time since last game tick.
-
islast
boolean
Draws only the last processed frame.
-
Sprite
-
Table describing <sprite> structure.
Fields:
-
res
string
File path to spritesheet / sprite resource
-
w
number
Width of the image's area for clipping (<= full image width)
-
h
number
Height of the image's area for clipping (<= full image height)
-
x
number
Sprites' count per row
(default 1)
-
y
number
Sprites' count per column
(default 1)
-
s
number
Number of the first
S
sprites to skip
(default 1)
-
f
number
Total count of sprites to add from the specified image file.
Currently also counts skipped sprites (would be fixed in future)
(default x*y)
-
ox
number
Clipping area's X-offset (the left upper corner)
(default 0)
-
oy
number
Clipping area's Y-offset (the left upper corner)
(default 0)
-
ord
number
Index of the first sprite to start from.
Used for appending new sprites to already existing collection
(optional)
-
Render.data.color
{0..1,0..1,0..1,0..1}
-
Blending color.
To access use Render:data() function.
-
Render.data.bgcolor
{0..1,0..1,0..1,0..1}
-
Background color.
To access use Render:data() function.
-
Render.data.bcolor
{0..1,0..1,0..1,0..1}
-
Border color.
To access use Render:data() function.
-
Render.data.border
number
-
Border width.
To access use Render:data() function.