www.pudn.com > Winmine.zip > ChildView.h


// ChildView.h : interface of the CChildView class 
// 
///////////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_CHILDVIEW_H__789CED0B_482F_11D4_9BDF_F4538D6D2613__INCLUDED_) 
#define AFX_CHILDVIEW_H__789CED0B_482F_11D4_9BDF_F4538D6D2613__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
///////////////////////////////////////////////////////////////////////////// 
// CChildView window 
 
enum GAMESTATE{ GS_ACTIVE, GS_GAMEOVER, GS_WIN }; 
 
class CChildView : public CWnd 
{ 
// Construction 
public: 
	CChildView(); 
 
// Attributes 
public: 
 
// Operations 
public: 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CChildView) 
	protected: 
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 
	//}}AFX_VIRTUAL 
 
// Implementation 
public: 
	virtual ~CChildView(); 
	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(CChildView) 
	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 OnRButtonDown(UINT nFlags, CPoint point); 
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 
	afx_msg void OnMouseMove(UINT nFlags, CPoint point); 
	afx_msg void OnRButtonUp(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 void OnHelpTopics(); 
	//}}AFX_MSG 
	afx_msg void OnGameLevel( UINT nID ); 
	afx_msg void OnUpdateGameLevel( CCmdUI *pCmdUI ); 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_CHILDVIEW_H__789CED0B_482F_11D4_9BDF_F4538D6D2613__INCLUDED_)