⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdlcreatecursor.html

📁 VC5.6.7的一个扩展库。跟DirectX的功能差不多。
💻 HTML
字号:
<HTML><HEAD><TITLE>SDL_CreateCursor</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="SDL Library Documentation"HREF="index.html"><LINKREL="UP"TITLE="Video"HREF="video.html"><LINKREL="PREVIOUS"TITLE="SDL_WarpMouse"HREF="sdlwarpmouse.html"><LINKREL="NEXT"TITLE="SDL_FreeCursor"HREF="sdlfreecursor.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFF8DC"TEXT="#000000"LINK="#0000ee"VLINK="#551a8b"ALINK="#ff0000"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">SDL Library Documentation</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="sdlwarpmouse.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="sdlfreecursor.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SDLCREATECURSOR"></A>SDL_CreateCursor</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN2487"></A><H2>Name</H2>SDL_CreateCursor&nbsp;--&nbsp;Creates a new mouse cursor.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN2490"></A><H2>Synopsis</H2><DIVCLASS="FUNCSYNOPSIS"><ANAME="AEN2491"></A><P></P><PRECLASS="FUNCSYNOPSISINFO">#include "SDL.h"</PRE><P><CODE><CODECLASS="FUNCDEF">SDL_Cursor *<BCLASS="FSFUNC">SDL_CreateCursor</B></CODE>(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);</CODE></P><P></P></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2497"></A><H2>Description</H2><P>Create a cursor using the specified <TTCLASS="PARAMETER"><I>data</I></TT> and <TTCLASS="PARAMETER"><I>mask</I></TT> (in MSB format).The cursor width must be a multiple of 8 bits.</P><P>The cursor is created in black and white according to the following:<DIVCLASS="INFORMALTABLE"><ANAME="AEN2503"></A><P></P><TABLEBORDER="1"CLASS="CALSTABLE"><THEAD><TR><THALIGN="LEFT"VALIGN="TOP">Data / Mask</TH><THALIGN="LEFT"VALIGN="TOP">Resulting pixel on screen</TH></TR></THEAD><TBODY><TR><TDALIGN="LEFT"VALIGN="TOP">0 / 1</TD><TDALIGN="LEFT"VALIGN="TOP">White</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">1 / 1</TD><TDALIGN="LEFT"VALIGN="TOP">Black</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">0 / 0</TD><TDALIGN="LEFT"VALIGN="TOP">Transparent</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">1 / 0</TD><TDALIGN="LEFT"VALIGN="TOP">Inverted color if possible, black if not.</TD></TR></TBODY></TABLE><P></P></DIV></P><P>Cursors created with this function must be freed with<AHREF="sdlfreecursor.html">SDL_FreeCursor</A>.</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2524"></A><H2>Example</H2><PRECLASS="PROGRAMLISTING">/* Stolen from the mailing list *//* Creates a new mouse cursor from an XPM *//* XPM */static const char *arrow[] = {  /* width height num_colors chars_per_pixel */  "    32    32        3            1",  /* colors */  "X c #000000",  ". c #ffffff",  "  c None",  /* pixels */  "X                               ",  "XX                              ",  "X.X                             ",  "X..X                            ",  "X...X                           ",  "X....X                          ",  "X.....X                         ",  "X......X                        ",  "X.......X                       ",  "X........X                      ",  "X.....XXXXX                     ",  "X..X..X                         ",  "X.X X..X                        ",  "XX  X..X                        ",  "X    X..X                       ",  "     X..X                       ",  "      X..X                      ",  "      X..X                      ",  "       XX                       ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "                                ",  "0,0"};static SDL_Cursor *init_system_cursor(const char *image[]){  int i, row, col;  Uint8 data[4*32];  Uint8 mask[4*32];  int hot_x, hot_y;  i = -1;  for ( row=0; row&#60;32; ++row ) {    for ( col=0; col&#60;32; ++col ) {      if ( col % 8 ) {        data[i] &#60;&#60;= 1;        mask[i] &#60;&#60;= 1;      } else {        ++i;        data[i] = mask[i] = 0;      }      switch (image[4+row][col]) {        case 'X':          data[i] |= 0x01;          mask[i] |= 0x01;          break;        case '.':          mask[i] |= 0x01;          break;        case ' ':          break;      }    }  }  sscanf(image[4+row], "%d,%d", &#38;hot_x, &#38;hot_y);  return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);}</PRE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2527"></A><H2>See Also</H2><P><AHREF="sdlfreecursor.html"><TTCLASS="FUNCTION">SDL_FreeCursor</TT></A>,<AHREF="sdlsetcursor.html"><TTCLASS="FUNCTION">SDL_SetCursor</TT></A>,<AHREF="sdlshowcursor.html"><TTCLASS="FUNCTION">SDL_ShowCursor</TT></A></P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="sdlwarpmouse.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="sdlfreecursor.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">SDL_WarpMouse</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="video.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">SDL_FreeCursor</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -