GetCursorPosition: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Hell Demon (talk | contribs) |
||
Line 17: | Line 17: | ||
This page lacks an example. | This page lacks an example. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function cursorInfo() | |||
screenx, screeny, worldx, worldy, worldz = getCursorPosition() | |||
outputChatBox("Cursor screen position: X=" .. screenx .. " Y=" .. screeny) | |||
outputChatBox("Cursor world position: X=" .. worldx .. " Y=" .. worldy .. " Z=" .. worldz) | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 15:28, 26 January 2008
This function gets the current position of the mouse cursor.
Syntax
int int float float float getCursorPosition ( )
Required Arguments
None
Returns
Returns 5 values: cursorX, cursorY, worldX, worldY, worldZ. The first two values are the 2D screen coordinates of the cursor in pixels, relative to the upper left corner. The 3 values that follow are the 3D world map coordinates that the cursor points at.
Example
This page lacks an example.
function cursorInfo() screenx, screeny, worldx, worldy, worldz = getCursorPosition() outputChatBox("Cursor screen position: X=" .. screenx .. " Y=" .. screeny) outputChatBox("Cursor world position: X=" .. worldx .. " Y=" .. worldy .. " Z=" .. worldz) end
See Also
- getAnalogControlState
- getBoundKeys
- getCommandsBoundToKey
- getKeyBoundToCommand
- getKeyState
- isCapsLockEnabled
- setAnalogControlState
- Shared
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey