updated docs
[sdlgit/SDL-Site.git] / pages / SDL-Mouse.html-inc
index b967131..b0d79eb 100644 (file)
@@ -4,22 +4,23 @@
 
 <ul><li><a href="#NAME">NAME</a></li>
 <li><a href="#CATEGORY">CATEGORY</a></li>
+<li><a href="#CONSTANTS">CONSTANTS</a></li>
 <li><a href="#METHODS">METHODS</a>
-<ul><li><a href="#create_cursor">create_cursor</a></li>
-<li><a href="#warp_mouse">warp_mouse</a></li>
-<li><a href="#free_cursor">free_cursor</a></li>
+<ul><li><a href="#warp_mouse">warp_mouse</a></li>
 <li><a href="#set_cursor">set_cursor</a></li>
 <li><a href="#get_cursor">get_cursor</a></li>
-<li><a href="#show_cursor">show_cursor</a>
-</li>
+<li><a href="#show_cursor">show_cursor</a></li>
 </ul>
 </li>
+<li><a href="#SEE_ALSO">SEE ALSO</a></li>
+<li><a href="#AUTHORS">AUTHORS</a>
+</li>
 </ul><hr />
-<!-- INDEX END -->
+<!-- INDEX END --><a href="assets/Mouse.png" target="_blank"><img src="assets/Mouse.png" style="height: 160px" alt="Mouse.png"/></a><hr />
 
 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
 <div id="NAME_CONTENT">
-<p>SDL::Mouse -- SDL Bindings for the Mouse device</p>
+<p>SDL::Mouse - SDL Bindings for the Mouse device</p>
 
 </div>
 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
 <p>Core, Mouse</p>
 
 </div>
-<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
-<div id="METHODS_CONTENT">
+<h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="CONSTANTS_CONTENT">
+<p>The constants for SDL::Mouse belong to SDL::Events/SDL::Event, under the export tag of <code>':state'</code>.</p>
 
 </div>
-<h2 id="create_cursor">create_cursor</h2>
-<div id="create_cursor_CONTENT">
-<pre> my $cursor = SDL::Mouse::create_cursor( \@data, \@mask, $width, $height, $hotspot_left, $hotspot_top );
-
-</pre>
-<p>Create a cursor using the specified data and mask (in MSB format). The cursor width must be a multiple of 8 bits.</p>
-<p>The cursor is created in black and white according to the following:</p>
-<pre> Data / Mask   Resulting pixel on screen
-    0 / 1      White
-    1 / 1      Black
-    0 / 0      Transparent
-    1 / 0      Inverted color if possible, black if not.
-
-</pre>
-<p>Cursors created with this function must be freed with SDL_FreeCursor.</p>
-<p>If you want to have color cursor, then this function is not for you; instead, you must hide normal system cursor with <code>SDL::Mouse::show_cursor</code>
-and in your main loop, when you draw graphics, also draw a <code>SDL::Surface</code> at the location of the mouse cursor. </p>
-<p>Example:</p>
-<pre> use SDL;
- use SDL::Mouse;
- use SDL::Video;
-
- SDL::init(SDL_INIT_VIDEO);
- SDL::Video::set_video_mode( 640, 480, 16, SDL_SWSURFACE);
-
- my @data = (
-     0b00000000,
-     0b00111100,
-     0b01111110,
-     0b01111110,
-     0b01111110,
-     0b01111110,
-     0b00111100,
-     0b00000000
- );
-
- my @mask = (
-     0b00111100,
-     0b01111110,
-     0b11100111,
-     0b11000011,
-     0b11000011,
-     0b11100111,
-     0b01111110,
-     0b00111100
- );
-
- my $cursor = SDL::Mouse::create_cursor( \@data, \@mask, 8, 8, 0, 0 );
-
- sleep(1);
- SDL::Mouse::set_cursor($cursor);
-
- sleep(5);
-
-</pre>
+<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="METHODS_CONTENT">
 
 </div>
 <h2 id="warp_mouse">warp_mouse</h2>
 <div id="warp_mouse_CONTENT">
-<pre> void warp_mouse( int $x, int $y );
-
-</pre>
-<p>Set the position of the mouse cursor (generates a mouse motion event).</p>
-
-</div>
-<h2 id="free_cursor">free_cursor</h2>
-<div id="free_cursor_CONTENT">
-<pre> void free_cursor( object );
+<pre> SDL::Mouse::warp_mouse( $x, $y );
 
 </pre>
-<p>Frees a cursor that was created using <code>SDL::Cursor-</code>new()&gt;. </p>
+<p>Set the position of the mouse cursor (generates a mouse motion event).
+Even if the mouse is warped to where it currently is, a mouse motion event is generated.</p>
 
 </div>
 <h2 id="set_cursor">set_cursor</h2>
 <div id="set_cursor_CONTENT">
-<pre> void set_cursor( object );
+<pre> SDL::Mouse::set_cursor( $cursor_object );
 
 </pre>
-<p>Sets the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented 
-on the display. <code>set_cursor()</code> can be used to force cursor redraw, if this is desired for any reason. </p>
+<p>Sets the currently active cursor to the specified one.
+See <a href="SDL-Cursor.html">SDL::Cursor</a> for details on cursor objects.
+If the cursor is currently visible, the change will be immediately represented on the display.
+<code>set_cursor()</code> can be used to force cursor redraw, if this is desired for any reason.</p>
 
 </div>
 <h2 id="get_cursor">get_cursor</h2>
 <div id="get_cursor_CONTENT">
-<pre> object get_cursor();
+<pre> my $cursor_object = SDL::Mouse::get_cursor;
 
 </pre>
 <p>Gets the currently active mouse cursor.</p>
@@ -123,17 +67,19 @@ on the display. <code>set_cursor()</code> can be used to force cursor redraw, if
 </div>
 <h2 id="show_cursor">show_cursor</h2>
 <div id="show_cursor_CONTENT">
-<pre> int show_cursor( int toggle );
+<pre> my $return = SDL::Mouse::show_cursor( $state );
 
 </pre>
-<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. 
+<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.
 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>
 <pre> use SDL;
  use SDL::Mouse;
  use SDL::Video;
+ use SDL::Events ':state'; #For the constants
 
  SDL::init(SDL_INIT_VIDEO);
- SDL::Video::set_video_mode( 640, 480, 16, SDL_SWSURFACE);
+ SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);
 
  printf(&quot;Cursor is %s\n&quot;, SDL::Mouse::show_cursor(SDL_QUERY) ? 'visible' : 'not visible');
 
@@ -152,4 +98,14 @@ The current state of the mouse cursor can be queried by passing <code>SDL_QUERY<
 </pre>
 
 </div>
+<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="SEE_ALSO_CONTENT">
+<p><a href="SDL-Cursor.html">SDL::Cursor</a></p>
+
+</div>
+<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="AUTHORS_CONTENT">
+<p>See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
+
+</div>
 </div>
\ No newline at end of file