连连看C语言源代码(国外英语资料)
连连看C语言源代码
/ *
* 连连看游戏c语言源代码
* /
# stdio.h > in <
# graphics.h > in <
# stdlib.h > in <
# math.h > in <
# dos.h > in <
# define true 1
# define false 0
/ * --------------------- 全局变量 ------------------------------------ * /
int bkgndcolor = black;
int bordercolor = lightgray;
int linecolor = lightblue 消除一对方块时时候的连线颜色; / * * /
/ * pb progressbar * /
int pbcolor = lightgreen;
int pby = 4;
int pbheight = 4;
int pbvalue; / * 进度条百分比, 初始值为100. * /
long starttime; / * 开始时间的秒数, 只统计分钟, 秒 * /
long totaltime; / * 游戏总共的最大秒数! * /
/ * boarddatas: small size board * /
/ * board [x] [s] [0] - 0: empty, 1) * /
/ * board [x] [s] [1] - cell's key; * /
unsigned char board [10] [10] [2];
int cellsize = 30;
int boardx = 20;
int boards = 60;
int boardwidth = 10;
int boardheight = 10;
int cellcolor = white;
int selcolor = blue; / * selcell's border rect color * /
int curcolor = red; / * curcell's border rect color * /
int eracolor = cyan; / * 用于擦除cell的颜色! * /
int pairscount; / * how much english we have put on board * /
/ * 用于存储逻辑坐标 (索引) * /
typedef struct _ tagcell
{
char x;
char y;
} cell;
cell selcell, curcell; / * 缓存前一个被选中的位置以及当前所处位置! * /
/ * scan codes define * /
keycodes enum
{
to _ esc = 0x011b,
to _ up = 0x4800, / * upward arrow * /
to _ left = 0x4b00,
to _ down = 0x5000,
to _ right = 0x4d00,
to _ space = 0x3920,
to _ p = 0x1970,
to _ return = 0x1c0d, / * and * /
};
/ * --------------------- 函数列表 ------------------------------------ * /
void initgame (char * bgipath);
playgame (void);
quitgame (void);
initprogressbar (void);
void updateprogressbar (int percent);
void drawcell (int key, int x, int y, int color);
void erasecell (int x, int y);
void drawborderrect (cell * c, int color);
void drawgameover (char * info);
int getkeycode ();
int findpath (cell * c1, cell * c2);
/ * 绘制消除方块时候的连接路径, 用指定颜色! * /
void drawpath (int x1, y1, x2 (int, int, int y2, int x, int y3 x4, int, int y4, int color);
/ * movie 函数实现 ----------------------------------- * /
/ * movie [核心算法] ----------------------