Difference between revisions of "GetCursorPos"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
+
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
<b>Command History</b>
+
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="mw-collapsible-content">
<div style="background:#ebebeb" width="100%">Available since <span style="color:orange">v?</span></div>
+
<div class="alt-bg">Available since v?</div>
 
</div></div>
 
</div></div>
  
Line 30: Line 30:
  
  
<b><u>Arguments</u></b>
+
<span class="bold underline">Arguments</span>
  
 
none
 
none
  
  
<b><u>Flags</u></b>
+
<span class="bold underline">Flags</span>
  
 
none
 
none
  
  
<b><u>Return</u></b>
+
<span class="bold underline">Return</span>
  
<b>pos</b> <br/>
+
<span class="bold">pos</span> <br/>
 
Table containing x,y values of current mouse cursor position
 
Table containing x,y values of current mouse cursor position
 
{{i18n|GetCursorPos}} <br/>
 
{{i18n|GetCursorPos}} <br/>
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
+
{| class="tbl-ds"
 
|-
 
|-
|<b>Relevant Pages</b>: [[SetCursorPos|setCursorPos]]
+
|<span class="bold">Relevant Pages</span>: [[SetCursorPos|setCursorPos]]
 
|}
 
|}

Revision as of 17:32, 2 April 2013

Command History

Available since v?


Stores the current position (absolute) of the mouse cursor into an x,y table, which can be used in a query to check if the current position is over an object/character or a certain part of the scene etc.


Syntax:

getCursorPos()


Example:

-- 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


Arguments

none


Flags

none


Return

pos
Table containing x,y values of current mouse cursor position


Relevant Pages: setCursorPos