{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorRenderableCamera** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorRenderableCamera ====== Behavior element behavior adding a camera renderable. To use this behavior add an [[behavior_dynamicskin|ECBehaviorDynamicSkin]] to the element class before adding this behavior. Create ECBehaviorRenderableCamera behavior and set the dynamic skin and camera. Now you can add other behaviors targeting the ECBehaviorRenderableCamera to alter the renderable if desired. Using a camera renderable or a canvas renderable with a render world canvas behaves differently. A render world canvas sets a fixed render size and allows to embed the camera view into other canvas to create elaborate results. A camera renderable does not force a specific render size. The graphic module is free to choose a resolution or to render the camera renderable directly. Render world canvas always renders into an image that can be reused. Camera renderables are usually more efficient and have better resolution since these requirements are not needed. On the other hand camera renderables prevent them to be embedded into canvas views. You need to use camera effects to add overlays or other manipulations. Nevertheless using camera renderable is faster and higher resolution and should be used unless complex canvas processing effects are required. See also: * [[gamedev:renderables|Dynamic Content using Renderables]] * [[gamedev:deigde:editors:skin|IGDE Skin Editor]] ====== Instance Counts ====== Multiple ECBehaviorRenderableCamera instances can be added to affect individual dynamic skin textures. ====== Element Class Properties ====== Element class properties have the prefix ''renderableCamera.'' or ''renderableCamera({id}).'' if id is not empty. ===== renderable ===== Set renderable name. Renderable is created as camera type and the camera assigned. * Full name: ''renderableCamera.renderable'' or ''renderableCamera({id}).renderable'' * Type: string * Default Value: empty string * Example (*.deeclass) display ====== Events ====== This behavior has no events. ====== Required Behaviors ====== * [[behavior_dynamicskin|ECBehaviorDynamicSkin]] * [[behavior_camera|ECBehaviorCamera]] ====== Optional Behaviors ====== This behavior does not support optional behaviors. ====== Persistency ====== This behavior does not required element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorRenderableCamera.html,ECBehaviorRenderableCamera~@#. Since DragonScript Module Version ''1.0'' ====== Use Cases ====== * Add renderable to dynamic skin showing what a camera behavior is seeing. ====== Element Class Example ====== This example defines an element which shows camera in dynamic skin. class MyElement extends BehaviorElementClass public var ECBehaviorComponent component public var ECBehaviorCollider collider public var ECBehaviorDynamicSkin dynamicSkin public var ECBehaviorCamera camera public var ECBehaviorRenderableCamera renderableCamera func new() component = ECBehaviorComponent.new(this, null) collider = ECBehaviorCollider.new(this, component) dynamicSkin = ECBehaviorDynamicSkin.new(this, component) camera = ECBehaviorCamera.new(this, collider) renderableCamera = ECBehaviorRenderableCamera.new(this, dynamicSkin, camera) end end ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: second second value ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]