Drag[en]gine Script Module DragonScript  1.21
Dragengine.Utils.CodecPropertyString Class Reference

Provides support for encoding/decoding various data types from/to property strings. More...

Inheritance diagram for Dragengine.Utils.CodecPropertyString:

Public Member Functions

Color decodeColor3 (String string)
 Decode property string into a 3-component color. More...
 
Color decodeColor4 (String string)
 Decode property string into a 4-component color. More...
 
DVector decodeDVector (String string)
 Decode property string into a 3-component dvector. More...
 
Array decodeFixedFloatList (String string, int valueCount)
 Decode property string into a fixed sized list of floating point values. More...
 
Array decodeFixedIntList (String string, int valueCount)
 Decode property string into a fixed sized list of integer point values. More...
 
FloatRectArea decodeFloatRectArea (String string)
 Decode property string into a 4-component vector. More...
 
Point decodePoint (String string)
 Decode property string into a 2-component point. More...
 
RectArea decodeRectArea (String string)
 Decode property string into a rectangular area. More...
 
ShapeList decodeShapeList (String string)
 Decode property string into a shape list. More...
 
Dictionary decodeStringDictionary (String string)
 Decode property string into a dictionary of key/value strings. More...
 
Array decodeStringList (String string)
 Decode property string into a list of strings. More...
 
Vector2 decodeVector2 (String string)
 Decode property string into a 2-component vector. More...
 
String encodeColor3 (Color color)
 Encode a 3-component color into a property string. More...
 
String encodeColor4 (Color color)
 Encode a 4-component color into a property string. More...
 
String encodeDVector (DVector vector)
 Encode a 3-component dvector into a property string. More...
 
String encodeFloatRectArea (FloatRectArea area)
 Encode a 4-component vector into a property string. More...
 
String encodePoint (Point point)
 Encode a 2-component point into a property string. More...
 
String encodeRectArea (RectArea area)
 Encode a rectangular area into a property string. More...
 
String encodeShapeList (ShapeList list)
 Encode shape list into a property string. More...
 
String encodeStringDictionary (Dictionary dict)
 Encode a string dictionary into a property string. More...
 
String encodeStringList (Array list)
 Encode a string list into a property string. More...
 
String encodeVector (Vector vector)
 Encode a 3-component vector into a property string. More...
 
String encodeVector2 (Vector2 vector)
 Encode a 2-component vector into a property string. More...
 
CodecPropertyString new ()
 Create codec. More...
 

Public Attributes

byte pEncodeTokenSeparator
 Character to separate tokens with for encoding. More...
 
byte pKeyValueSeparator
 Separator for key and value in dictionaries. More...
 
byte pShapeParameterSeparator
 Shape parameter separator character. More...
 
byte pShapeValueSeparator
 Shape value separator character. More...
 
String pTokenSeparators
 Basic separators for tokens in property strings containing multiple values. More...
 

Detailed Description

Provides support for encoding/decoding various data types from/to property strings.

Shape List Encoding

Shape list strings contain one or more shape definitions separated by whitespaces. The accepted separaters can be modified using CodecPropertyString.setTokenSeparators().

shape1 whitespaces shape2 whitespaces ... shapeN

Shape definitions contain the shape type and a list of parameters separated by colons without spaces. The separator can be modified using CodecPropertyString.setShapeParameterSeparator().

shapeType : parameter1 : parameter2 : ... parameterN

Shape parameters contain the parameter name and the parameter values separated by comma without spaces. The separator can be modified using CodecPropertyString.setShapeValueSeparator().

parameterName , value1 , value2 , ... valueN

Values are decimal or integer values. An example box shape definition would look like this:

box:position,0,0.5,0:extends,2,1,0.5

The following table show the supported shapes and parameters. The shape type and parameter name colon contains the exact string to use for the shapeType and parameterName.

Shape Type Parameter Name Values Description
sphere position x, y, z Position of center of shape
sphere radius radius Radius of sphere
box position x, y, z Position of center of box
box rotation x, y, z Rotation of box in degrees applied in the order Z-Axis then X-Axis then Y-Axis
box extends x, y, z Extends from center to box border. These are half the dimension of the box
cylinder position x, y, z Position of center of cylinder
cylinder rotation x, y, z Rotation of cylinder in degrees applied in the order Z-Axis then X-Axis then Y-Axis
cylinder height height Height of cylinder from center to the top respective bottom
cylinder radius top, bottom Radius of top and bottom cap of cylinder. Use different radi for tapered cylinders
cylinder topAxisScaling x, y Scaling of top cap of cylinder. Allows for squeezed cylinders
cylinder bottomAxisScaling x, y Scaling of bottom cap of cylinder. Allows for squeezed cylinders
capsule position x, y, z Position of center of capsule
capsule rotation x, y, z Rotation of capsule in degrees applied in the order Z-Axis then X-Axis then Y-Axis
capsule height height Height of capsule from center to the top respective bottom
capsule radius top, bottom Radius of top and bottom cap of capsule. Use different radi for tapered capsules
capsule topAxisScaling x, y Scaling of top cap of capsule. Allows for squeezed capsules
capsule bottomAxisScaling x, y Scaling of bottom cap of capsule. Allows for squeezed capsules
hull position x, y, z Position of center of hull
hull rotation x, y, z Rotation of hull in degrees applied in the order Z-Axis then X-Axis then Y-Axis
hull points x1, y1, z1, ..., xN, yN, zN Hull points

Member Function Documentation

◆ decodeColor3()

Color Dragengine.Utils.CodecPropertyString.decodeColor3 ( String  string)

Decode property string into a 3-component color.

◆ decodeColor4()

Color Dragengine.Utils.CodecPropertyString.decodeColor4 ( String  string)

Decode property string into a 4-component color.

Accepts also 3-component color in which case alpha is 1.

◆ decodeDVector()

DVector Dragengine.Utils.CodecPropertyString.decodeDVector ( String  string)

Decode property string into a 3-component dvector.

◆ decodeFixedFloatList()

Array Dragengine.Utils.CodecPropertyString.decodeFixedFloatList ( String  string,
int  valueCount 
)

Decode property string into a fixed sized list of floating point values.

◆ decodeFixedIntList()

Array Dragengine.Utils.CodecPropertyString.decodeFixedIntList ( String  string,
int  valueCount 
)

Decode property string into a fixed sized list of integer point values.

◆ decodeFloatRectArea()

FloatRectArea Dragengine.Utils.CodecPropertyString.decodeFloatRectArea ( String  string)

Decode property string into a 4-component vector.

Decode property string into a 4-component dvector.

Decode property string into a floating point rectangular area.

◆ decodePoint()

Point Dragengine.Utils.CodecPropertyString.decodePoint ( String  string)

Decode property string into a 2-component point.

◆ decodeRectArea()

RectArea Dragengine.Utils.CodecPropertyString.decodeRectArea ( String  string)

Decode property string into a rectangular area.

◆ decodeShapeList()

ShapeList Dragengine.Utils.CodecPropertyString.decodeShapeList ( String  string)

Decode property string into a shape list.

◆ decodeStringDictionary()

Dictionary Dragengine.Utils.CodecPropertyString.decodeStringDictionary ( String  string)

Decode property string into a dictionary of key/value strings.

Key/value pairs are separated by pTokenSeparators. Key and value are separated by pKeyValueSeparator.

◆ decodeStringList()

Array Dragengine.Utils.CodecPropertyString.decodeStringList ( String  string)

Decode property string into a list of strings.

◆ decodeVector2()

Vector2 Dragengine.Utils.CodecPropertyString.decodeVector2 ( String  string)

Decode property string into a 2-component vector.

◆ encodeColor3()

String Dragengine.Utils.CodecPropertyString.encodeColor3 ( Color  color)

Encode a 3-component color into a property string.

◆ encodeColor4()

String Dragengine.Utils.CodecPropertyString.encodeColor4 ( Color  color)

Encode a 4-component color into a property string.

◆ encodeDVector()

String Dragengine.Utils.CodecPropertyString.encodeDVector ( DVector  vector)

Encode a 3-component dvector into a property string.

◆ encodeFloatRectArea()

String Dragengine.Utils.CodecPropertyString.encodeFloatRectArea ( FloatRectArea  area)

Encode a 4-component vector into a property string.

Encode a 4-component vector into a property string.

Encode a floating point rectangular area into a property string.

◆ encodePoint()

String Dragengine.Utils.CodecPropertyString.encodePoint ( Point  point)

Encode a 2-component point into a property string.

◆ encodeRectArea()

String Dragengine.Utils.CodecPropertyString.encodeRectArea ( RectArea  area)

Encode a rectangular area into a property string.

◆ encodeShapeList()

String Dragengine.Utils.CodecPropertyString.encodeShapeList ( ShapeList  list)

Encode shape list into a property string.

◆ encodeStringDictionary()

String Dragengine.Utils.CodecPropertyString.encodeStringDictionary ( Dictionary  dict)

Encode a string dictionary into a property string.

◆ encodeStringList()

String Dragengine.Utils.CodecPropertyString.encodeStringList ( Array  list)

Encode a string list into a property string.

◆ encodeVector()

String Dragengine.Utils.CodecPropertyString.encodeVector ( Vector  vector)

Encode a 3-component vector into a property string.

◆ encodeVector2()

String Dragengine.Utils.CodecPropertyString.encodeVector2 ( Vector2  vector)

Encode a 2-component vector into a property string.

◆ new()

CodecPropertyString Dragengine.Utils.CodecPropertyString.new ( )

Create codec.

Member Data Documentation

◆ pEncodeTokenSeparator

byte Dragengine.Utils.CodecPropertyString.pEncodeTokenSeparator

Character to separate tokens with for encoding.

◆ pKeyValueSeparator

byte Dragengine.Utils.CodecPropertyString.pKeyValueSeparator

Separator for key and value in dictionaries.

◆ pShapeParameterSeparator

byte Dragengine.Utils.CodecPropertyString.pShapeParameterSeparator

Shape parameter separator character.

◆ pShapeValueSeparator

byte Dragengine.Utils.CodecPropertyString.pShapeValueSeparator

Shape value separator character.

◆ pTokenSeparators

String Dragengine.Utils.CodecPropertyString.pTokenSeparators

Basic separators for tokens in property strings containing multiple values.


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