Next revision | Previous revision |
dragengine:modules:dragonscript:behavior_renderabledesktop [2021/10/07 12:41] – created dragonlord | dragengine:modules:dragonscript:behavior_renderabledesktop [2025/03/16 23:12] (current) – [renderable] dragonlord |
---|
{{tag>dragonscript behavior}} | {{tag>dragonscript behavior}} |
<WRAP youarehere> | <WRAP youarehere> |
[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorRenderableDesktop** | [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorRenderableDesktop** |
</WRAP> | </WRAP> |
| |
Behavior element behavior adding a renderable Desktop widget. | Behavior element behavior adding a renderable Desktop widget. |
| |
This behavior is useful for models with a complex dynamic texture where the content of the texture is provided by a [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Desktop.html|Desktop]] widget. Multiple other behaviors can add their content [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Window.html|Window]] to the [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Desktop.html|Desktop]] separating logic for reuse. Using **ECBehaviorRenderableDesktop** instead of [[behavior_renderablecanvas|ECBehaviorRenderableCanvas]] allows to use the full power of the GUI ToolKit including using [[dragengine:modules:dragonscript:guitheme|Gui Themes]] to create complex content easily. | This behavior is useful for models with a complex dynamic texture where the content of the texture is provided by a #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Desktop.html,Desktop~@# widget. Multiple other behaviors can add their content #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Window.html,Window~@# to the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Desktop.html,Desktop~@# separating logic for reuse. Using ECBehaviorRenderableDesktop instead of [[behavior_renderablecanvas|ECBehaviorRenderableCanvas]] allows to use the full power of the GUI ToolKit including using [[dragengine:modules:dragonscript:guitheme|Gui Themes]] to create complex content easily. |
| |
The default layout for the [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Desktop.html|Desktop]] is [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Layouts_1_1StackLayout.html|StackLayout]]]. The default gui theme is //"/shareddata/guithemes/modern/modern.guitheme.xml"//. The default [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Desktop.html|Desktop]] designer selector is //"RenderableDesktop"//. | The default layout for the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Desktop.html,Desktop~@# is #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Layouts_1_1StackLayout.html,StackLayout~@#]. The default gui theme is //"/shareddata/guithemes/modern/modern.guitheme.xml"//. The default #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Desktop.html,Desktop~@# designer selector is ''RenderableDesktop''. |
| |
To use this behavior add an [[behavior_dynamicskin|ECBehaviorDynamicSkin]] to the element class before adding this behavior. Create **ECBehaviorRenderableDesktop** behavior and set the dynamic skin and designer selector and [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1GuiTheme.html|GuiTheme]] for the [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Desktop.html|Desktop]]. Now you can add other behaviors targeting the ECBehaviorRenderableDesktop to add [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Widget.html|Widget]] resources to. | To use this behavior add an [[behavior_dynamicskin|ECBehaviorDynamicSkin]] to the element class before adding this behavior. Create ECBehaviorRenderableDesktop behavior and set the dynamic skin and designer selector and #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1GuiTheme.html,GuiTheme~@# for the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Desktop.html,Desktop~@#. Now you can add other behaviors targeting the ECBehaviorRenderableDesktop to add #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Widget.html,Widget~@# resources to. |
| |
The [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Desktop.html|Desktop]] is created with a default size of 1024x1024 . You can change the size using the element property to fit the texture requirements. | The #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Desktop.html,Desktop~@# is created with a default size of 1024x1024 . You can change the size using the element property to fit the texture requirements. |
| |
| See also: |
| * [[gamedev:renderables|Dynamic Content using Renderables]] |
| * [[gamedev:deigde:editors:skin|IGDE Skin Editor]] |
| |
====== Instance Counts ====== | ====== Instance Counts ====== |
| |
Multiple instances of **ECBehaviorRenderableDesktop** 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. | Multiple instances of ECBehaviorRenderableDesktop 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. |
| |
<code> | <code> |
====== Element Class Properties ====== | ====== Element Class Properties ====== |
| |
Element class properties have the prefix **renderableDesktop.** or **renderableDesktop(id).** if id is not empty. | Element class properties have the prefix ''renderableDesktop.'' or ''renderableDesktop(id).'' if id is not empty. |
| |
===== renderable ===== | ===== renderable ===== |
Name of the [[gamedev:renderables|renderable]] in the component skin to modify. | Name of the renderable in the component skin to modify. |
* Full name: "renderableDesktop.renderable" or "renderableDesktop(id).renderable" | * Full name: ''renderableDesktop.renderable'' or ''renderableDesktop(id).renderable'' |
* Type: string | * Type: string |
* Default Value: "" (empty string) | * Default Value: empty string |
* Example (*.deeclass): <code xml><string name='renderableDesktop.renderable'>monitor content</string></code> | * Example (*.deeclass): <code xml><string name='renderableDesktop.renderable'>monitor content</string></code> |
| |
| ===== renderableSolidity ===== |
| Name of the solidity renderable in the component skin to modify. |
| * Full name: ''renderableDesktop.renderableSolidity'' or ''renderableDesktop(id).renderableSolidity'' |
| * Type: string |
| * Default Value: empty string |
| * Example (*.deeclass): <code xml><string name='renderableDesktop.renderableSolidity'>monitor content solidity</string></code> |
| |
===== size ===== | ===== size ===== |
Size of desktop in pixels. | Size of desktop in pixels. |
* Full name: "renderableDesktop.size" or "renderableDesktop(id).size" | * Full name: ''renderableDesktop.size'' or ''renderableDesktop(id).size'' |
* Type: [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Point.html|Point]] | * Type: #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1Point.html,Point~@# |
* Default value: (1024, 1024) | * Default value: (1024,1024) |
* Example (*.deeclass): <code xml><point name='renderableDesktop.size' x='1024' y='512'/></code> | * Example (*.deeclass): <code xml><point name='renderableDesktop.size' x='1024' y='512'/></code> |
| |
===== guiTheme ===== | ===== guiTheme ===== |
Path to gui theme (*.guitheme.xml) to load. If the same gui theme is used in multiple elements it is loaded only once and shared. | Path to gui theme to load. If the same gui theme is used in multiple elements it is loaded only once and shared. |
* Full name: "renderableDesktop.guiTheme" or "renderableDesktop(id).guiTheme" | * Full name: "renderableDesktop.guiTheme" or "renderableDesktop(id).guiTheme" |
* Type: Path (*.guitheme.xml) | * Type: string |
* Default value: "/shareddata/guithemes/modern/modern.guitheme.xml" | * Default value: ''/shareddata/guithemes/modern/modern.guitheme.xml'' |
| * File Pattern: ''*.guitheme.xml'' |
* Example (*.deeclass): <code xml><string name='renderableDesktop.guiTheme'>/content/ui/ingame.guitheme.xml</string></code> | * Example (*.deeclass): <code xml><string name='renderableDesktop.guiTheme'>/content/ui/ingame.guitheme.xml</string></code> |
| |
===== designerSelector ===== | ===== designerSelector ===== |
Name of designer selector to use from gui theme specified in //guiTheme// property for desktop widget. Allows to define multiple desktops in one gui theme potentially sharing definitions. | Name of designer selector to use from gui theme specified in ''guiTheme'' property for desktop widget. Allows to define multiple desktops in one gui theme potentially sharing definitions. |
* Full name: "renderableDesktop.designerSelector" or "renderableDesktop(id).designerSelector" | * Full name: ''renderableDesktop.designerSelector'' or ''renderableDesktop(id).designerSelector'' |
* Type: string | * Type: string |
* Default Value: "RenderableDesktop" | * Default Value: ''RenderableDesktop'' |
* Example (*.deeclass): <code xml><string name='renderableDesktop.designerSelector'>RenderableDesktop.CockpitMonitor.Center</string></code> | * Example (*.deeclass): <code xml><string name='renderableDesktop.designerSelector'>RenderableDesktop.CockpitMonitor.Center</string></code> |
| |
====== Required Behaviors ====== | ====== Required Behaviors ====== |
| |
* [[behavior_dynamicskin|ECBehaviorDynamicSkin]] | * [[behavior_dynamicskin|ECBehaviorDynamicSkin]] |
| |
====== Persistency ====== | ====== Persistency ====== |
| |
This behavior does not use persistency. | This behavior does not required element class to be persistable (setPersistable). |
| |
====== API Documentation ====== | ====== API Documentation ====== |
| |
[[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1ECBehaviorRenderableDesktop.html|ECBehaviorRenderableDesktop]]. | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorRenderableDesktop.html,ECBehaviorRenderableDesktop~@#. |
| |
Since DragonScript Module Version **1.3** | Since DragonScript Module Version ''1.3'' |
| |
====== Use Cases ====== | ====== Use Cases ====== |
end | end |
</code> | </code> |
| |
| ====== Behavior Factory ====== |
| |
| Using element class supporting adding behaviors the behavior can be added like this: |
| <code xml> |
| <?xml version='1.0' encoding='UTF-8'?> |
| <elementClass name='MyClass' class='GenericBehaviorElement'> |
| <behavior type='ECBehaviorComponent'/> |
| <behavior type='ECBehaviorCollider'/> |
| <behavior type='ECBehaviorDynamicSkin'/> |
| |
| <behavior type='ECBehaviorRenderableDesktop'> |
| <!-- optional: use dynamic skin with id instead of empty string --> |
| <string name='dynamicSkin'>second</string> |
| |
| <!-- set element properties. omit property prefix if used inside behavior tag --> |
| <string name='.renderable'>display</string> |
| </behavior> |
| |
| <!-- for adding multiple behaviors use unique identifiers --> |
| <behavior type='ECBehaviorRenderableDesktop' id='second'/> |
| </elementClass> |
| </code> |
| |
| ====== Live Examples ====== |
| |
| * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]] |
| |