HU/setCursorPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Client function hu}}
{{Client function hu}}
__NOTOC__
__NOTOC__
This function sets the current position of the mouse cursor.
Ez a function beállítja az kurzor aktuális pozícióját.


==Szintaxis==
==Szintaxis==
Line 15: Line 15:
===Visszatérési érték===
===Visszatérési érték===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if the position has been successfully set, ''false'' otherwise.
Visszatérési értéke ''true'', ha a pozíció sikeresen be lett állítva, egyébként ''false''.


==Példa==
==Példa==
This example sets your cursor position to the center of your screen after using the command ''cursorpos''.
Ez a példa a kurzor pozícióját a képernyő közepére állítja a ''centerCursor'' parancs használata után.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function centerCursorFunction()
function centerCursorFunction()
Line 34: Line 34:
==Problémák==
==Problémák==
{{Issues|
{{Issues|
{{Issue|8941|setCursorPosition nem működik}}
{{Issue|8941|setCursorPosition javítva}}
}}
}}



Latest revision as of 12:20, 15 October 2019

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 centerCursor 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 javítva

Lásd még

Fordította