[[:start|Start Page]] >> [[dragengine:modules:dragonscript:main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:guitheme|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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1MousePointerFactories.html,MousePointerFactories~@# script class:
^ Name ^ Script Class ^ Description ^
| [[#default|Default]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1DefaultMousePointerFactory.html,DefaultMousePointerFactory~@# | Default mouse pointer without visual appearance |
| [[#image|Image]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1ImageMousePointerFactory.html,ImageMousePointerFactory~@# | Use image as mouse pointer |
| [[#video|Video]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1VideoMousePointerFactory.html,VideoMousePointerFactory~@# | Use video as mouse pointer |
| [[#canvascreator|CanvasCreator]] | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1CanvasCreatorMousePointerFactory.html,CanvasCreatorMousePointerFactory~@# | Use canvas creator as mouse pointer |
You can use custom prototypes by adding them to #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1MousePointerFactories.html,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.
mousePointerImage.png
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.
anotherImage.png
====== Mouse Pointer Factory Parameters ======
Mouse pointer factories are configured by setting parameters. For each supported parameter type an own tag exists. See [[dragengine:modules:dragonscript:xmlguitheme:parameters|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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1DefaultMousePointerFactory.html,DefaultMousePointerFactory~@# script class.
These parameters can be used:
^ Parameter Name ^ Supported parameter type ^ Description ^
| size | [[dragengine:modules:dragonscript:xmlguitheme:parameters#point|Point]] | Size of the mouse pointer in pixels. Used by subclass factories |
| offset | [[dragengine:modules:dragonscript:xmlguitheme:parameters#point|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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1ImageMousePointerFactory.html,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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#image|Image]] | Image to use as mouse pointer |
| colorMatrix | [[dragengine:modules:dragonscript:xmlguitheme:parameters#colormatrix|ColorMatrix]] | Color matrix to use |
===== Video =====
Creates a mouse pointer factory using a video as mouse pointer. Creates an instance of the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1VideoMousePointerFactory.html,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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#video|Video]] | Video to use as mouse pointer |
| colorMatrix | [[dragengine:modules:dragonscript:xmlguitheme:parameters#colormatrix|ColorMatrix]] | Color matrix to use |
===== CanvasCreator =====
Creates a mouse pointer factory using a canvas creator. Creates an instance of the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Gui_1_1MousePointers_1_1Factories_1_1CanvasCreatorMousePointerFactory.html,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 | [[dragengine:modules:dragonscript:xmlguitheme:parameters#canvas_creator|CanvasCreator]] | Canvas creator to use. Best used are size adjustable canvas creators |
| size | [[dragengine:modules:dragonscript:xmlguitheme:parameters#bordersize|BorderSize]] | Amount of space reserved around the widget to draw the border |