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

📄 snakeview.h

📁 贪吃蛇源代码(小游戏)
💻 H
字号:
// SnakeView.h : interface of the CSnakeView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SNAKEVIEW_H__9DC30CC4_36C4_4C5F_BFC0_907CBA124303__INCLUDED_)
#define AFX_SNAKEVIEW_H__9DC30CC4_36C4_4C5F_BFC0_907CBA124303__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Square.h"
struct Cell
{
	int row;
	int col;
	//BOOL flag;
};

class CSnakeView : public CView
{
protected: // create from serialization only
	int Grid[16][16];
	void RandData();
	CSnakeView();
	DECLARE_DYNCREATE(CSnakeView)
	int sp,row,col;
	int nScore;
	int bMusic;
	void AddData(int row,int col);
	void InpData(CDC* pDC,int row,int col);
	int nLevel;
	void Init();
	BOOL Result(int row,int col);
// Attributes
public:
	struct Cell  SnGrid [50];
	CSnakeDoc* GetDocument();
	void DisplayScocre(int score,int levle);
	int nKey;
	int nMumber;
	int nControl_1;
	int nControl_2;
	BOOL bFill;
	BOOL bPause;
	BOOL bStart;
	BOOL IncreaseData(int row,int col);
	Square win;
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSnakeView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSnakeView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CSnakeView)
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnPause();
	afx_msg void OnUpdatePause(CCmdUI* pCmdUI);
	afx_msg void OnStart();
	afx_msg void OnUpdateStart(CCmdUI* pCmdUI);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnTow();
	afx_msg void OnUpdateTow(CCmdUI* pCmdUI);
	afx_msg void OnOne();
	afx_msg void OnUpdateOne(CCmdUI* pCmdUI);
	afx_msg void OnThree();
	afx_msg void OnUpdateThree(CCmdUI* pCmdUI);
	afx_msg void OnMusic();
	afx_msg void OnUpdateMusic(CCmdUI* pCmdUI);
	afx_msg void OnExit();
	//}}AFX_MSG
	afx_msg void UpdateOnUp(CCmdUI* pCmdUI);
	afx_msg void UpdateOnDown(CCmdUI* pCmdUI);
	afx_msg void UpdateOnLeft(CCmdUI* pCmdUI);
	afx_msg void UpdateOnRight(CCmdUI* pCmdUI);

	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in SnakeView.cpp
inline CSnakeDoc* CSnakeView::GetDocument()
   { return (CSnakeDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_SNAKEVIEW_H__9DC30CC4_36C4_4C5F_BFC0_907CBA124303__INCLUDED_)

⌨️ 快捷键说明

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