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

📄 rectangleview.h

📁 VC++制作的方块小游戏 游戏方法有点儿像祖马宝石方块
💻 H
字号:
// RectangleView.h : interface of the CRectangleView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_RECTANGLEVIEW_H__7943730E_CA34_40D0_8337_111850D12FFC__INCLUDED_)
#define AFX_RECTANGLEVIEW_H__7943730E_CA34_40D0_8337_111850D12FFC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//frame
#define OUTERY 62
#define OUTERX 2
//element
#define EDGE 32
#define NUM 13
#define SIDE 32
//combo
#define GAMEAREA 224
#define GAMEAREASIDE 11
#define SCOREAREA 120
#define NEXTBAR 60 
#define GAMEY 384
//bitmap
#define RECT 0
#define BOMB 1
#define FRAME 2
#define NEXT 3
#define SCORE 4
#define GAMEOVER 5
#define START 6
#define BOARD 7
#define NUMBER 8
#define COMBO 9
#define LEVELUP 10
#define ITEM 11


//gamemode
#define NORMAL 0
#define PUZZLE 1

typedef struct normaldifficulty{
    int colornum;    //颜色数量
	int time;        //上涨回合
	int bombrate;    //得到炸弹的概率
	int rewardrate;  //得到其他的概率
	int standard;
}ND;

typedef struct gem{
    int pro;    //0-rect 1-bomb 2-reward
	int num;    
}G;

class CRectangleView : public CView
{
protected: // create from serialization only
	CRectangleView();
	DECLARE_DYNCREATE(CRectangleView)

// Attributes
public:
	CRectangleDoc* GetDocument();

	CRect curRect;     //全部屏幕
	CRect scrollRect;  //滚动方块
	CRect gameRect;    //游戏窗口
	CRect nextGem;
	CRect tempRect;

	G grid[12][7];
	int mark[12][7];

	bool gamestart;
	bool win;
	bool lose;
	bool showlevel;
	int normallevel;
	int puzzlelevel;
	ND nd[12];
	int curtime;
	int curscore;
	int curcombo;
	int maxcombo;
	G curG,nextG;
	int toprect;    //待降下来的方块位置
	int pos;        //下降列位置
	int lastpos;    //最后下降到的行
	int nowpos;     //现在下降到的行
	int d[8][2];
	int gamemode;
	
	FILE *fpstage;
	FILE *fprect;

// Operations
public:
	void randRect(G *gem);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRectangleView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	//}}AFX_VIRTUAL

// Implementation
public:
	bool puzzlewin();
	bool inArea(int x,int y);
	void fill();
	int dfs(int x,int y,int tag);
	bool canlose();
	void addlastline();
	void bobo();
	void drop();
	virtual ~CRectangleView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CRectangleView)
	afx_msg void OnNormal();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnPuzzle();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in RectangleView.cpp
inline CRectangleDoc* CRectangleView::GetDocument()
   { return (CRectangleDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RECTANGLEVIEW_H__7943730E_CA34_40D0_8337_111850D12FFC__INCLUDED_)

⌨️ 快捷键说明

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