PackagePBLabs.Rendering2D
Classpublic class SpriteRenderComponent
InheritanceSpriteRenderComponent Inheritance BaseRenderComponent Inheritance EntityComponent

Simple render component that draws an image from a sprite sheet.



Public Properties
 PropertyDefined by
  Fade : Number = 1.0
Modulate alpha.
SpriteRenderComponent
  FlipX : Boolean
Whether or not to flip the sprite about the x axis.
SpriteRenderComponent
  FlipY : Boolean
Whether or not to flip the sprite about the y axis.
SpriteRenderComponent
 InheritedIsRegistered : Boolean
Whether or not the component is currently registered with an entity.
EntityComponent
 InheritedLayerIndex : int
Objects are sorted by layer, and this is the index of this object's layer.
BaseRenderComponent
 InheritedName : String
The name given to the component when it is added to an entity.
EntityComponent
 InheritedOwner : IEntity
A reference to the entity that this component currently belongs to.
EntityComponent
 InheritedPositionOffset : Point
An offset to apply to the position retrieved from the PositionReference.
BaseRenderComponent
 InheritedPositionReference : PropertyReference
A reference for the position property on the owner entity.
BaseRenderComponent
  RawSprite : DisplayObject
[read-only]
SpriteRenderComponent
 InheritedRenderCacheKey : int
BaseRenderComponent
 InheritedRenderPosition : Point
Report the center position of this object as used for rendering.
BaseRenderComponent
 InheritedRenderScale : Point
BaseRenderComponent
 InheritedRenderSortKey : int
Expose a sort key.
BaseRenderComponent
 InheritedRotationReference : PropertyReference
A reference for the rotation property on the owner entity.
BaseRenderComponent
 InheritedSizeReference : PropertyReference
A reference for the size property on the owner entity.
BaseRenderComponent
  Smoothing : Boolean
SpriteRenderComponent
  SpriteIndex : int
The index in the sprite sheet of the frame to draw.
SpriteRenderComponent
  SpriteSheet : SpriteSheetComponent
The sprite sheet to use to draw this sprite.
SpriteRenderComponent
Protected Properties
 PropertyDefined by
  _baseSize : Point = null
SpriteRenderComponent
  _flipX : Boolean = false
SpriteRenderComponent
  _flipY : Boolean = false
SpriteRenderComponent
  _matrix : Matrix
SpriteRenderComponent
  _smoothing : Boolean = true
SpriteRenderComponent
  _sprite : DisplayObject = null
SpriteRenderComponent
  _spriteDirty : Boolean = false
SpriteRenderComponent
  _spriteIndex : int = 0
SpriteRenderComponent
  _spriteSheet : SpriteSheetComponent = null
SpriteRenderComponent
Public Methods
 MethodDefined by
 Inherited
BaseRenderComponent
  
OnDraw(manager:IDrawManager2D):void
Callback during rendering to give the object an opportunity to give the IDrawManager2D stuff to display.
SpriteRenderComponent
 Inherited
Register(owner:IEntity, name:String):void
Registers the component with an entity.
EntityComponent
 Inherited
Reset():void
This is called by an entity on all of its components any time a component is added or removed.
EntityComponent
 Inherited
Unregister():void
Unregisters the component from an entity.
EntityComponent
Protected Methods
 MethodDefined by
  
Update the cached sprite that we use for rendering.
SpriteRenderComponent
  
_OnAdd():void
This is called when the component is added to an entity.
SpriteRenderComponent
  
_OnRemove():void
This is called when the component is removed from an entity.
SpriteRenderComponent
 Inherited
_OnReset():void
This is called anytime a component is added or removed from the owner entity.
EntityComponent
  
GetCurrentFrame():BitmapData
SpriteRenderComponent
Property detail
_baseSizeproperty
protected var _baseSize:Point = null
Fadeproperty 
public var Fade:Number = 1.0

Modulate alpha. Zero is fully translucent, one is fully opaque.

_flipXproperty 
protected var _flipX:Boolean = false
FlipXproperty 
FlipX:Boolean  [read-write]

Whether or not to flip the sprite about the x axis.

Implementation
    public function get FlipX():Boolean
    public function set FlipX(value:Boolean):void
_flipYproperty 
protected var _flipY:Boolean = false
FlipYproperty 
FlipY:Boolean  [read-write]

Whether or not to flip the sprite about the y axis.

Implementation
    public function get FlipY():Boolean
    public function set FlipY(value:Boolean):void
_matrixproperty 
protected var _matrix:Matrix
RawSpriteproperty 
RawSprite:DisplayObject  [read-only]Implementation
    public function get RawSprite():DisplayObject
_smoothingproperty 
protected var _smoothing:Boolean = true
Smoothingproperty 
Smoothing:Boolean  [read-write]Implementation
    public function get Smoothing():Boolean
    public function set Smoothing(value:Boolean):void
_spriteproperty 
protected var _sprite:DisplayObject = null
_spriteDirtyproperty 
protected var _spriteDirty:Boolean = false
_spriteIndexproperty 
protected var _spriteIndex:int = 0
SpriteIndexproperty 
SpriteIndex:int  [read-write]

The index in the sprite sheet of the frame to draw.

Implementation
    public function get SpriteIndex():int
    public function set SpriteIndex(value:int):void
_spriteSheetproperty 
protected var _spriteSheet:SpriteSheetComponent = null
SpriteSheetproperty 
SpriteSheet:SpriteSheetComponent  [read-write]

The sprite sheet to use to draw this sprite.

Implementation
    public function get SpriteSheet():SpriteSheetComponent
    public function set SpriteSheet(value:SpriteSheetComponent):void
Method detail
_GenerateSprite()method
protected function _GenerateSprite():void

Update the cached sprite that we use for rendering.

_OnAdd()method 
protected override function _OnAdd():void

This is called when the component is added to an entity. Any initialization, event registration, or object lookups should happen here. Component lookups on the owner entity should NOT happen here. Use _OnReset instead.

_OnRemove()method 
protected override function _OnRemove():void

This is called when the component is removed from an entity. It should reverse anything that happened in _OnAdd or _OnReset (like removing event listeners or nulling object references).

GetCurrentFrame()method 
protected function GetCurrentFrame():BitmapData

Returns
BitmapData
OnDraw()method 
public override function OnDraw(manager:IDrawManager2D):void

Callback during rendering to give the object an opportunity to give the IDrawManager2D stuff to display.

Parameters
manager:IDrawManager2D