Updated docs
[sdlgit/SDL-Site.git] / pages / SDL-Mouse.html-inc
CommitLineData
b82df135 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
5<ul><li><a href="#NAME">NAME</a></li>
bb5f3b83 6<li><a href="#CATEGORY">CATEGORY</a></li>
801213bd 7<li><a href="#CONSTANTS">CONSTANTS</a></li>
bb5f3b83 8<li><a href="#METHODS">METHODS</a>
9<ul><li><a href="#warp_mouse">warp_mouse</a></li>
bb5f3b83 10<li><a href="#set_cursor">set_cursor</a></li>
11<li><a href="#get_cursor">get_cursor</a></li>
801213bd 12<li><a href="#show_cursor">show_cursor</a></li>
bb5f3b83 13</ul>
b82df135 14</li>
801213bd 15<li><a href="#SEE_ALSO">SEE ALSO</a>
16</li>
b82df135 17</ul><hr />
3774ca11 18<!-- INDEX END --><a href="assets/Mouse.png" target="_blank"><img src="assets/Mouse.png" style="height: 160px" alt="Mouse.png"/></a><hr />
b82df135 19
20<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
21<div id="NAME_CONTENT">
801213bd 22<p>SDL::Mouse - SDL Bindings for the Mouse device</p>
b82df135 23
24</div>
25<h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
26<div id="CATEGORY_CONTENT">
bb5f3b83 27<p>Core, Mouse</p>
28
29</div>
801213bd 30<h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
31<div id="CONSTANTS_CONTENT">
32<p>The constants for SDL::Mouse belong to SDL::Events/SDL::Event, under the export tag of <code>':state'</code>.</p>
33
34</div>
bb5f3b83 35<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
36<div id="METHODS_CONTENT">
37
38</div>
39<h2 id="warp_mouse">warp_mouse</h2>
40<div id="warp_mouse_CONTENT">
801213bd 41<pre> SDL::Mouse::warp_mouse( $x, $y );
bb5f3b83 42
43</pre>
801213bd 44<p>Set the position of the mouse cursor (generates a mouse motion event).
45Even if the mouse is warped to where it currently is, a mouse motion event is generated.</p>
bb5f3b83 46
47</div>
bb5f3b83 48<h2 id="set_cursor">set_cursor</h2>
49<div id="set_cursor_CONTENT">
801213bd 50<pre> SDL::Mouse::set_cursor( $cursor_object );
bb5f3b83 51
52</pre>
801213bd 53<p>Sets the currently active cursor to the specified one.
54See <a href="SDL-Cursor.html">SDL::Cursor</a> for details on cursor objects.
55If the cursor is currently visible, the change will be immediately represented on the display.
56<code>set_cursor()</code> can be used to force cursor redraw, if this is desired for any reason.</p>
bb5f3b83 57
58</div>
59<h2 id="get_cursor">get_cursor</h2>
60<div id="get_cursor_CONTENT">
801213bd 61<pre> my $cursor_object = SDL::Mouse::get_cursor;
bb5f3b83 62
63</pre>
64<p>Gets the currently active mouse cursor.</p>
65
66</div>
67<h2 id="show_cursor">show_cursor</h2>
68<div id="show_cursor_CONTENT">
801213bd 69<pre> my $return = SDL::Mouse::show_cursor( $state );
bb5f3b83 70
71</pre>
801213bd 72<p>Toggle whether or not the cursor is shown on the screen.
73Passing <code>SDL_ENABLE</code> displays the cursor and passing <code>SDL_DISABLE</code> hides it.
bb5f3b83 74The current state of the mouse cursor can be queried by passing <code>SDL_QUERY</code>, either <code>SDL_DISABLE</code> or <code>SDL_ENABLE</code> will be returned.</p>
75<pre> use SDL;
76 use SDL::Mouse;
77 use SDL::Video;
801213bd 78 use SDL::Events ':state'; #For the constants
bb5f3b83 79
80 SDL::init(SDL_INIT_VIDEO);
801213bd 81 SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);
bb5f3b83 82
83 printf(&quot;Cursor is %s\n&quot;, SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
84
85 sleep(3);
86
87 SDL::Mouse::show_cursor(SDL_DISABLE);
88 printf(&quot;Cursor is %s\n&quot;, SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
89
90 sleep(3);
91
92 SDL::Mouse::show_cursor(SDL_ENABLE);
93 printf(&quot;Cursor is %s\n&quot;, SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
94
95 sleep(3);
96
97</pre>
b82df135 98
99</div>
801213bd 100<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
101<div id="SEE_ALSO_CONTENT">
102<p><a href="SDL-Cursor.html">SDL::Cursor</a></p>
103
104</div>
b82df135 105</div>