Drag[en]gine Script Module DragonScript
1.23
|
Behavior element behavior adding a renderable canvas view. More...
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... | |
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.
Element class properties have the prefix "renderableCanvas{(id)}.".
This behavior does not require the element class to be persistable (setPersistable).
void Dragengine.Scenery.ECBehaviorRenderableCanvas.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECPColor Dragengine.Scenery.ECBehaviorRenderableCanvas.getBackgroundColor | ( | ) |
Background color of canvas.
ECPImage Dragengine.Scenery.ECBehaviorRenderableCanvas.getBackgroundImage | ( | ) |
Background image of canvas.
|
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.
ECBehaviorDynamicSkin Dragengine.Scenery.ECBehaviorRenderableCanvas.getDynamicSkin | ( | ) |
Dynamic skin behavior.
ECPString Dragengine.Scenery.ECBehaviorRenderableCanvas.getRenderable | ( | ) |
Name of renderable to create or empty string if not used.
ECPPoint Dragengine.Scenery.ECBehaviorRenderableCanvas.getSize | ( | ) |
Size of canvas.
Instance Dragengine.Scenery.ECBehaviorRenderableCanvas.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvas.new | ( | BehaviorElementClass | eclass, |
ECBehaviorDynamicSkin | dynamicSkin | ||
) |
Create behavior element class.
ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvas.new | ( | BehaviorElementClass | eclass, |
ECBehaviorDynamicSkin | dynamicSkin, | ||
String | id | ||
) |
ECBehaviorRenderableCanvas Dragengine.Scenery.ECBehaviorRenderableCanvas.new | ( | BehaviorElementClass | eclass, |
ECBehaviorDynamicSkin | dynamicSkin, | ||
String | id, | ||
String | prefix | ||
) |