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="#METHODS">METHODS</a>
8 <ul><li><a href="#warp_mouse">warp_mouse</a></li>
9 <li><a href="#free_cursor">free_cursor</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>
13 </li>
14 </ul>
15 </li>
16 </ul><hr />
17 <!-- INDEX END -->
18
19 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
20 <div id="NAME_CONTENT">
21 <p>SDL::Mouse -- SDL Bindings for the Mouse device</p>
22
23 </div>
24 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
25 <div id="CATEGORY_CONTENT">
26 <p>Core, Mouse</p>
27
28 </div>
29 <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
30 <div id="METHODS_CONTENT">
31
32 </div>
33 <h2 id="warp_mouse">warp_mouse</h2>
34 <div id="warp_mouse_CONTENT">
35 <pre> void warp_mouse( int $x, int $y );
36
37 </pre>
38 <p>Set the position of the mouse cursor (generates a mouse motion event).</p>
39
40 </div>
41 <h2 id="free_cursor">free_cursor</h2>
42 <div id="free_cursor_CONTENT">
43 <pre> void free_cursor( object );
44
45 </pre>
46 <p>Frees a cursor that was created using <code>SDL::Cursor-</code>new()&gt;. </p>
47
48 </div>
49 <h2 id="set_cursor">set_cursor</h2>
50 <div id="set_cursor_CONTENT">
51 <pre> void set_cursor( object );
52
53 </pre>
54 <p>Sets the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented 
55 on the display. <code>set_cursor()</code> can be used to force cursor redraw, if this is desired for any reason. </p>
56
57 </div>
58 <h2 id="get_cursor">get_cursor</h2>
59 <div id="get_cursor_CONTENT">
60 <pre> object get_cursor();
61
62 </pre>
63 <p>Gets the currently active mouse cursor.</p>
64
65 </div>
66 <h2 id="show_cursor">show_cursor</h2>
67 <div id="show_cursor_CONTENT">
68 <pre> int show_cursor( int toggle );
69
70 </pre>
71 <p>Toggle whether or not the cursor is shown on the screen. Passing <code>SDL_ENABLE</code> displays the cursor and passing <code>SDL_DISABLE</code> hides it. 
72 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>
73 <pre> use SDL;
74  use SDL::Mouse;
75  use SDL::Video;
76
77  SDL::init(SDL_INIT_VIDEO);
78  SDL::Video::set_video_mode( 640, 480, 16, SDL_SWSURFACE);
79
80  printf(&quot;Cursor is %s\n&quot;, SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
81
82  sleep(3);
83
84  SDL::Mouse::show_cursor(SDL_DISABLE);
85  printf(&quot;Cursor is %s\n&quot;, SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
86
87  sleep(3);
88
89  SDL::Mouse::show_cursor(SDL_ENABLE);
90  printf(&quot;Cursor is %s\n&quot;, SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
91
92  sleep(3);
93
94 </pre>
95
96 </div>
97 </div>