User Tools

Site Tools


dragengine:modules:dragonscript:xmlguitheme:parameters

Parameters

Parameters define a value of a specific type to assign to a parameter by name. The last set values for a particular parameter name is used in the end. The supported types are described here. In general all attributes are optional unless marked otherwise. Not defined attributes use the default value.

The loader script tries to set the parameter using the provided type. If the parameter does not understand the provided value an exception is thrown. The loader script prints out such problems to the game console and tries to continue if possible. In some cases it is though not possible to continue without a properly set value. While working with parameters always watch the game console to see if some parameters are not properly understood or invalid.

Integer

Sets an integer value.

<integer parameter='ParameterName'>1234</integer>

Floating Point

Sets a floating point value. Supports regular and scientific notation (for example 1e2).

<float parameter='ParameterName'>12.34</float>

Boolean

Sets a boolean value. The values “true”, “yes” and “1” are considered true values. The values “false”, “no”, “0” are considered false values. All other values are considered false. It is recommended to use “true” and “false” with the other possible values to support conversion tools.

<boolean parameter='ParameterName'>true</boolean>

String

Sets a string value. This is typically used for parameters allowing the user to choose one or more flags from a set of named flags.

<string parameter='ParameterName'>center,middle</string>

Color

Sets a color value. Color values compose of a red, green, blue and alpha value. If an attribute is not used the default values are red=0, green=0, blue=0 and alpha=1. You can define the value using different notations. You can use any of the forms below but you can not mix them.

<!-- Define color using floating point values in the range from 0 to 1. All attributes are optional. -->
<color parameter='ParameterName' r='1' g='0.5' b='0.25' a='1'/>
 
<!-- Define color using a hex encoded value typically found in website design. Supported is the #RRGGBB and #RRGGBBAA form. -->
<color parameter='ParameterName' hex='ff8040'/>
 
<!-- Define color using integer values in the range from 0 to 255. All attributes are optional. -->
<color parameter='ParameterName' ir='255' ig='128' ib='64' ia='255'/>

Color Matrix

Sets a color matrix value. Color matrices are defines as a list of individual color matrices concatenated in the order they are defined. This allows to create various combinations. If the list is empty null is used as values instead.

<colorMatrix parameter='ParameterName'>
   <!--
   Define matrix shifting color components. Tag is of color typed as defined above but with 0 as default for alpha.
   -->
   <translate r='0' g='0.1' b='0'/>
 
   <!--
   Define matrix scaling color components. Tag is of color typed as defined above.
   -->
   <scale r='1' g='0.5' b='1' a='1'/>
 
   <!--
   Defines brightness matrix. Same as brightness in color programs.
   Tag is of color typed as defined above but with 0 as default for alpha.
   -->
   <brightness r='0' g='0.1' b='0'/>
 
   <!--
   Defines contrast matrix. Same as contrast in color programs.
   Tag is of color typed as defined above.
   -->
   <contrast r='1' g='0.7' b='1'/>
 
   <!--
   Defines saturation matrix. Values less than 1 desaturate. Values above 1 over-saturate.
   Tag is of color typed as defined above.
   -->
   <saturation r='0.5' g='2' b='0.5'/>
 
   <!-- Inverts color -->
   <invertColor/>
 
   <!--
   Define custom color matrix column wise in this order: red, green, blue, alpha, white.
   [red.r, green.r, blue.r, alpha.r, white.r]
   [red.g, green.g, blue.g, alpha.g, white.g]
   [red.b, green.b, blue.b, alpha.b, white.b]
   [red.a, green.a, blue.a, alpha.a, white.a]
 
   The example below defines an identity color matrix.
   -->
   <custom>
     <red r='1' g='0' b='0' a='0'/>
     <green r='0' g='1' b='0' a='0'/>
     <blue r='0' g='0' b='1' a='0'/>
     <alpha r='0' g='0' b='0' a='1'/>
     <white r='0' g='0' b='0' a='0'/>
   </custom>
</colorMatrix>

Font

Sets a font parameter. Fonts are engine resources. When you define a font parameter you select the font file to use and the line height in pixels. If the line height does not match the font scaling is required which might look ok or not.

<font parameter='ParameterName' size='15'>myfont.defont</font>

Image

Sets an image parameter. Images are engine resources.

<image parameter='ParameterName'>myimage.png</image>

Video

Sets a video parameter. Videos are engine resources. Video parameters are typically played back automatically in a loop by the parameter owner

<video parameter='ParameterName'>myvideo.ogv</video>

Border Size

Sets a BorderSize parameter. BorderSize is a script class containing 4 pixel size integer values one for each side. You can define the BorderSize using two different version but you can not mix them. Not used attributes are set to 0.

<!-- Set border size with all sides set to the same value. -->
<borderSize parameter='ParameterName' all='5'/>
 
<!-- Set border size with individual values for each side. Not defined sides are set to 0. -->
<borderSize parameter='ParameterName' left='5' top='2' right='5' bottom='2'/>

Point

Sets a Point parameter. Point is a script class containing an X and Y integer coordinate. Not set attributes are 0.

<!-- Set border size with individual values for each side. Not defined sides are set to 0. -->
<point parameter='ParameterName' x='5' y='2'/>

Canvas Creator

Sets a CanvasCreator parameter. See Define XML Canvas Creator for information about defining canvas creators. See Script Examples and Canvas System for general information about canvas creators. Canvas creators can be defined using a type attribute or by loading it from an XML file.

<canvasCreator parameter='MyCanvasCreator' type='Image'>
   <!-- Set canvas creator as instance of ImageCanvasCreator script class -->
</canvasCreator>
<canvasCreator parameter='MyCanvasCreator2' extend='myCanvasCreator.ccreator.xml'>
   <!-- Set canvas creator loading from XML file then modify -->
</canvasCreator>

Border

Sets a Border parameter. See Define XML Border Factory for information about defining border factories. Border factories can be defined using a type attribute or by loading it from an XML file.

<border parameter='MyBorder' type='Line'>
   <!-- Set border factory as instance of BorderLineFactory script class -->
</border>
<border parameter='MyBorder2' extend='myborder.border.xml'>
   <!-- Set border factory loading from XML file then modify -->
</border>

Decoration

Sets a Decoration parameter. See Define XML Decoration for information about defining decorations. Decorations can be defined using a type attribute or by loading it from an XML file.

<decoration parameter='MyDecoration' type='CanvasCreator'>
   <!-- Set decoration as instance of CanvasCreatorDecorationFactory script class -->
</decoration>
<decoration parameter='MyDecoration2' extend='mydecoration.decoration.xml'>
   <!-- Set decoration loading from XML file then modify -->
</decoration>

Mouse Pointer

Sets a MousePointer parameter. See Define XML Mouse Pointer for information about defining mouse pointers. Mouse pointers can be defined using a type attribute or by loading it from an XML file.

<mousePointer parameter='MyMousePointer' type='Image'>
   <!-- Set mouse pointer as instance of ImageMousePointerFactory script class -->
</mousePointer>
<mousePointer parameter='MyMousePointer2' extend='mymouse.mpointer.xml'>
   <!-- Set mouse pointer loading from XML file then modify -->
</mousePointer>

Widget Designer

Sets a WidgetDesigner parameter. See Define XML Widget Designers for information about defining widget designers. Widget designers can be defined using a type attribute, loading it from an XML file or creating a copy of a previously defined named widget designer.

<designer parameter='MyDesigner' type='Label'>
   <!-- Set widget designer as instance of LabelWidgetDesigner script class -->
</designer>
<designer parameter='MyDesigner2' extend='mydesigner.wdesigner.xml'>
   <!-- Set widget designer loading from XML file then modify -->
</designer>
<designer parameter='MyDesigner3' extendNamed='MyDesigner'>
   <!-- Set widget designer creating copy of a previously defined named widget designer -->
</designer>

Null

Sets a null parameter. Null can be used in place of any other parameter type. It is typically used to clear a previously set parameter for example from a named widget designer or some element loaded from XML file. Depending on the parameter null values may not be allowed.

<!-- Set parameter to null or empty. In this example the parameter is of type BorderSize and cleared this way. -->
<null parameter='ParameterName'/>
You could leave a comment if you were logged in.
dragengine/modules/dragonscript/xmlguitheme/parameters.txt · Last modified: 2024/03/14 16:52 by dragonlord