HU/setCursorPosition: Difference between revisions
Jump to navigation
Jump to search
(→Példa) |
|||
| Line 18: | Line 18: | ||
==Példa== | ==Példa== | ||
Ez a példa a kurzor pozícióját a képernyő közepére állítja a ''cursorpos'' parancs használata után. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function centerCursorFunction() | function centerCursorFunction() | ||
Revision as of 13:46, 14 October 2018
Ez a function beállítja az kurzor aktuális pozícióját.
Szintaxis
bool setCursorPosition ( int cursorX, int cursorY )
Kötelező paraméterek
- cursorX: Position over the X axis
- cursorY: Position over the Y axis
Visszatérési érték
Visszatérési értéke true, ha a pozíció sikeresen be lett állítva, egyébként false.
Példa
Ez a példa a kurzor pozícióját a képernyő közepére állítja a cursorpos parancs használata után.
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 )
Problémák
| Issue ID | Description |
|---|---|
| #8941 | setCursorPosition nem működik |
Lásd még
- HU/addCommandHandler
- HU/bindKey
- HU/executeCommandHandler
- HU/getAnalogControlState
- HU/getBoundKeys
- HU/getCommandsBoundToKey
- HU/getFunctionsBoundToKey
- HU/getKeyBoundToCommand
- HU/getKeyBoundToFunction
- HU/getKeyState
- HU/isControlEnabled
- HU/removeCommandHandler
- HU/toggleAllControls
- HU/toggleControl
- HU/unbindKey