HU/setCursorPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function hu}} __NOTOC__ This function sets the current position of the mouse cursor. ==Szintaxis== <syntaxhighlight lang="lua"> bool setCursorPosition ( int cursorX,...")
 
Line 38: Line 38:


==Lásd még==
==Lásd még==
{{Client_input_functions}}
{{Client_input_functions hu}}


[[en:setCursorPosition]]
[[en:setCursorPosition]]

Revision as of 13:39, 14 October 2018

This function sets the current position of the mouse cursor.

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

Returns true if the position has been successfully set, false otherwise.

Példa

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

Lásd még

Fordította