Drag[en]gine Script Module DragonScript  1.21
Dragengine.Scenery.ECPColorList Class Reference

Color list element class property for use with XML loading. More...

Inheritance diagram for Dragengine.Scenery.ECPColorList:
Dragengine.Scenery.ElementClassProperty

Public Member Functions

void addColor (Color color)
 Add color. More...
 
void copyValue (ElementClass elementClass, ElementClassProperty property)
 Copy value from another element class property of the same type. More...
 
CodecPropertyString getCodec ()
 Coded used to decode color string. More...
 
Color getColorAt (int index)
 Color at index. More...
 
int getColorCount ()
 Count of colors. More...
 
Array getColors ()
 Colors as Array of Color. More...
 
Array getColors (StubWithProperties stub)
 Color list modified by stub property if present. More...
 
Array getColors (StubWithProperties stub, String name)
 Color list modified by stub property if present. More...
 
String getColorsString ()
 Color list string. More...
 
ECPColorList new (String name, CodecPropertyString codec)
 Create property. More...
 
ECPColorList new (String name, CodecPropertyString codec, Array colors)
 Create property with initial path. More...
 
Color randomColor ()
 Random color or null if list is empty. More...
 
void setColors (Array colors)
 Set colors as Array of Color. More...
 
- Public Member Functions inherited from Dragengine.Scenery.ElementClassProperty
void dispose ()
 Dispose of element class property to break reference loops. More...
 
String getName ()
 Name. More...
 
bool logPreloadProblems (ElementClass elementClass, Console console)
 Log preloading problems. More...
 
ElementClassProperty new (String name)
 Create property. More...
 
void preloadResources (ElementClass elementClass, PreloadCounter counter)
 Preload resources if supported. More...
 
void setValue (Object value)
 Set value of property from XML decoded value. More...
 

Detailed Description

Color list element class property for use with XML loading.

Version
1.5

Color list is stored as Array of Color. From XML the color list is read using an encoded string decoded using CodecPropertyString. The following example defines a list with three colors:

<list name='propertyName'>
<list>
<color r='1' g='0' b='0'/>
<color r='0' g='1' b='0.5'/>
<color r='0.25' g='0.5' b='1'/>
</list>
</list>

In stub properties the coding is of the form "r1,g1,b1 r2,g2,b2 ...". The following example defines the same three colors as above in sub property string form:

"1,0,0 0,1,0.5 0.25,0.5,1"

Optionally newline can be used instead of whitespace. This can be easier to write with long list of colors.

Member Function Documentation

◆ addColor()

void Dragengine.Scenery.ECPColorList.addColor ( Color  color)

Add color.

◆ copyValue()

void Dragengine.Scenery.ECPColorList.copyValue ( ElementClass  elementClass,
ElementClassProperty  property 
)

Copy value from another element class property of the same type.

Version
1.17

◆ getCodec()

CodecPropertyString Dragengine.Scenery.ECPColorList.getCodec ( )

Coded used to decode color string.

◆ getColorAt()

Color Dragengine.Scenery.ECPColorList.getColorAt ( int  index)

Color at index.

◆ getColorCount()

int Dragengine.Scenery.ECPColorList.getColorCount ( )

Count of colors.

◆ getColors() [1/3]

Array Dragengine.Scenery.ECPColorList.getColors ( )

Colors as Array of Color.

◆ getColors() [2/3]

Array Dragengine.Scenery.ECPColorList.getColors ( StubWithProperties  stub)

Color list modified by stub property if present.

If named stub property is not present the stored color list is returned. If the named stub property is present it is decoded using the stored decoder and the result returned.

Uses the stored property name as stub property name.

◆ getColors() [3/3]

Array Dragengine.Scenery.ECPColorList.getColors ( StubWithProperties  stub,
String  name 
)

Color list modified by stub property if present.

If named stub property is not present the stored color list is returned. If the named stub property is present it is decoded using the stored decoder and the result returned.

◆ getColorsString()

String Dragengine.Scenery.ECPColorList.getColorsString ( )

Color list string.

◆ new() [1/2]

ECPColorList Dragengine.Scenery.ECPColorList.new ( String  name,
CodecPropertyString  codec 
)

Create property.

◆ new() [2/2]

ECPColorList Dragengine.Scenery.ECPColorList.new ( String  name,
CodecPropertyString  codec,
Array  colors 
)

Create property with initial path.

◆ randomColor()

Color Dragengine.Scenery.ECPColorList.randomColor ( )

Random color or null if list is empty.

◆ setColors()

void Dragengine.Scenery.ECPColorList.setColors ( Array  colors)

Set colors as Array of Color.


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