GridPicture.h
资源名称:连连看源程序.rar [点击查看]
上传用户:z3308516
上传日期:2013-01-23
资源大小:703k
文件大小:3k
源码类别:
2D图形编程
开发平台:
Visual C++
- #pragma once
- /*
- author:snk12
- phone:13816097632
- 每消掉一个就重排相应的标签
- 消掉时产生声音---------------
- |同时,然后计算剩下的图像是否可以继续游戏下去,不行就重排
- 消掉时产生爆炸画面-----------
- 2次重排的道具
- 3次查找的道具
- 可以打出2次重排的道具
- 可以打出2次查找的道具
- 清掉以后为-1
- 计分,根据时间计分,跟具道具使用的次数计分,跟具难益度计分
- 12X7 21 easy
- 14X8 28 normal
- 16X9 36 complex
- typedef struct{
- byte flags; //flags&1=top flags&2=left flags&4=right flags&8=bottom
- long resourceid; //装要载入的图片ID
- }
- */
- typedef struct{
- long resourceid; //装要载入的图片ID
- RECT rc;
- }SINGLE_BLOCK,*PSINGLE_BLOCK;
- typedef struct{
- HWND hParent;
- RECT rc;
- }EXPLORE_STRUCT,*PEXPLORE_STRUCT;
- typedef enum{
- enumAny,
- enumRight,
- enumLeft,
- enumUP,
- enumDown}SEARCH_OPERATOR,*PSEARCH_OPERATOR;
- class CGridPicture
- {
- public:
- CGridPicture();
- ~CGridPicture(void);
- void CGridPictureInit(HWND hParent,int iHorz,int iVert,long lThumb,BOOL bSpecial=FALSE);
- void Draw(HDC hDC,PSINGLE_BLOCK arrayPic=arrayPic);
- // static void DrawToMemDC(HDC hDC,PSINGLE_BLOCK arrayPic);
- void Shuffle();
- bool Picture_Click(POINT &ptPos);
- void Discard();
- static int QueryResourceID(int ids,int idq);
- static LRESULT CALLBACK ThreadExplore(LPARAM lParam);
- static LRESULT CALLBACK ThreadWatch(LPARAM lParam);
- bool isCanLink(int id1,int id2,SEARCH_OPERATOR se,bool bfirst=true,int recur=3);
- static void FoundLink(CGridPicture *pgrid,int *id1,int *id2,BOOL &bFound);
- void SetSelect(int id);
- void DrawLinkLine(int id1,int id2);
- void Explore(int id1,int id2);
- void SetFenLevel(int ifen,int ilevel,int lv=0);
- void OrderPicture(int id1,int id2);
- void GetLevelAndFen(int &ifen,int &lv);
- void OutputWin(char * pszInfo);
- void CancelFocus();
- void ReadMap(LPCTSTR id);
- BOOL GetSound(){return bSound;}
- void SetSound(BOOL bSound){this->bSound=bSound;}
- protected:
- void ParsePosAndInvalidate(int id,BOOL bClear=FALSE);
- void Play(LPCTSTR pszRes);
- bool CanDirectToTop(int idq);
- bool CanDirectToLeft(int idq);
- bool CanDirectToRight(int idq);
- bool CanDirectToBottom(int idq);
- private:
- static HWND hParent;
- HBITMAP allThumb;
- POINT startPoint; //起点
- static int horzNum; //横向数目
- static int vertNum; //纵向数目
- static int picNum; //不同图案的数目
- static BOOL bTerminate; //是否可以继续GAME
- int focusid;
- BOOL bSound;
- BOOL bSpecial;
- int lv;
- int leftEdge;
- int rightEdge;
- int topEdge;
- int bottomEdge;
- int lThumb;
- int ifen;
- int ilevel;
- static SINGLE_BLOCK *arrayPic;
- HDC tempDC; //整体的THUMB存储的地方
- RECT rcPicture_region; //图片所占的位置空间
- PEXPLORE_STRUCT pe;
- BOOL bFirstDraw;
- POINT pt1,pt2;
- ///temp
- int picture_height;
- };