sprite.h

来自「数据挖掘中de一个算法 hamster的实例」· C头文件 代码 · 共 51 行

H
51
字号
/*----------------------------------------------------------------------  File    : sprite.h  Contents: sprite management (Microsoft Windows Version)  Author  : Christian Borgelt  History : 15.10.1997 file created            31.10.1997 field hdc_win added to SPRITE structure----------------------------------------------------------------------*/#ifndef __SPRITE__#define __SPRITE__#include <limits.h>#include <windows.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 */  int     drawn;                /* flag whether sprite is drawn */  HWND    hwnd;                 /* window handle */  HDC     hdc_win;              /* handle of window device context */  HDC     hdc_bmp;              /* handle of sprite device context */  HBITMAP bitmap;               /* handle of sprite bitmap */  HDC     hdc_msk;              /* handle of mask device context */  HBITMAP mask;                 /* handle of mask bitmap */  HDC     hdc_buf;              /* handle of buffer device context */  HBITMAP buffer;               /* handle of background buffer */} SPRITE;                       /* (sprite) *//*----------------------------------------------------------------------  Functions----------------------------------------------------------------------*/extern SPRITE* spr_create (HWND hwnd, int xext, int yext,                           HBITMAP bitmap, HBITMAP mask);extern void    spr_delete (SPRITE *spr, int del);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);/*----------------------------------------------------------------------  Preprocessor Definitions----------------------------------------------------------------------*/#define spr_pos(s,x,y)    (*(x) = (s)->xpos, *(y) = (s)->ypos)#endif

⌨️ 快捷键说明

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