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