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