📄 snakeview.h
字号:
// SnakeView.h : interface of the CSnakeView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_SNAKEVIEW_H__C33F08E6_D9C0_42EA_9540_41CBA7E397A9__INCLUDED_)
#define AFX_SNAKEVIEW_H__C33F08E6_D9C0_42EA_9540_41CBA7E397A9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxtempl.h>
class CSnakeView : public CView
{
protected: // create from serialization only
CSnakeView();
DECLARE_DYNCREATE(CSnakeView)
// Attributes
public:
CSnakeDoc* GetDocument();
// 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 OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnGameStart();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void ReDisplay(CPoint pPoint);
void IniAim();
void IniGame();
int m_nLeft,m_nTop,m_nWidth,m_nHeight,m_nSize; //起始坐标,宽/高(格数),格子尺寸
int m_nDirect; //当前方向
//1:右,2:左,3:上,4:下
CPoint m_pAim; //当前目标坐标
CArray<CPoint,CPoint> m_aBody; //snake body
int m_nGameStatus; // 0:no_start,1:start
int m_nCount; //吃掉目标数
int m_nTime,m_nTime1; //用时
};
#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__C33F08E6_D9C0_42EA_9540_41CBA7E397A9__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -