Cursor
Info
Dependencies:
- Floats
- FrameFunctions
- View
Implementation:
 Cursor.d on GitHub
This package implements Gothic in-game mouse cursor support. To visually display the cursor there is a Cursor.tga file in the resources, but the texture can be changed in user constants.
Warning
The cursor only works if the mouse is activated in the Gothic settings. It can be done directly from the scripts. See the Ini file access.
Initialization
Initialize with LeGo_Cursor flag.
Variables
- var int Cursor_X
 Always contains the X coordinate of the mouse cursor.
- var int Cursor_Y
 Always contains the Y coordinate of the mouse cursor.
- var float Cursor_RelX
 Always contains the relative X coordinate of the mouse cursor as an Ikarus float.
- var float Cursor_RelY
 Always contains the relative Y coordinate of the mouse cursor as an Ikarus float.
- var int Cursor_Wheel
 Variable containing the value of the mouse wheel.
- var int Cursor_Left
 Variable that always contains the KeyState of the left mouse button.
- var int Cursor_Mid
 Variable that always contains the KeyState of the middle mouse button.
- var int Cursor_Right
 Variable that always contains the KeyState of the right mouse button.
- var int Cursor_Event
 An event handler that can send information about the mouse cursor. It can be used with all functions of the EventHandler package.
- var int Cursor_NoEngine
 Variable that can prevent the engine from working. If is set to- TRUEthe engine no longer reacts to mouse movements.
Functions
Cursor_Hide
Cursor_Show
SetMouseEnabled
SetMouseEnabled
Can manually enable or disable the mouse.
- var int enabled
 - TRUE- Mouse activated
Examples
Click a button
We use a View to display a button to be clicked. The FrameFunctions take care of the loop to check whether a click was made.
This also can be done by the Buttons package instead of View.
Event handler
Since LeGo 2.2 there is also an event handler (var int Cursor_Event) in the cursor package. This example briefly explains how it works: