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

📄 renzhe2doc.cpp

📁 贪吃蛇游戏源代码
💻 CPP
字号:
// renzhe2Doc.cpp : implementation of the CRenzhe2Doc class
//

#include "stdafx.h"
#include "renzhe2.h"

#include "renzhe2Doc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRenzhe2Doc

IMPLEMENT_DYNCREATE(CRenzhe2Doc, CDocument)

BEGIN_MESSAGE_MAP(CRenzhe2Doc, CDocument)
	//{{AFX_MSG_MAP(CRenzhe2Doc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRenzhe2Doc construction/destruction

CRenzhe2Doc::CRenzhe2Doc()
{
	// TODO: add one-time construction code here

}

CRenzhe2Doc::~CRenzhe2Doc()
{
}

BOOL CRenzhe2Doc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	L_point=CPoint(60,60);                 //初始化没什么实际意义
	L_point2=CPoint(60,70);
	R_point=CPoint(70,70);
	R_point2=CPoint(70,60);
	m_rect=CRect(L_point,R_point);
	rect[0]=CRect(m_rect);
	m_score=0;                           //得分情况
	m_long=0;                                 //表示蛇有几个方块构成,即蛇的长度
	r_yundong=1;                           //若为1则表示蛇头横向运动
	l_yundong=0;
	u_yundong=0;
	d_yundong=0;
	m_heng=1;
	douzi[0].dou_cunzai=1;
	douzi[0].dou_rect=CRect(401,401,411,411);
	//douzi[0].dou_rect=
	m_doushu=0;
	zhongzhi=1;                           //如果为0则表示游戏未开始后暂停!
	game_zhongzhi=0;
	time=0.0;
	m_dialog=0;
	m_register=0;
	m_gamelevel=90;
	m_totlescore=200;

	
	/*lsize=CSize(-10,0);
	rsize=CSize(10,0);
	usize=CSize(0,-10);
	dsize=CSize(0,10);*/
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CRenzhe2Doc serialization

void CRenzhe2Doc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CRenzhe2Doc diagnostics

#ifdef _DEBUG
void CRenzhe2Doc::AssertValid() const
{
	CDocument::AssertValid();
}

void CRenzhe2Doc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CRenzhe2Doc commands

⌨️ 快捷键说明

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