bubble.h
资源名称:泡泡龙源代码.zip [点击查看]
上传用户:junwei_58
上传日期:2007-05-15
资源大小:79k
文件大小:2k
源码类别:
其他智力游戏
开发平台:
Visual C++
- #ifndef BUBBLE_H
- #define BUBBLE_H
- #include "vbe.h"
- #define HIGHSCORE "highscor.dat"
- #define KEY_UP KEY_up
- #define KEY_DOWN KEY_down
- #define KEY_LEFT KEY_left
- #define KEY_RIGHT KEY_right
- #define KEY_ACTION KEY_space
- #define KEY_EXIT KEY_esc
- #define BKGROUNDCOLOR 0
- #define ARROWCOLOR 1
- #define BORDERCOLOR 2
- #define TEXTCOLOR 3
- #define TEXTCOLOR2 4
- #define MAXX 800
- #define MAXY 560
- #ifdef EXTERN
- #undef EXTERN
- #endif
- #define EXTERN extern
- #ifdef BUBBLE_CPP
- #undef EXTERN
- #define EXTERN
- #endif
- #define PRIVATE static
- #define PUBLIC
- typedef enum {
- NO_ERROR=0,
- FILE_NOT_OPEN,
- DIRECTION_NOT_DEFINED,
- ID_NOT_DEFINED,
- SELECT_ERROR
- }Errorcode;
- const int TABLEWIDTH=20;
- const int TABLEHEIGHT=18;
- const int XMAGIN=100;
- const int YMAGIN=50;
- const int BALLSIZE=30;
- typedef int Direction;
- EXTERN int musicON;
- EXTERN int soundON;
- enum BALL{
- NONE_B =0,
- BLUE_B =1,
- GREEN_B =2,
- CYAN_B =3,
- RED_B =4,
- MAGENTA_B =5,
- BROWN_B =6,
- LIGHTGRAY_B =7,
- DARKGRAY_B =8,
- LIGHTBLUE_B =9,
- LIGHTGREEN_B =10,
- LIGHTCYAN_B =11,
- LIGHTRED_B =12,
- LIGHTMAGENTA_B =13,
- YELLOW_B =14,
- WHITE_B =15,
- };
- // x y
- EXTERN BALL table[TABLEWIDTH][TABLEHEIGHT];
- EXTERN char tableT[TABLEWIDTH][TABLEHEIGHT];
- EXTERN BALL tempBall;
- EXTERN char colortable[16];
- EXTERN int colorNum;
- class object {
- public:
- object();
- ~object();
- void turn(Direction);
- void eject();
- void start();
- void hidePointer();
- void showPointer();
- void move();
- void showball();
- unsigned long getscore(){return score;}
- void AIcontrol();
- private:
- int ply;//player who? red or blue?
- int direct,dd,did;
- unsigned long score;
- int sx,sy;
- int t;
- BALL nextBall;
- };
- class ball{
- public:
- ball(int X,int Y,int d,BALL b):direct(d),color(b),x(X),y(Y),speed(1){}
- ~ball(){}
- int check();
- int move();
- int solid();
- void bump(){direct=-direct;}
- private:
- int direct;
- BALL color;
- float x,y;
- int speed;
- };
- EXTERN object *ob;
- EXTERN object *ob2;
- /*======================*
- Function declarations
- *======================*/
- EXTERN void seekActions();
- EXTERN void exitgame();
- //void message(char *,int p=0);
- EXTERN void thegameloop();
- #endif