fixed url-generator
[sdlgit/SDL-Site.git] / pages / SDL-Cursor.html-inc
CommitLineData
162a0989 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
5<ul><li><a href="#NAME">NAME</a></li>
7c40f9a1 6<li><a href="#CATEGORY">CATEGORY</a></li>
162a0989 7<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
9<li><a href="#METHODS">METHODS</a>
7c40f9a1 10<ul><li><a href="#new">new</a></li>
162a0989 11</ul>
12</li>
13<li><a href="#AUTHOR">AUTHOR</a></li>
14<li><a href="#SEE_ALSO">SEE ALSO</a>
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">
7c40f9a1 21<p>SDL::Cursor -- Mouse cursor structure</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, Structure</p>
162a0989 27
28</div>
29<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
30<div id="SYNOPSIS_CONTENT">
7c40f9a1 31<pre> my $cursor = SDL::Cursor-&gt;new(
32 \@data,
33 \@mask,
34 $width,
35 $height,
36 $hotspot_left,
37 $hotspot_top );
38
39 SDL::Mouse::set_cursor($cursor);
162a0989 40
41</pre>
42
43</div>
44<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
45<div id="DESCRIPTION_CONTENT">
7c40f9a1 46<p>the <code>SDL::Cursor</code> module handles mouse cursors, and provide the developer to
162a0989 47use custom made cursors. Note that the cursors can only be in black and
48white.</p>
49
50</div>
51<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
52<div id="METHODS_CONTENT">
53
54</div>
7c40f9a1 55<h2 id="new">new</h2>
56<div id="new_CONTENT">
57<p>Create a cursor using the specified data and mask (in MSB format). The cursor width must be a multiple of 8 bits.</p>
58<p>The cursor is created in black and white according to the following:</p>
59<pre> Data / Mask Resulting pixel on screen
60 0 / 1 White
61 1 / 1 Black
62 0 / 0 Transparent
63 1 / 0 Inverted color if possible, black if not.
162a0989 64
7c40f9a1 65</pre>
66<p>Cursors created with this function must be freed with SDL_FreeCursor.</p>
67<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::Cursor-</code>new&gt;
68and in your main loop, when you draw graphics, also draw a <code>SDL::Surface</code> at the location of the mouse cursor. </p>
69<p>Example:</p>
70<pre> use SDL;
71 use SDL::Cursor;
72 use SDL::Mouse;
73 use SDL::Video;
37af21e0 74
7c40f9a1 75 SDL::init(SDL_INIT_VIDEO);
76 SDL::Video::set_video_mode( 640, 480, 16, SDL_SWSURFACE);
37af21e0 77
7c40f9a1 78 my @data = (
79 0b00000000,
80 0b00111100,
81 0b01111110,
82 0b01111110,
83 0b01111110,
84 0b01111110,
85 0b00111100,
86 0b00000000
87 );
37af21e0 88
7c40f9a1 89 my @mask = (
90 0b00111100,
91 0b01111110,
92 0b11100111,
93 0b11000011,
94 0b11000011,
95 0b11100111,
96 0b01111110,
97 0b00111100
98 );
99
100 my $cursor = SDL::Cursor-&gt;new( \@data, \@mask, 8, 8, 0, 0 );
101
102 sleep(1);
103 SDL::Mouse::set_cursor($cursor);
104
105 sleep(5);
106
107</pre>
37af21e0 108
109</div>
162a0989 110<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
111<div id="AUTHOR_CONTENT">
7c40f9a1 112<p>David J. Goehrig, Tobias Leich</p>
162a0989 113
114</div>
115<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
116<div id="SEE_ALSO_CONTENT">
55bbf7a2 117<p><a href="http://search.cpan.org/perldoc?perl">perl</a> <a href="SDL-Mouse.html">SDL::Mouse</a></p>
162a0989 118
119</div>
120</div>