User Tools

Site Tools


dragengine:modules:dragonscript:behavior_customcolor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dragengine:modules:dragonscript:behavior_customcolor [2025/03/09 18:12] – [allowedColors] dragonlorddragengine:modules:dragonscript:behavior_customcolor [2025/03/13 17:05] (current) dragonlord
Line 1: Line 1:
 {{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]] >> **ECBehaviorCustomColor**+[[: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]] >> **ECBehaviorCustomColor**
 </WRAP> </WRAP>
  
Line 71: Line 71:
   * Example (*.deeclass) <code xml><null name='customColor(body).color'/><!-- force no color set --></code>   * Example (*.deeclass) <code xml><null name='customColor(body).color'/><!-- force no color set --></code>
  
-===== Events =====+====== Events ======
  
 Since this behavior provides no support to apply the chosen color listening is used. Behaviors knowing how to apply the color add a listener and are notified if the color changes. These events can be received: Since this behavior provides no support to apply the chosen color listening is used. Behaviors knowing how to apply the color add a listener and are notified if the color changes. These events can be received:
  
-==== colorChanged ====+===== colorChanged =====
  
 Selected color changed. Use behavior to get the newly set color. Selected color changed. Use behavior to get the newly set color.
Line 113: Line 113:
   end   end
 end end
 +</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='ECBehaviorCustomColor'>
 +    <!-- set element properties. omit property prefix if used inside behavior tag -->
 +    <string name='.name'>Color 1</string>
 +  </behavior>
 +  
 +  <!-- for adding multiple behaviors use unique identifiers -->
 +  <behavior type='ECBehaviorCustomColor' id='second'/>
 +</elementClass>
 </code> </code>
  
dragengine/modules/dragonscript/behavior_customcolor.1741543925.txt.gz · Last modified: 2025/03/09 18:12 by dragonlord