📄 snakeview.h
字号:
// SnakeView.h : interface of the CSnakeView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_SNAKEVIEW_H__896AD13C_E47D_44AE_8304_ADEF49A9468A__INCLUDED_)
#define AFX_SNAKEVIEW_H__896AD13C_E47D_44AE_8304_ADEF49A9468A__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 OnGameStart();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnTimer(UINT nIDEvent);
//}}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;//蛇身
int m_nGameStatus;//游戏状态
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__896AD13C_E47D_44AE_8304_ADEF49A9468A__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -