Files
QtGameMaker/help/files/404_02_mouse.html
T

112 lines
3.2 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>The Mouse</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="images/back.gif">
<!--START-->
<h3>The mouse</h3>
For mouse interaction, the following variables and functions exist:
<p>
<blockquote>
<tt><b>mouse_x*</b></tt>
X-coordinate of the mouse in the room. Cannot be changed.<br>
<tt><b>mouse_y*</b></tt>
Y-coordinate of the mouse in the room. Cannot be changed.<br>
<tt><b>mouse_button</b></tt>
Currently pressed mouse button. As value use <tt>mb_none</tt>, <tt>mb_any</tt>,
<tt>mb_left</tt>, <tt>mb_middle</tt>, or <tt>mb_right</tt>.<br>
<tt><b>mouse_lastbutton</b></tt>
Last pressed mouse button.<br>
</blockquote>
<p>
To check whether a particular mouse button is pressed you can use the following
functions. This is in particular useful when multiple keys are pressed simultaneously.
<p>
<blockquote>
<tt><b>mouse_check_button(numb)</b></tt>
Returns whether the mouse button is currently down (use as
values <tt>mb_none</tt>, <tt>mb_left</tt>, <tt>mb_middle</tt>, or <tt>mb_right</tt>).<br>
<tt><b>mouse_check_button_pressed(numb)</b></tt>
Returns whether the mouse button was pressed since the last step.<br>
<tt><b>mouse_check_button_released(numb)</b></tt>
Returns whether the mouse button was released since the last step.<br>
</blockquote>
<p>
The following functions can be used to check whether the mouse wheel was used.
<p>
<blockquote>
<tt><b>mouse_wheel_up()</b></tt>
Returns whether the mouse wheel was moved up since the last step.<br>
<tt><b>mouse_wheel_down()</b></tt>
Returns whether the mouse wheel was moved down since the last step.<br>
</blockquote>
<p>
There are some additional functions related to mouse interaction.
<p>
<blockquote>
<tt><b>mouse_clear(button)</b></tt>
Clears the state of the mouse button. This means that it will no
longer generate mouse events until the player releases it and presses it again.<br>
<tt><b>io_clear()</b></tt>
Clears all keyboard and mouse states.<br>
<tt><b>io_handle()</b></tt>
Handle user io, updating keyboard and mouse status.<br>
<tt><b>mouse_wait()</b></tt>
Waits till the user presses a mouse button<br>.
</blockquote>
<p>
You can change the way the mouse cursor looks like. You can choose any sprite for this. To this
end you can use the following variable:
<p>
<blockquote>
<tt><b>cursor_sprite</b></tt>
Indicates the sprite that is used to represent the cursor (default no sprite
is used, represented by a value of -1). You can assign one of the sprites to this variable to have it been
drawn automatically at the position of the mouse cursor. (You can also switch
off the windows mouse cursor in the <b>Global Game Settings</b>.)<br>
</blockquote>
<!--END-->
</body>
</html>
<!-- KEYWORDS
mouse
mouse position
mouse buttons
mouse_x
mouse_y
mouse_button
mouse_lastbutton
mb_any
mb_none
mb_left
mb_right
mb_middle
mouse_check_button()
mouse_check_button_pressed()
mouse_check_button_released()
mouse_wheel_up()
mouse_wheel_down()
mouse_clear()
mouse_wait()
cursor_sprite
-->