Commit | Line | Data |
162a0989 |
1 | <div class="pod"> |
2 | <!-- INDEX START --> |
3 | <h3 id="TOP">Index</h3> |
4 | |
5 | <ul><li><a href="#NAME">NAME</a></li> |
321e544d |
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> |
6830c16e |
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"> |
2f2891ef |
21 | <p>SDL::Cursor -- Mouse cursor structure</p> |
162a0989 |
22 | |
23 | </div> |
321e544d |
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> |
27 | |
28 | </div> |
162a0989 |
29 | <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p> |
30 | <div id="SYNOPSIS_CONTENT"> |
6830c16e |
31 | <pre> my $cursor = SDL::Cursor->new( |
48f19ee8 |
32 | \@data, |
67af03c9 |
33 | \@mask, |
34 | $width, |
35 | $height, |
36 | $hotspot_left, |
37 | $hotspot_top ); |
48f19ee8 |
38 | |
6830c16e |
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"> |
6830c16e |
46 | <p>the <code>SDL::Cursor</code> module handles mouse cursors, and provide the developer to |
162a0989 |
47 | use custom made cursors. Note that the cursors can only be in black and |
48 | white.</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> |
6830c16e |
55 | <h2 id="new">new</h2> |
56 | <div id="new_CONTENT"> |
48f19ee8 |
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. |
64 | |
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> |
68 | and 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; |
74 | |
75 | SDL::init(SDL_INIT_VIDEO); |
76 | SDL::Video::set_video_mode( 640, 480, 16, SDL_SWSURFACE); |
77 | |
78 | my @data = ( |
79 | 0b00000000, |
80 | 0b00111100, |
81 | 0b01111110, |
82 | 0b01111110, |
83 | 0b01111110, |
84 | 0b01111110, |
85 | 0b00111100, |
86 | 0b00000000 |
87 | ); |
88 | |
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->new( \@data, \@mask, 8, 8, 0, 0 ); |
101 | |
102 | sleep(1); |
103 | SDL::Mouse::set_cursor($cursor); |
104 | |
105 | sleep(5); |
162a0989 |
106 | |
6830c16e |
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"> |
6830c16e |
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"> |
6830c16e |
117 | <p><cite>perl</cite> <cite>SDL::Mouse</cite></p> |
162a0989 |
118 | |
119 | </div> |
120 | </div> |