jds_snakeView.h
资源名称:snake.rar [点击查看]
上传用户:ywxcgood
上传日期:2022-06-03
资源大小:1959k
文件大小:3k
源码类别:
其他游戏
开发平台:
Visual C++
- // jds_snakeView.h : interface of the CJds_snakeView class
- //
- /////////////////////////////////////////////////////////////////////////////
- #if !defined(AFX_JDS_SNAKEVIEW_H__CAD78027_D1DC_441A_AA49_C74E625298D0__INCLUDED_)
- #define AFX_JDS_SNAKEVIEW_H__CAD78027_D1DC_441A_AA49_C74E625298D0__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include <string>
- using namespace std;
- struct list
- {
- int x;
- int y;
- };
- struct record
- {
- string name;
- int score;
- };
- class CJds_snakeView : public CView
- {
- protected: // create from serialization only
- CJds_snakeView();
- DECLARE_DYNCREATE(CJds_snakeView)
- // Attributes
- public:
- CJds_snakeDoc* GetDocument();
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CJds_snakeView)
- 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:
- int start;
- void Init();
- int difficulty;
- void aliveordie();
- int last_aspect; //蛇之前前进的方向,用于判断防止蛇逆行
- int can_new; //是否添加新食物
- double random(double start, double end);
- int count; //蛇的节点数
- CRect rct;
- list a[100];
- list b;
- int aspect; //蛇前进的方向
- int xx; //食物的左上角x坐标
- int yy; //食物的左上角y坐标
- virtual ~CJds_snakeView();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- protected:
- // Generated message map functions
- protected:
- //{{AFX_MSG(CJds_snakeView)
- afx_msg void OnTimer(UINT nIDEvent);
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnDifficultyEasy();
- afx_msg void OnDifficultyHard();
- afx_msg void OnDifficultyNormal();
- afx_msg void OnDifficultyVeryhard();
- afx_msg void OnButtonStart();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- #ifndef _DEBUG // debug version in jds_snakeView.cpp
- inline CJds_snakeDoc* CJds_snakeView::GetDocument()
- { return (CJds_snakeDoc*)m_pDocument; }
- #endif
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_JDS_SNAKEVIEW_H__CAD78027_D1DC_441A_AA49_C74E625298D0__INCLUDED_)