SetCursorPosition: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 31: | Line 31: | ||
addCommandHandler( "centerCursor", centerCursorFunction ) | addCommandHandler( "centerCursor", centerCursorFunction ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Issues== | |||
{{Issues| | |||
{{Issue|8941|setCursorPosition does not work}} | |||
}} | |||
==See Also== | ==See Also== | ||
{{Client_input_functions}} | {{Client_input_functions}} |
Revision as of 11:32, 16 July 2015
This function sets the current position of the mouse cursor.
Syntax
bool setCursorPosition (int cursorX, int cursorY )
Required Arguments
- cursorX: Position over the X axis
- cursorY: Position over the Y axis
Returns
Returns true if the position has been successfully set, false otherwise.
Example
This example sets your cursor position to the center of your screen after using the command cursorpos.
function centerCursorFunction() local showing = isCursorShowing () if showing then -- if the cursor is showing local screenX, screenY = guiGetScreenSize () --get the screen size in pixels setCursorPosition (screenX/2, screenY/2) --set the cursor position to the center of the screen else outputChatBox( "Your cursor is not showing." ) end end addCommandHandler( "centerCursor", centerCursorFunction )
Issues
Issue ID | Description |
---|---|
#8941 | setCursorPosition does not work |
See Also
- getAnalogControlState
- getBoundKeys
- getCommandsBoundToKey
- getKeyBoundToCommand
- getKeyState
- isCapsLockEnabled
- setAnalogControlState
- Shared
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey