/[projet1]/public/pc/emulators/caloric/libs_windows/SDL/docs/html/sdlcreatecursor.html
Defence Force logotype

Contents of /public/pc/emulators/caloric/libs_windows/SDL/docs/html/sdlcreatecursor.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 81 - (show annotations)
Wed May 27 20:33:03 2009 UTC (10 years, 3 months ago) by Jede
File MIME type: text/html
File size: 6141 byte(s)
Ajouts des libs windows
1 <HTML
2 ><HEAD
3 ><TITLE
4 >SDL_CreateCursor</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
8 "><LINK
9 REL="HOME"
10 TITLE="SDL Library Documentation"
11 HREF="index.html"><LINK
12 REL="UP"
13 TITLE="Video"
14 HREF="video.html"><LINK
15 REL="PREVIOUS"
16 TITLE="SDL_WarpMouse"
17 HREF="sdlwarpmouse.html"><LINK
18 REL="NEXT"
19 TITLE="SDL_FreeCursor"
20 HREF="sdlfreecursor.html"></HEAD
21 ><BODY
22 CLASS="REFENTRY"
23 BGCOLOR="#FFF8DC"
24 TEXT="#000000"
25 LINK="#0000ee"
26 VLINK="#551a8b"
27 ALINK="#ff0000"
28 ><DIV
29 CLASS="NAVHEADER"
30 ><TABLE
31 SUMMARY="Header navigation table"
32 WIDTH="100%"
33 BORDER="0"
34 CELLPADDING="0"
35 CELLSPACING="0"
36 ><TR
37 ><TH
38 COLSPAN="3"
39 ALIGN="center"
40 >SDL Library Documentation</TH
41 ></TR
42 ><TR
43 ><TD
44 WIDTH="10%"
45 ALIGN="left"
46 VALIGN="bottom"
47 ><A
48 HREF="sdlwarpmouse.html"
49 ACCESSKEY="P"
50 >Prev</A
51 ></TD
52 ><TD
53 WIDTH="80%"
54 ALIGN="center"
55 VALIGN="bottom"
56 ></TD
57 ><TD
58 WIDTH="10%"
59 ALIGN="right"
60 VALIGN="bottom"
61 ><A
62 HREF="sdlfreecursor.html"
63 ACCESSKEY="N"
64 >Next</A
65 ></TD
66 ></TR
67 ></TABLE
68 ><HR
69 ALIGN="LEFT"
70 WIDTH="100%"></DIV
71 ><H1
72 ><A
73 NAME="SDLCREATECURSOR"
74 ></A
75 >SDL_CreateCursor</H1
76 ><DIV
77 CLASS="REFNAMEDIV"
78 ><A
79 NAME="AEN2487"
80 ></A
81 ><H2
82 >Name</H2
83 >SDL_CreateCursor&nbsp;--&nbsp;Creates a new mouse cursor.</DIV
84 ><DIV
85 CLASS="REFSYNOPSISDIV"
86 ><A
87 NAME="AEN2490"
88 ></A
89 ><H2
90 >Synopsis</H2
91 ><DIV
92 CLASS="FUNCSYNOPSIS"
93 ><A
94 NAME="AEN2491"
95 ></A
96 ><P
97 ></P
98 ><PRE
99 CLASS="FUNCSYNOPSISINFO"
100 >#include "SDL.h"</PRE
101 ><P
102 ><CODE
103 ><CODE
104 CLASS="FUNCDEF"
105 >SDL_Cursor *<B
106 CLASS="FSFUNC"
107 >SDL_CreateCursor</B
108 ></CODE
109 >(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);</CODE
110 ></P
111 ><P
112 ></P
113 ></DIV
114 ></DIV
115 ><DIV
116 CLASS="REFSECT1"
117 ><A
118 NAME="AEN2497"
119 ></A
120 ><H2
121 >Description</H2
122 ><P
123 >Create a cursor using the specified <TT
124 CLASS="PARAMETER"
125 ><I
126 >data</I
127 ></TT
128 > and <TT
129 CLASS="PARAMETER"
130 ><I
131 >mask</I
132 ></TT
133 > (in MSB format).
134 The cursor width must be a multiple of 8 bits.</P
135 ><P
136 >The cursor is created in black and white according to the following:
137 <DIV
138 CLASS="INFORMALTABLE"
139 ><A
140 NAME="AEN2503"
141 ></A
142 ><P
143 ></P
144 ><TABLE
145 BORDER="1"
146 CLASS="CALSTABLE"
147 ><THEAD
148 ><TR
149 ><TH
150 ALIGN="LEFT"
151 VALIGN="TOP"
152 >Data / Mask</TH
153 ><TH
154 ALIGN="LEFT"
155 VALIGN="TOP"
156 >Resulting pixel on screen</TH
157 ></TR
158 ></THEAD
159 ><TBODY
160 ><TR
161 ><TD
162 ALIGN="LEFT"
163 VALIGN="TOP"
164 >0 / 1</TD
165 ><TD
166 ALIGN="LEFT"
167 VALIGN="TOP"
168 >White</TD
169 ></TR
170 ><TR
171 ><TD
172 ALIGN="LEFT"
173 VALIGN="TOP"
174 >1 / 1</TD
175 ><TD
176 ALIGN="LEFT"
177 VALIGN="TOP"
178 >Black</TD
179 ></TR
180 ><TR
181 ><TD
182 ALIGN="LEFT"
183 VALIGN="TOP"
184 >0 / 0</TD
185 ><TD
186 ALIGN="LEFT"
187 VALIGN="TOP"
188 >Transparent</TD
189 ></TR
190 ><TR
191 ><TD
192 ALIGN="LEFT"
193 VALIGN="TOP"
194 >1 / 0</TD
195 ><TD
196 ALIGN="LEFT"
197 VALIGN="TOP"
198 >Inverted color if possible, black if not.</TD
199 ></TR
200 ></TBODY
201 ></TABLE
202 ><P
203 ></P
204 ></DIV
205 ></P
206 ><P
207 >Cursors created with this function must be freed with
208 <A
209 HREF="sdlfreecursor.html"
210 >SDL_FreeCursor</A
211 >.</P
212 ></DIV
213 ><DIV
214 CLASS="REFSECT1"
215 ><A
216 NAME="AEN2524"
217 ></A
218 ><H2
219 >Example</H2
220 ><PRE
221 CLASS="PROGRAMLISTING"
222 >/* Stolen from the mailing list */
223 /* Creates a new mouse cursor from an XPM */
224
225
226 /* XPM */
227 static const char *arrow[] = {
228 /* width height num_colors chars_per_pixel */
229 " 32 32 3 1",
230 /* colors */
231 "X c #000000",
232 ". c #ffffff",
233 " c None",
234 /* pixels */
235 "X ",
236 "XX ",
237 "X.X ",
238 "X..X ",
239 "X...X ",
240 "X....X ",
241 "X.....X ",
242 "X......X ",
243 "X.......X ",
244 "X........X ",
245 "X.....XXXXX ",
246 "X..X..X ",
247 "X.X X..X ",
248 "XX X..X ",
249 "X X..X ",
250 " X..X ",
251 " X..X ",
252 " X..X ",
253 " XX ",
254 " ",
255 " ",
256 " ",
257 " ",
258 " ",
259 " ",
260 " ",
261 " ",
262 " ",
263 " ",
264 " ",
265 " ",
266 " ",
267 "0,0"
268 };
269
270 static SDL_Cursor *init_system_cursor(const char *image[])
271 {
272 int i, row, col;
273 Uint8 data[4*32];
274 Uint8 mask[4*32];
275 int hot_x, hot_y;
276
277 i = -1;
278 for ( row=0; row&#60;32; ++row ) {
279 for ( col=0; col&#60;32; ++col ) {
280 if ( col % 8 ) {
281 data[i] &#60;&#60;= 1;
282 mask[i] &#60;&#60;= 1;
283 } else {
284 ++i;
285 data[i] = mask[i] = 0;
286 }
287 switch (image[4+row][col]) {
288 case 'X':
289 data[i] |= 0x01;
290 mask[i] |= 0x01;
291 break;
292 case '.':
293 mask[i] |= 0x01;
294 break;
295 case ' ':
296 break;
297 }
298 }
299 }
300 sscanf(image[4+row], "%d,%d", &#38;hot_x, &#38;hot_y);
301 return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);
302 }</PRE
303 ></DIV
304 ><DIV
305 CLASS="REFSECT1"
306 ><A
307 NAME="AEN2527"
308 ></A
309 ><H2
310 >See Also</H2
311 ><P
312 ><A
313 HREF="sdlfreecursor.html"
314 ><TT
315 CLASS="FUNCTION"
316 >SDL_FreeCursor</TT
317 ></A
318 >,
319 <A
320 HREF="sdlsetcursor.html"
321 ><TT
322 CLASS="FUNCTION"
323 >SDL_SetCursor</TT
324 ></A
325 >,
326 <A
327 HREF="sdlshowcursor.html"
328 ><TT
329 CLASS="FUNCTION"
330 >SDL_ShowCursor</TT
331 ></A
332 ></P
333 ></DIV
334 ><DIV
335 CLASS="NAVFOOTER"
336 ><HR
337 ALIGN="LEFT"
338 WIDTH="100%"><TABLE
339 SUMMARY="Footer navigation table"
340 WIDTH="100%"
341 BORDER="0"
342 CELLPADDING="0"
343 CELLSPACING="0"
344 ><TR
345 ><TD
346 WIDTH="33%"
347 ALIGN="left"
348 VALIGN="top"
349 ><A
350 HREF="sdlwarpmouse.html"
351 ACCESSKEY="P"
352 >Prev</A
353 ></TD
354 ><TD
355 WIDTH="34%"
356 ALIGN="center"
357 VALIGN="top"
358 ><A
359 HREF="index.html"
360 ACCESSKEY="H"
361 >Home</A
362 ></TD
363 ><TD
364 WIDTH="33%"
365 ALIGN="right"
366 VALIGN="top"
367 ><A
368 HREF="sdlfreecursor.html"
369 ACCESSKEY="N"
370 >Next</A
371 ></TD
372 ></TR
373 ><TR
374 ><TD
375 WIDTH="33%"
376 ALIGN="left"
377 VALIGN="top"
378 >SDL_WarpMouse</TD
379 ><TD
380 WIDTH="34%"
381 ALIGN="center"
382 VALIGN="top"
383 ><A
384 HREF="video.html"
385 ACCESSKEY="U"
386 >Up</A
387 ></TD
388 ><TD
389 WIDTH="33%"
390 ALIGN="right"
391 VALIGN="top"
392 >SDL_FreeCursor</TD
393 ></TR
394 ></TABLE
395 ></DIV
396 ></BODY
397 ></HTML
398 >

  ViewVC Help
Powered by ViewVC 1.1.26