class Drawable
package h2d
extends Object
extended by Anim, Bitmap, Graphics, Particles, SpriteBatch, Text, TileGroup, Video
A base class for all 2D objects that will draw something on the screen.
Unlike Object base class, all properties of Drawable only apply to the current object and are not inherited by its children.
Variables
color:Vector4
The color multiplier for the drawable. Can be used to adjust individually each of the four channels R,G,B,A (default [1,1,1,1])
colorAdd:Null<Vector>
Setting colorAdd will add the amount of color of each channel R,G,B,A to the object pixels.
colorKey:Null<Int>
Setting a colorKey color value will discard all pixels that have this exact color in the tile.
colorMatrix:Null<Matrix>
Setting a colorMatrix will apply a color transformation. See also adjustColor
.
smooth:Null<Bool>
By enabling smoothing, scaling the object up or down will use hardware bilinear filtering resulting in a less crisp aspect.
By default smooth is null
in which case Scene.defaultSmooth
value is used.
tileWrap:Bool
Enables texture uv wrap for this Drawable, causing tiles with uv exceeding the texture size to repeat instead of clamping on edges.
Note that tileWrap
does not use the Tile
region as a wrapping area but instead uses underlying h3d.mat.Texture
size.
This is due to implementation specifics, as it just sets the Texture.wrap
to either Repeat
or Clamp
.
Because of that, proper Tile tiling can be expected only when the tile covers an entire Texture area.
Methods
addShader<T>(s:T):T
Add a shader to the drawable shaders.
Keep in mind, that as stated before, drawable children do not inherit Drawable properties, which includes shaders.
adjustColor(?col:Null<ColorAdjust>):Void
Set the Drawable.colorMatrix
value by specifying which effects to apply.
Calling adjustColor()
without arguments will reset the colorMatrix to null
.
getShader<T>(stype:Class<T>):T
Returns the first shader of the given shader class among the drawable shaders.
Parameters:
stype | The class of the shader to look up. |
---|
removeShader(s:Shader):Bool
Remove a shader from the drawable shaders, returns true if found or false if it was not part of our shaders.