Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.ECBehaviorRenderableCanvasBase Class Reference

Behavior element behavior used as base for class to use ECBehaviorRenderableCanvas. More...

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

Classes

class  Instance
 Behavior instance. More...
 

Public Member Functions

ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance. More...
 
void dispose ()
 Dispose of behavior. More...
 
ECBehaviorRenderableCanvas getRenderableCanvas ()
 Renderable canvas behavior. More...
 
ECBehaviorRenderableCanvasBase new (BehaviorElementClass eclass, ECBehaviorRenderableCanvas renderableCanvas)
 Create behavior element class. More...
 
ECBehaviorRenderableCanvasBase new (BehaviorElementClass eclass, ECBehaviorRenderableCanvas renderableCanvas, String id)
 
- 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...
 

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 used as base for class to use ECBehaviorRenderableCanvas.

This behavior only provides support to create a custom canvas managed by the subclass and add it to an ECBehaviorRenderableCanvas. This avoids some repeated code. To use this base class create a class like this:

class MyElement extends ECBehaviorRenderableCanvasBase
class Instance extends ECBehaviorRenderableCanvasBase.Instance
private var Canvas myCanvas
public func new(MyElement ecbehavior, BehaviorElement element) super(ecbehavior, element)
// Create myCanvas and assign it
myCanvas = ...
setCanvas(myCanvas)
// If you need to dynamically adjust the content each frame update use thinking
setRequiresThink(true)
end
public func void init(StubElement stub)
// If you need to init from stub do not forget to add the super call first
super.init(stub)
// Do your own init using the stub
end
public func void think( float elapsed )
// Update myCanvas
end
end
private var ECPString text
public func new(BehaviorElementClass eclass) super(eclass)
// If you need properties to allow mappers configurate your behavior add them here
text = ECPString.new("textPropertyName", "defaultText")
eclass.addProperty(text)
end
public func ECBehaviorInstance createInstance(BehaviorElement element)
return Instance.new(this, element)
end
end
ECBehaviorRenderableCanvasBase new(BehaviorElementClass eclass, ECBehaviorRenderableCanvas renderableCanvas)
Create behavior element class.
ECBehaviorInstance createInstance(BehaviorElement element)
Create Behavior instance.

This behavior will automatically pick the order value for the canvas based on the order in which the canvas are added. Basically the number of canvas in the renderable canvas view is used as order. During calls to setCanvas() the order of the canvas is set. If you want to use a specific order call setOrder().

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

Member Function Documentation

◆ createInstance()

ECBehaviorInstance Dragengine.Scenery.ECBehaviorRenderableCanvasBase.createInstance ( BehaviorElement  element)

Create Behavior instance.

Implements Dragengine.Scenery.ECBehavior.

◆ dispose()

void Dragengine.Scenery.ECBehaviorRenderableCanvasBase.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ getRenderableCanvas()

ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvasBase.getRenderableCanvas ( )

Renderable canvas behavior.

◆ new() [1/2]

ECBehaviorRenderableCanvasBase Dragengine.Scenery.ECBehaviorRenderableCanvasBase.new ( BehaviorElementClass  eclass,
ECBehaviorRenderableCanvas  renderableCanvas 
)

Create behavior element class.

◆ new() [2/2]

ECBehaviorRenderableCanvasBase Dragengine.Scenery.ECBehaviorRenderableCanvasBase.new ( BehaviorElementClass  eclass,
ECBehaviorRenderableCanvas  renderableCanvas,
String  id 
)

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