Drag[en]gine Script Module DragonScript  1.21
Dragengine.Scenery.ECBehaviorRenderableCanvas Class Reference

Behavior element behavior adding a renderable canvas view. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorRenderableCanvas:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  Instance
 Behavior instance. More...
 

Public Member Functions

void dispose ()
 Dispose of behavior. More...
 
ECPColor getBackgroundColor ()
 Background color of canvas. More...
 
ECPImage getBackgroundImage ()
 Background image of canvas. More...
 
ECBehaviorDynamicSkin getDynamicSkin ()
 Dynamic skin behavior. More...
 
ECPString getRenderable ()
 Name of renderable to create or empty string if not used. More...
 
ECPPoint getSize ()
 Size of canvas. More...
 
Instance instance (BehaviorElement element)
 Get instance in element from owner element class. More...
 
ECBehaviorRenderableCanvas new (BehaviorElementClass eclass, ECBehaviorDynamicSkin dynamicSkin)
 Create behavior element class. More...
 
ECBehaviorRenderableCanvas new (BehaviorElementClass eclass, ECBehaviorDynamicSkin dynamicSkin, String id)
 
ECBehaviorRenderableCanvas new (BehaviorElementClass eclass, ECBehaviorDynamicSkin dynamicSkin, String id, String prefix)
 
- Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void assignInstanceIndex (int instanceIndex)
 Assign instance index. More...
 
String getBehaviorID ()
 Unique identifier of behavior. More...
 
String getID ()
 Identifier. More...
 
int getInstanceIndex ()
 Instance index. More...
 
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance)
 Load instance data of another behavior. More...
 
bool supportsBehaviorID (String identifier)
 Behavior supports loading instance data of another behavior. More...
 
- Public Member Functions inherited from Dragengine.Scenery.ECBehavior
ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance. More...
 

Static Public Member Functions

static ECBehaviorRenderableCanvas getBehaviorIn (BehaviorElementClass eclass)
 Get behavior in element class or null if absent. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
DefaultECBehavior new (BehaviorElementClass eclass)
 Create default composeable behavior with empty identifier. More...
 
DefaultECBehavior new (BehaviorElementClass eclass, String id)
 Create default composeable behavior. More...
 
void setBehaviorID (String identifier)
 Set behavior identifier. More...
 
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>". More...
 
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More...
 

Detailed Description

Behavior element behavior adding a renderable canvas view.

This behavior is useful for models with a complex dynamic texture where the content of the texture is provided by one or more Canvas resources. Multiple other behaviors can add their content to the canvas renderable to separate logic for reuse. A convenient base class to use is ECBehaviorRenderableCanvasBase.

To use this behavior add an ECBehaviorDynamicSkin to the element class before adding this behavior. Create ECBehaviorRenderableCanvas behavior and set the dynamic skin and canvas background color or image. The background color empty by default so make sure to set an appropriate background. Now you can add other behaviors targeting the ECBehaviorRenderableCanvas to add Canvas resources to.

If the background is not set the behaviors using this canvas have to make sure they cover the entire background to avoid artifacts. Background CanvasPaint or CanvasImage have order 0 respective 1 if both are used. Both canvas can be used for example if the image has transparency.

The canvas is created with a default size of 512x512 . You can change the size using the element property to fit the texture requirements.

Multiple ECBehaviorRenderableCanvas instances can be added to affect individual dynamic skin textures. The example below uses one component with one dynamic skin to two individual renderables named "content1" and "content2" each allowing to be individiaully filled with content by different behaviors.

class MyElement extends BehaviorElementClass
public func new()
ECBehaviorComponent.new(this)
ECBehaviorDynamicSkin.new(this)
ECBehaviorCanvas.new(this)
ECBehaviorCanvas.new(this, "canvas2")
var ECBehaviorRenderableCanvas behavior = ECBehaviorRenderableCanvas.new(this)
behavior.getRenderable().setValue("content1")
behavior = ECBehaviorRenderableCanvas.new(this, "renderableCanvas2")
behavior.setBackgroundColor(Color.blue)
behavior.getRenderable().setValue("intensity2")
end
end
ECBehaviorRenderableCanvas new(BehaviorElementClass eclass, ECBehaviorDynamicSkin dynamicSkin)
Create behavior element class.
ECPString getRenderable()
Name of renderable to create or empty string if not used.

Element class properties have the prefix "renderableCanvas{(id)}.".

This behavior does not require the element class to be persistable (setPersistable).

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.ECBehaviorRenderableCanvas.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ getBackgroundColor()

ECPColor Dragengine.Scenery.ECBehaviorRenderableCanvas.getBackgroundColor ( )

Background color of canvas.

◆ getBackgroundImage()

ECPImage Dragengine.Scenery.ECBehaviorRenderableCanvas.getBackgroundImage ( )

Background image of canvas.

◆ getBehaviorIn()

static ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvas.getBehaviorIn ( BehaviorElementClass  eclass)
static

Get behavior in element class or null if absent.

Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorComponent.

◆ getDynamicSkin()

ECBehaviorDynamicSkin Dragengine.Scenery.ECBehaviorRenderableCanvas.getDynamicSkin ( )

Dynamic skin behavior.

◆ getRenderable()

ECPString Dragengine.Scenery.ECBehaviorRenderableCanvas.getRenderable ( )

Name of renderable to create or empty string if not used.

◆ getSize()

ECPPoint Dragengine.Scenery.ECBehaviorRenderableCanvas.getSize ( )

Size of canvas.

◆ instance()

Instance Dragengine.Scenery.ECBehaviorRenderableCanvas.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/3]

ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvas.new ( BehaviorElementClass  eclass,
ECBehaviorDynamicSkin  dynamicSkin 
)

Create behavior element class.

◆ new() [2/3]

ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvas.new ( BehaviorElementClass  eclass,
ECBehaviorDynamicSkin  dynamicSkin,
String  id 
)

◆ new() [3/3]

ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvas.new ( BehaviorElementClass  eclass,
ECBehaviorDynamicSkin  dynamicSkin,
String  id,
String  prefix 
)

The documentation for this class was generated from the following file: