Difference between revisions of "GetCursorPos"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Redirected page to Global Command: getCursorPos)
 
Line 1: Line 1:
==getCursorPos==
+
#REDIRECT [[Global Command: getCursorPos]]
 
 
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.3</span></div>
 
 
 
<div class="command-doc">Returns the current absolute cursor position.</div>
 
 
 
Lua Syntax:
 
<pre class="command-syntax">getCursorPos()</pre>
 
===Arguments===
 
===Flags===
 
===Return Values===
 
;pos
 
:Table with x and y values containing cursor position.
 
===Examples===
 
Example 1:  
 
<syntaxhighlight>
 
-- let's store the current position into a variable
 
local curPos = getCursorPos()
 
 
 
-- let's check if the stored cursor position equals another x,y value
 
if curPos.x == 200 and curPos.y == 400 then
 
  -- do some action
 
else
 
  -- do some other action
 
end
 
</syntaxhighlight>
 

Latest revision as of 12:24, 19 May 2023