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

📄 mineview.h

📁 WINDOWS CE系统下EVC开发的扫雷源码,很经典,值得下载
💻 H
字号:
// MineView.h : interface of the CMineView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MineView_H__789CED0B_482F_11D4_9BDF_F4538D6D2613__INCLUDED_)
#define AFX_MineView_H__789CED0B_482F_11D4_9BDF_F4538D6D2613__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CMineView window

enum GAMESTATE{ GS_ACTIVE, GS_GAMEOVER, GS_WIN };

class CMineView : public CView
{
// Construction
public:
	CMineView();
	DECLARE_DYNCREATE(CMineView)
		
// Attributes
public:
	CMineDoc* GetDocument();
	
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMineView)
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	//}}AFX_VIRTUAL
	
// Implementation
public:
		virtual ~CMineView();
#ifdef _DEBUG
		virtual void AssertValid() const;
		virtual void Dump(CDumpContext& dc) const;
#endif
		
public:
	void DrawFrame( CDC *pDC );
	void DrawLCD( CDC *pDC, int x, int y, int num );
	void DrawCell( CDC *pDC, int row, int col, int cell=-1 );
	void DrawAdjacentCells( CDC *pDC, int row, int col, int cell );
	void DrawBoard( CDC *pDC );
	void DrawButton( CDC *pDC, int face );
	BOOL InBound( int row, int col );
	void OnBothButtonUp( int row, int col );	
	void OnBothButtonDown( int row, int col );
	void Expand( CDC *pDC, int row, int col );
	void GameOver( int row, int col );
	BOOL CheckForWin();
	void Win();

private:
	CBitmap m_bmCells;
	CBitmap m_bmFaces;
	CBitmap m_bmNumber;
	
	int m_board[24][30];
	int m_mines[24][30];
	BOOL m_graph[24][30];
	int m_width, m_height;
	int m_nMines;
	int m_nMinesLeft;
	int m_nDug;
	CRect m_rcButton;
	BOOL m_bButtonPressed;
	BOOL m_bFirst;
	int m_lastrow, m_lastcol;
	int m_level;
	int m_time;
	BOOL m_bMark;
	GAMESTATE m_gameState;

	int m_recordTime[3];
	CString m_recordName[3];

	// Generated message map functions
protected:
	//{{AFX_MSG(CMineView)
	afx_msg void OnPaint();
	afx_msg void OnGameNew();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnGameCustomize();
	afx_msg void OnGameMark();
	afx_msg void OnUpdateGameMark(CCmdUI* pCmdUI);
	afx_msg void OnGameRecord();
	//}}AFX_MSG
	afx_msg void OnGameLevel( UINT nID );
	afx_msg void OnUpdateGameLevel( CCmdUI *pCmdUI );
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in CeMineView.cpp
inline CMineDoc* CMineView::GetDocument()
{ return (CMineDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_MineView_H__789CED0B_482F_11D4_9BDF_F4538D6D2613__INCLUDED_)

⌨️ 快捷键说明

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