Difference between revisions of "love.mouse.setPosition"

(Undo revision 12683 by Bangseongbeom (talk))
Line 1: Line 1:
마우스의 위치를 설정합니다.
+
Sets the current position of the mouse.
== 함수 ==
+
== Function ==
=== 형식 ===
+
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
 
love.mouse.setPosition( x, y )
 
love.mouse.setPosition( x, y )
 
</source>
 
</source>
=== 매개변수 ===
+
=== Arguments ===
{{param|number (한국어)|x|마우스의 x좌표.}}
+
{{param|number|x|The new position of the mouse along the x-axis.}}
{{param|number (한국어)|y|마우스의 y좌표.}}
+
{{param|number|y|The new position of the mouse along the y-axis.}}
=== 리턴값 ===
+
=== Returns ===
없음.
+
Nothing.
== 다른 언어 ==
+
== Examples ==
* [[parent::love.mouse (한국어)]]
+
Snap the mouse to a new X position when the user presses a number key. The Y position is unchanged thanks to [[love.mouse.getY]].
* [[love.mouse.getPosition (한국어)]]
+
<source lang="lua">
* [[love.mouse.getX (한국어)]]
+
function love.keypressed(key)
* [[love.mouse.getY (한국어)]]
+
  if tonumber(key) then  -- if the key is numeric (0-9), execute the next line
 +
  love.mouse.setPosition(tonumber(key) * 10,  love.mouse.getY())  -- multiply the key by 10 to make the effect more visible, maintain the Y position via getY
 +
  end
 +
end
 +
</source>
 +
== See Also ==
 +
* [[parent::love.mouse]]
 +
* [[love.mouse.getPosition]]
 +
* [[love.mouse.getX]]
 +
* [[love.mouse.getY]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=마우스의 위치를 설정합니다.}}
+
{{#set:Description=Sets the current position of the mouse.}}
 
{{#set:Since=000}}
 
{{#set:Since=000}}
== 다른 언어 ==
+
== Other Languages ==
 
{{i18n|love.mouse.setPosition}}
 
{{i18n|love.mouse.setPosition}}

Revision as of 11:44, 20 January 2014

Sets the current position of the mouse.

Function

Synopsis

love.mouse.setPosition( x, y )

Arguments

number x
The new position of the mouse along the x-axis.
number y
The new position of the mouse along the y-axis.

Returns

Nothing.

Examples

Snap the mouse to a new X position when the user presses a number key. The Y position is unchanged thanks to love.mouse.getY.

function love.keypressed(key)
   if tonumber(key) then   -- if the key is numeric (0-9), execute the next line
	  love.mouse.setPosition(tonumber(key) * 10,  love.mouse.getY())   -- multiply the key by 10 to make the effect more visible, maintain the Y position via getY
   end
end

See Also


Other Languages