3 <h3 id="TOP">Index</h3>
5 <ul><li><a href="#NAME">NAME</a></li>
6 <li><a href="#CATEGORY">CATEGORY</a></li>
7 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8 <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
9 <li><a href="#METHODS">METHODS</a>
10 <ul><li><a href="#new">new</a></li>
13 <li><a href="#AUTHORS">AUTHORS</a></li>
14 <li><a href="#SEE_ALSO">SEE ALSO</a>
19 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
20 <div id="NAME_CONTENT">
21 <p>SDL::Cursor - Mouse cursor structure</p>
24 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
25 <div id="CATEGORY_CONTENT">
26 <p>Core, Mouse, Structure</p>
29 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
30 <div id="SYNOPSIS_CONTENT">
31 <pre> my $cursor = SDL::Cursor->new(
40 SDL::Mouse::set_cursor($cursor);
45 <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
46 <div id="DESCRIPTION_CONTENT">
47 <p>The <code>SDL::Cursor</code> module handles mouse cursors, and allows the developer to use custom-made cursors.
48 Note that cursors can only be in black and white.</p>
51 <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
52 <div id="METHODS_CONTENT">
56 <div id="new_CONTENT">
57 <pre> my $cursor = SDL::Cursor->new(
58 \@data, \@mask, $width, $height, $hotspot_left, $hotspot_top
62 <p>Create a cursor using the specified data and mask (in MSB format).
63 The cursor is created in black and white according to the following:</p>
64 <pre> Data / Mask Resulting pixel on screen
68 1 / 0 Inverted color if possible, black if not.
71 <p>If you want to have color cursor, then this function is not for you.
72 Instead, you should hide the cursor with <code>SDL::Mouse::show_cursor(SDL_DISABLE)</code>.
73 Then in your main loop, when you draw graphics, draw a <code>SDL::Surface</code> at the location of the mouse cursor.</p>
80 SDL::init(SDL_INIT_VIDEO);
81 SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);
103 my $cursor = SDL::Cursor->new(\@data, \@mask, 8, 8, 0, 0);
106 SDL::Mouse::set_cursor($cursor);
110 <p>The width of cursors work in groups of 8.
111 If the width is above 8, twice the amount of elements in <code>@data</code> and <code>@mask</code> are required.
112 If the width is above 16, three times are required, and so on.
113 For example, if you wanted a 9 pixel crosshair you might do the following:</p>
115 0b00001000,0b00000000,
116 0b00001000,0b00000000,
117 0b00001000,0b00000000,
118 0b00001000,0b00000000,
119 0b11111111,0b10000000,
120 0b00001000,0b00000000,
121 0b00001000,0b00000000,
122 0b00001000,0b00000000,
123 0b00001000,0b00000000,
127 my $cursor = SDL::Cursor->new(\@data, \@mask, 9, 9, 4, 4);
130 <p>The hotspot is offset by 4 pixels because a crosshair clicks from the center instead of the top left.</p>
133 <h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
134 <div id="AUTHORS_CONTENT">
135 <p>See <a href="/SDL.html#AUTHORS">/SDL.html#AUTHORS</a>.</p>
142 <h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
143 <div id="SEE_ALSO_CONTENT">
144 <p><a href="http://search.cpan.org/perldoc?perl">perl</a> <a href="SDL-Mouse.html">SDL::Mouse</a></p>