Mercurial > sdl-ios-xcode
annotate docs/html/sdlcreatecursor.html @ 910:4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
From: "Mike Gorchak"
Subject: QNX 6.3 fixes for SDL
Sam, I've added new OpenGL framework for SDL, which appeared in the new QNX version - 6.3. I've leave compatibility with previous QNX versions. And I've moved all GL specific functions to the separate module, like it done for the other platforms.
SDL is now ready for the QNX 6.3 :)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 18 Jul 2004 19:46:38 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_CreateCursor</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
0 | 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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 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" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 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" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 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" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_CreateCursor</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN2487" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_CreateCursor -- Creates a new mouse cursor.</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN2490" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN2491" |
0 | 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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
118 NAME="AEN2497" |
0 | 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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
140 NAME="AEN2503" |
0 | 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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
216 NAME="AEN2524" |
0 | 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<32; ++row ) { | |
279 for ( col=0; col<32; ++col ) { | |
280 if ( col % 8 ) { | |
281 data[i] <<= 1; | |
282 mask[i] <<= 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; | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
290 mask[i] |= 0x01; |
0 | 291 break; |
292 case '.': | |
293 mask[i] |= 0x01; | |
294 break; | |
295 case ' ': | |
296 break; | |
297 } | |
298 } | |
299 } | |
300 sscanf(image[4+row], "%d,%d", &hot_x, &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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
307 NAME="AEN2527" |
0 | 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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
339 SUMMARY="Footer navigation table" |
0 | 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" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
351 ACCESSKEY="P" |
0 | 352 >Prev</A |
353 ></TD | |
354 ><TD | |
355 WIDTH="34%" | |
356 ALIGN="center" | |
357 VALIGN="top" | |
358 ><A | |
359 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
360 ACCESSKEY="H" |
0 | 361 >Home</A |
362 ></TD | |
363 ><TD | |
364 WIDTH="33%" | |
365 ALIGN="right" | |
366 VALIGN="top" | |
367 ><A | |
368 HREF="sdlfreecursor.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
369 ACCESSKEY="N" |
0 | 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" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
385 ACCESSKEY="U" |
0 | 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 > |