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

📄 sprite.h

📁 数据挖掘中de一个算法 hamster的实例
💻 H
字号:
/*----------------------------------------------------------------------  File    : sprite.h  Contents: sprite management, single color (X11 version)  Author  : Christian Borgelt  History : 30.10.1997 file created            31.10.1997 first version completed            01.11.1997 application context added to function spr_create            02.11.1997 separate graphics context for buffer removed            04.11.1997 move function changed to timeout procedure            06.11.1997 callback function added to function spr_move            16.06.1998 fields xnew and ynew added to structure SPRITE----------------------------------------------------------------------*/#ifndef __SPRITE__#define __SPRITE__#include <limits.h>#include <X11/Xlib.h>#include <X11/Intrinsic.h>/*----------------------------------------------------------------------  Type Definitions----------------------------------------------------------------------*/typedef struct {                /* --- sprite --- */  int            xext, yext;    /* x- and y-extension of sprite */  int            xoff, yoff;    /* x- and y-offset to current image */  int            xnew, ynew;    /* x- and y-offset to new image */  int            xpos, ypos;    /* current position of sprite */  short          drawn;         /* flag whether sprite is drawn */  XtAppContext   appctx;        /* application context */  Widget         widget;        /* widget sprite is drawn into */  Display        *display;      /* display connected to */  Window         window;        /* window of widget */  Pixmap         buffer;        /* buffer for background */  GC             gc;            /* graphics context */  XtIntervalId   iid;           /* id of time interval procedure */  XtCallbackProc cback;         /* callback function for spr_move */  XtPointer      data;          /* client data for callback function */  int            dx, dy, di;    /* increments for movement */  int            cnt;           /* number of steps for movement */  unsigned int   delay;         /* delay for one step (milliseconds) */} SPRITE;                       /* (sprite) *//*----------------------------------------------------------------------  Functions----------------------------------------------------------------------*/extern SPRITE* spr_create (Widget widget, int xext, int yext,                           Pixmap bitmap, unsigned long color);extern void    spr_delete (SPRITE *spr);extern void    spr_pos    (SPRITE *spr, int *x, int *y);extern void    spr_select (SPRITE *spr, int series, int index);extern int     spr_draw   (SPRITE *spr, int x, int y);extern int     spr_undraw (SPRITE *spr);extern int     spr_move   (SPRITE *spr, int dx, int dy, int di,                           int cnt, float delay,                           XtCallbackProc callback, XtPointer data);extern void    spr_stop   (SPRITE *spr);extern int     spr_busy   (SPRITE *spr);/*----------------------------------------------------------------------  Preprocessor Definitions----------------------------------------------------------------------*/#define spr_pos(s,x,y)    (*(x) = (s)->xpos, *(y) = (s)->ypos)#define spr_busy(s)       ((s)->cnt > 0)#endif

⌨️ 快捷键说明

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