Difference between revisions of "Global Command: setCursorPos"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m (EK moved page SetCursorPos (CMS) to Global Command: setCursorPos) |
|||
Line 21: | Line 21: | ||
|- | |- | ||
! style="width:15%" | Parameter | ! style="width:15%" | Parameter | ||
− | ! style="width:15%" | Type/Structure | + | ! style="width:15%" colspan="2" | Type/Structure |
! Description | ! Description | ||
|- | |- | ||
− | | pos | + | | rowspan="2" | pos |
− | | table | + | | rowspan="2" | table |
− | + | | x (int) | |
− | | | + | | rowspan="2" | Pass the position where the mouse cursor should be set to as a Visionaire "t_point" field: an associative array containing the elements '''x''' and '''y'''. |
+ | |- | ||
+ | | y (int) | ||
|} | |} | ||
Revision as of 16:18, 2 May 2023
Sets the mouse cursor to the {x,y} position provided.
Note that the coordinates must be provided in relation to the screen instead of in relation to the scene. This difference matters if your scene is larger than your screen resolution and thus scrollable.
Related functions | getCursorPos |
Syntax
setCursorPos(pos)
Parameters
Parameter | Type/Structure | Description | |
---|---|---|---|
pos | table | x (int) | Pass the position where the mouse cursor should be set to as a Visionaire "t_point" field: an associative array containing the elements x and y. |
y (int) |
Return values
none
Examples
Example 1: Set the mouse cursor to position {240,480} of the screen.
-- Pass a "t_point" table to the function
setCursorPos({x=240,y=480})
-- You could use a variable instead
local cPos = {x=240,y=480}
setCursorPos(cPos)