User Tools

Site Tools


dragengine:modules:dragonscript:xmlguitheme:mousepointer

Start Page » DragonScript Scripting Language » Gui Themes » Define XML Mouse Pointer

Mouse Pointers

Mouse pointer factories can be defined as parameters using the mousePointer tag or inside own XML files typically with the extension *.mpointer.xml. The extension can be chosen differently if required. For both versions the same tag definition is used.

Mouse pointer factories are always based directly or indirectly on a type. This type is the Mouse Pointer Prototype and defines what instance of MousePointerFactory is used in the scripts. The choice of prototype affects the appearance of the mouse pointer and the factory configuration possibilities.

The following prototypes are provided by default by the MousePointerFactories script class:

Name Script Class Description
Default DefaultMousePointerFactory Default mouse pointer without visual appearance
Image ImageMousePointerFactory Use image as mouse pointer
Video VideoMousePointerFactory Use video as mouse pointer
CanvasCreator CanvasCreatorMousePointerFactory Use canvas creator as mouse pointer

You can use custom prototypes by adding them to MousePointerFactories instance before loading gui themes. This is useful if you created custom mouse pointer factory subclasses requiring custom parameters.

This example defines an image mouse pointer factory based on the Image prototype.

<mousePointer parameter='ParameterName' type='Image'>
   <image parameter='image'>mousePointerImage.png</image>
</mousePointer>

If you modify an existing mouse pointer factory the type of the original mouse pointer factory is taken over. This example creates a mousepointer factory by loading it from a file and then replaces the image.

<mousePointer parameter='ParameterName' extend='sharedMousePointer.mpointer.xml'>
   <image parameter='image'>anotherImage.png</image>
</mousePointer>

Mouse Pointer Factory Parameters

Mouse pointer factories are configured by setting parameters. For each supported parameter type an own tag exists. See Defining Parameters for an overview of the supported types. The supported parameters by mouse pointer factory type are listed below.

Default

The most basic mouse pointer factory with no visual appearance. This equals no mouse pointer at all. Creates an instance of the DefaultMousePointerFactory script class.

These parameters can be used:

Parameter Name Supported parameter type Description
size Point Size of the mouse pointer in pixels. Used by subclass factories
offset Point Offset in pixels of the mouse pointer relative to the mouse pointer position. Used by subclass factories

Image

Creates a mouse pointer factory using an image as mouse pointer. Creates an instance of the ImageMousePointerFactory script class. The image is drawn at an offset relative to the mouse pointer position. Make sure to set the right size parameter to match the image size. If not matching the image is scaled to fit the mouse pointer size.

These additional parameters compared to Default type can be used:

Parameter Name Supported parameter type Description
image Image Image to use as mouse pointer
colorMatrix ColorMatrix Color matrix to use

Video

Creates a mouse pointer factory using a video as mouse pointer. Creates an instance of the VideoMousePointerFactory script class. The video is drawn at an offset relative to the mouse pointer position. Make sure to set the right size parameter to match the video size. If not matching the video is scaled to fit the mouse pointer size. The mouse pointer uses a video player to play the video at regular speed.

These additional parameters compared to Default type can be used:

Parameter Name Supported parameter type Description
video Video Video to use as mouse pointer
colorMatrix ColorMatrix Color matrix to use

CanvasCreator

Creates a mouse pointer factory using a canvas creator. Creates an instance of the CanvasCreatorMousePointerFactory script class. Make sure to set the right size parameter. The canvas creator is adjusted to fit into the set size.

These additional parameters compared to Default type can be used:

Parameter Name Supported parameter type Description
canvasCreator CanvasCreator Canvas creator to use. Best used are size adjustable canvas creators
size BorderSize Amount of space reserved around the widget to draw the border
You could leave a comment if you were logged in.
dragengine/modules/dragonscript/xmlguitheme/mousepointer.txt · Last modified: 2024/03/14 16:42 by dragonlord