docs/html/sdlcreatecursor.html
changeset 3352 6dc250ebdd80
parent 3351 8e0182c236d8
child 3353 6b14223dd5c7
     1.1 --- a/docs/html/sdlcreatecursor.html	Wed Oct 07 06:11:53 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,398 +0,0 @@
     1.4 -<HTML
     1.5 -><HEAD
     1.6 -><TITLE
     1.7 ->SDL_CreateCursor</TITLE
     1.8 -><META
     1.9 -NAME="GENERATOR"
    1.10 -CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
    1.11 -"><LINK
    1.12 -REL="HOME"
    1.13 -TITLE="SDL Library Documentation"
    1.14 -HREF="index.html"><LINK
    1.15 -REL="UP"
    1.16 -TITLE="Video"
    1.17 -HREF="video.html"><LINK
    1.18 -REL="PREVIOUS"
    1.19 -TITLE="SDL_WarpMouse"
    1.20 -HREF="sdlwarpmouse.html"><LINK
    1.21 -REL="NEXT"
    1.22 -TITLE="SDL_FreeCursor"
    1.23 -HREF="sdlfreecursor.html"></HEAD
    1.24 -><BODY
    1.25 -CLASS="REFENTRY"
    1.26 -BGCOLOR="#FFF8DC"
    1.27 -TEXT="#000000"
    1.28 -LINK="#0000ee"
    1.29 -VLINK="#551a8b"
    1.30 -ALINK="#ff0000"
    1.31 -><DIV
    1.32 -CLASS="NAVHEADER"
    1.33 -><TABLE
    1.34 -SUMMARY="Header navigation table"
    1.35 -WIDTH="100%"
    1.36 -BORDER="0"
    1.37 -CELLPADDING="0"
    1.38 -CELLSPACING="0"
    1.39 -><TR
    1.40 -><TH
    1.41 -COLSPAN="3"
    1.42 -ALIGN="center"
    1.43 ->SDL Library Documentation</TH
    1.44 -></TR
    1.45 -><TR
    1.46 -><TD
    1.47 -WIDTH="10%"
    1.48 -ALIGN="left"
    1.49 -VALIGN="bottom"
    1.50 -><A
    1.51 -HREF="sdlwarpmouse.html"
    1.52 -ACCESSKEY="P"
    1.53 ->Prev</A
    1.54 -></TD
    1.55 -><TD
    1.56 -WIDTH="80%"
    1.57 -ALIGN="center"
    1.58 -VALIGN="bottom"
    1.59 -></TD
    1.60 -><TD
    1.61 -WIDTH="10%"
    1.62 -ALIGN="right"
    1.63 -VALIGN="bottom"
    1.64 -><A
    1.65 -HREF="sdlfreecursor.html"
    1.66 -ACCESSKEY="N"
    1.67 ->Next</A
    1.68 -></TD
    1.69 -></TR
    1.70 -></TABLE
    1.71 -><HR
    1.72 -ALIGN="LEFT"
    1.73 -WIDTH="100%"></DIV
    1.74 -><H1
    1.75 -><A
    1.76 -NAME="SDLCREATECURSOR"
    1.77 -></A
    1.78 ->SDL_CreateCursor</H1
    1.79 -><DIV
    1.80 -CLASS="REFNAMEDIV"
    1.81 -><A
    1.82 -NAME="AEN2487"
    1.83 -></A
    1.84 -><H2
    1.85 ->Name</H2
    1.86 ->SDL_CreateCursor&nbsp;--&nbsp;Creates a new mouse cursor.</DIV
    1.87 -><DIV
    1.88 -CLASS="REFSYNOPSISDIV"
    1.89 -><A
    1.90 -NAME="AEN2490"
    1.91 -></A
    1.92 -><H2
    1.93 ->Synopsis</H2
    1.94 -><DIV
    1.95 -CLASS="FUNCSYNOPSIS"
    1.96 -><A
    1.97 -NAME="AEN2491"
    1.98 -></A
    1.99 -><P
   1.100 -></P
   1.101 -><PRE
   1.102 -CLASS="FUNCSYNOPSISINFO"
   1.103 ->#include "SDL.h"</PRE
   1.104 -><P
   1.105 -><CODE
   1.106 -><CODE
   1.107 -CLASS="FUNCDEF"
   1.108 ->SDL_Cursor *<B
   1.109 -CLASS="FSFUNC"
   1.110 ->SDL_CreateCursor</B
   1.111 -></CODE
   1.112 ->(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);</CODE
   1.113 -></P
   1.114 -><P
   1.115 -></P
   1.116 -></DIV
   1.117 -></DIV
   1.118 -><DIV
   1.119 -CLASS="REFSECT1"
   1.120 -><A
   1.121 -NAME="AEN2497"
   1.122 -></A
   1.123 -><H2
   1.124 ->Description</H2
   1.125 -><P
   1.126 ->Create a cursor using the specified <TT
   1.127 -CLASS="PARAMETER"
   1.128 -><I
   1.129 ->data</I
   1.130 -></TT
   1.131 -> and <TT
   1.132 -CLASS="PARAMETER"
   1.133 -><I
   1.134 ->mask</I
   1.135 -></TT
   1.136 -> (in MSB format).
   1.137 -The cursor width must be a multiple of 8 bits.</P
   1.138 -><P
   1.139 ->The cursor is created in black and white according to the following:
   1.140 -<DIV
   1.141 -CLASS="INFORMALTABLE"
   1.142 -><A
   1.143 -NAME="AEN2503"
   1.144 -></A
   1.145 -><P
   1.146 -></P
   1.147 -><TABLE
   1.148 -BORDER="1"
   1.149 -CLASS="CALSTABLE"
   1.150 -><THEAD
   1.151 -><TR
   1.152 -><TH
   1.153 -ALIGN="LEFT"
   1.154 -VALIGN="TOP"
   1.155 ->Data / Mask</TH
   1.156 -><TH
   1.157 -ALIGN="LEFT"
   1.158 -VALIGN="TOP"
   1.159 ->Resulting pixel on screen</TH
   1.160 -></TR
   1.161 -></THEAD
   1.162 -><TBODY
   1.163 -><TR
   1.164 -><TD
   1.165 -ALIGN="LEFT"
   1.166 -VALIGN="TOP"
   1.167 ->0 / 1</TD
   1.168 -><TD
   1.169 -ALIGN="LEFT"
   1.170 -VALIGN="TOP"
   1.171 ->White</TD
   1.172 -></TR
   1.173 -><TR
   1.174 -><TD
   1.175 -ALIGN="LEFT"
   1.176 -VALIGN="TOP"
   1.177 ->1 / 1</TD
   1.178 -><TD
   1.179 -ALIGN="LEFT"
   1.180 -VALIGN="TOP"
   1.181 ->Black</TD
   1.182 -></TR
   1.183 -><TR
   1.184 -><TD
   1.185 -ALIGN="LEFT"
   1.186 -VALIGN="TOP"
   1.187 ->0 / 0</TD
   1.188 -><TD
   1.189 -ALIGN="LEFT"
   1.190 -VALIGN="TOP"
   1.191 ->Transparent</TD
   1.192 -></TR
   1.193 -><TR
   1.194 -><TD
   1.195 -ALIGN="LEFT"
   1.196 -VALIGN="TOP"
   1.197 ->1 / 0</TD
   1.198 -><TD
   1.199 -ALIGN="LEFT"
   1.200 -VALIGN="TOP"
   1.201 ->Inverted color if possible, black if not.</TD
   1.202 -></TR
   1.203 -></TBODY
   1.204 -></TABLE
   1.205 -><P
   1.206 -></P
   1.207 -></DIV
   1.208 -></P
   1.209 -><P
   1.210 ->Cursors created with this function must be freed with
   1.211 -<A
   1.212 -HREF="sdlfreecursor.html"
   1.213 ->SDL_FreeCursor</A
   1.214 ->.</P
   1.215 -></DIV
   1.216 -><DIV
   1.217 -CLASS="REFSECT1"
   1.218 -><A
   1.219 -NAME="AEN2524"
   1.220 -></A
   1.221 -><H2
   1.222 ->Example</H2
   1.223 -><PRE
   1.224 -CLASS="PROGRAMLISTING"
   1.225 ->/* Stolen from the mailing list */
   1.226 -/* Creates a new mouse cursor from an XPM */
   1.227 -
   1.228 -
   1.229 -/* XPM */
   1.230 -static const char *arrow[] = {
   1.231 -  /* width height num_colors chars_per_pixel */
   1.232 -  "    32    32        3            1",
   1.233 -  /* colors */
   1.234 -  "X c #000000",
   1.235 -  ". c #ffffff",
   1.236 -  "  c None",
   1.237 -  /* pixels */
   1.238 -  "X                               ",
   1.239 -  "XX                              ",
   1.240 -  "X.X                             ",
   1.241 -  "X..X                            ",
   1.242 -  "X...X                           ",
   1.243 -  "X....X                          ",
   1.244 -  "X.....X                         ",
   1.245 -  "X......X                        ",
   1.246 -  "X.......X                       ",
   1.247 -  "X........X                      ",
   1.248 -  "X.....XXXXX                     ",
   1.249 -  "X..X..X                         ",
   1.250 -  "X.X X..X                        ",
   1.251 -  "XX  X..X                        ",
   1.252 -  "X    X..X                       ",
   1.253 -  "     X..X                       ",
   1.254 -  "      X..X                      ",
   1.255 -  "      X..X                      ",
   1.256 -  "       XX                       ",
   1.257 -  "                                ",
   1.258 -  "                                ",
   1.259 -  "                                ",
   1.260 -  "                                ",
   1.261 -  "                                ",
   1.262 -  "                                ",
   1.263 -  "                                ",
   1.264 -  "                                ",
   1.265 -  "                                ",
   1.266 -  "                                ",
   1.267 -  "                                ",
   1.268 -  "                                ",
   1.269 -  "                                ",
   1.270 -  "0,0"
   1.271 -};
   1.272 -
   1.273 -static SDL_Cursor *init_system_cursor(const char *image[])
   1.274 -{
   1.275 -  int i, row, col;
   1.276 -  Uint8 data[4*32];
   1.277 -  Uint8 mask[4*32];
   1.278 -  int hot_x, hot_y;
   1.279 -
   1.280 -  i = -1;
   1.281 -  for ( row=0; row&#60;32; ++row ) {
   1.282 -    for ( col=0; col&#60;32; ++col ) {
   1.283 -      if ( col % 8 ) {
   1.284 -        data[i] &#60;&#60;= 1;
   1.285 -        mask[i] &#60;&#60;= 1;
   1.286 -      } else {
   1.287 -        ++i;
   1.288 -        data[i] = mask[i] = 0;
   1.289 -      }
   1.290 -      switch (image[4+row][col]) {
   1.291 -        case 'X':
   1.292 -          data[i] |= 0x01;
   1.293 -          mask[i] |= 0x01;
   1.294 -          break;
   1.295 -        case '.':
   1.296 -          mask[i] |= 0x01;
   1.297 -          break;
   1.298 -        case ' ':
   1.299 -          break;
   1.300 -      }
   1.301 -    }
   1.302 -  }
   1.303 -  sscanf(image[4+row], "%d,%d", &#38;hot_x, &#38;hot_y);
   1.304 -  return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);
   1.305 -}</PRE
   1.306 -></DIV
   1.307 -><DIV
   1.308 -CLASS="REFSECT1"
   1.309 -><A
   1.310 -NAME="AEN2527"
   1.311 -></A
   1.312 -><H2
   1.313 ->See Also</H2
   1.314 -><P
   1.315 -><A
   1.316 -HREF="sdlfreecursor.html"
   1.317 -><TT
   1.318 -CLASS="FUNCTION"
   1.319 ->SDL_FreeCursor</TT
   1.320 -></A
   1.321 ->,
   1.322 -<A
   1.323 -HREF="sdlsetcursor.html"
   1.324 -><TT
   1.325 -CLASS="FUNCTION"
   1.326 ->SDL_SetCursor</TT
   1.327 -></A
   1.328 ->,
   1.329 -<A
   1.330 -HREF="sdlshowcursor.html"
   1.331 -><TT
   1.332 -CLASS="FUNCTION"
   1.333 ->SDL_ShowCursor</TT
   1.334 -></A
   1.335 -></P
   1.336 -></DIV
   1.337 -><DIV
   1.338 -CLASS="NAVFOOTER"
   1.339 -><HR
   1.340 -ALIGN="LEFT"
   1.341 -WIDTH="100%"><TABLE
   1.342 -SUMMARY="Footer navigation table"
   1.343 -WIDTH="100%"
   1.344 -BORDER="0"
   1.345 -CELLPADDING="0"
   1.346 -CELLSPACING="0"
   1.347 -><TR
   1.348 -><TD
   1.349 -WIDTH="33%"
   1.350 -ALIGN="left"
   1.351 -VALIGN="top"
   1.352 -><A
   1.353 -HREF="sdlwarpmouse.html"
   1.354 -ACCESSKEY="P"
   1.355 ->Prev</A
   1.356 -></TD
   1.357 -><TD
   1.358 -WIDTH="34%"
   1.359 -ALIGN="center"
   1.360 -VALIGN="top"
   1.361 -><A
   1.362 -HREF="index.html"
   1.363 -ACCESSKEY="H"
   1.364 ->Home</A
   1.365 -></TD
   1.366 -><TD
   1.367 -WIDTH="33%"
   1.368 -ALIGN="right"
   1.369 -VALIGN="top"
   1.370 -><A
   1.371 -HREF="sdlfreecursor.html"
   1.372 -ACCESSKEY="N"
   1.373 ->Next</A
   1.374 -></TD
   1.375 -></TR
   1.376 -><TR
   1.377 -><TD
   1.378 -WIDTH="33%"
   1.379 -ALIGN="left"
   1.380 -VALIGN="top"
   1.381 ->SDL_WarpMouse</TD
   1.382 -><TD
   1.383 -WIDTH="34%"
   1.384 -ALIGN="center"
   1.385 -VALIGN="top"
   1.386 -><A
   1.387 -HREF="video.html"
   1.388 -ACCESSKEY="U"
   1.389 ->Up</A
   1.390 -></TD
   1.391 -><TD
   1.392 -WIDTH="33%"
   1.393 -ALIGN="right"
   1.394 -VALIGN="top"
   1.395 ->SDL_FreeCursor</TD
   1.396 -></TR
   1.397 -></TABLE
   1.398 -></DIV
   1.399 -></BODY
   1.400 -></HTML
   1.401 ->
   1.402 \ No newline at end of file